Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: improve coverage for transaction_controller.go #238

Merged
merged 6 commits into from
Jun 27, 2022

Conversation

antoinegelloz
Copy link
Contributor

No description provided.

@antoinegelloz antoinegelloz requested a review from a team as a code owner June 23, 2022 12:18
@antoinegelloz antoinegelloz force-pushed the num-569-transaction_controllergo branch from caae113 to 405aed6 Compare June 23, 2022 12:30
@codecov
Copy link

codecov bot commented Jun 23, 2022

Codecov Report

Merging #238 (2810209) into main (b11fa82) will increase coverage by 2.09%.
The diff coverage is 89.71%.

@@            Coverage Diff             @@
##             main     #238      +/-   ##
==========================================
+ Coverage   67.16%   69.25%   +2.09%     
==========================================
  Files          72       73       +1     
  Lines        3816     3926     +110     
==========================================
+ Hits         2563     2719     +156     
+ Misses       1001      966      -35     
+ Partials      252      241      -11     
Impacted Files Coverage Δ
pkg/bus/monitor.go 72.91% <0.00%> (-1.56%) ⬇️
pkg/core/posting.go 76.00% <ø> (ø)
pkg/opentelemetry/opentelemetrytraces/storage.go 49.65% <56.25%> (ø)
pkg/storage/storage.go 58.73% <63.63%> (ø)
pkg/ledger/ledger.go 70.94% <81.25%> (-6.03%) ⬇️
pkg/ledger/process.go 84.21% <84.21%> (ø)
pkg/storage/transactions.go 86.66% <86.66%> (ø)
pkg/storage/accounts.go 88.23% <88.23%> (ø)
pkg/storage/sqlstorage/transactions.go 85.22% <90.54%> (+3.19%) ⬆️
pkg/storage/sqlstorage/aggregations.go 83.82% <90.90%> (ø)
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a2c3dd...2810209. Read the comment docs.

if err != nil {
return core.Transaction{}, err
}
if len(tx.Postings) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should modify the storage implementation to return an error if the transaction is not found.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the signature of the store method, it now returns *core.Transaction, with a nil response if the transaction isn't found. Is it better ?

return
}

if err := l.(*ledger.Ledger).SaveMeta(c.Request.Context(), core.MetaTargetTypeTransaction, txId, m); err != nil {
_, err = l.(*ledger.Ledger).GetTransaction(c.Request.Context(), txId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a breaking change. We need to validate this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are we doing here exactly ? i'm not sure i understand

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this changes, we can add a metadata on a transaction while it is not existings.
It is ok on accounts, but not on a transaction. It is more an unexpected behavior than a breaking changes finally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree :) It is clear now @jdupas22?

Copy link
Contributor

@gfyrag gfyrag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments embedded

@gfyrag gfyrag added this to the 1.6.0 milestone Jun 24, 2022
@antoinegelloz antoinegelloz requested a review from gfyrag June 24, 2022 10:30
flemzord
flemzord previously approved these changes Jun 24, 2022
gfyrag
gfyrag previously approved these changes Jun 27, 2022
@antoinegelloz antoinegelloz dismissed stale reviews from gfyrag and flemzord via 2810209 June 27, 2022 11:12
@antoinegelloz antoinegelloz requested a review from flemzord June 27, 2022 12:32
@antoinegelloz antoinegelloz merged commit a28df34 into main Jun 27, 2022
@antoinegelloz antoinegelloz deleted the num-569-transaction_controllergo branch June 27, 2022 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants