testing: remove basics AccountData.OnlineAccountData conversion function#6313
Merged
cce merged 1 commit intoalgorand:masterfrom May 6, 2025
Merged
Conversation
00ca637 to
461f232
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR moves the conversion function for AccountData to OnlineAccountData out of the production code and into the testing package, updating tests across the repository to use the new basics_testing.OnlineAccountData conversion function.
- Replaces all calls to ad.OnlineAccountData() with basics_testing.OnlineAccountData(ad) in test files.
- Removes the OnlineAccountData conversion function from the production data/basics/userBalance.go file and reintroduces it only for testing purposes in data/basics/testing.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ledger/ledger_test.go | Updated OnlineAccountData conversion function call in tests. |
| ledger/eval_simple_test.go | Updated OnlineAccountData conversion function call in tests. |
| ledger/eval/eval_test.go | Updated OnlineAccountData conversion function call in tests. |
| ledger/acctonline_test.go | Updated OnlineAccountData conversion function call in tests. |
| data/committee/common_test.go | Updated OnlineAccountData conversion function call in tests. |
| data/basics/userBalance_test.go | Removed extra helper functions; tests adjusted for new conversion. |
| data/basics/userBalance.go | Removed the OnlineAccountData conversion function from production. |
| data/basics/testing/userBalance_test.go | Added tests for the new testing conversion function. |
| data/basics/testing/userBalance.go | Introduced the OnlineAccountData conversion function for tests only. |
| agreement/fuzzer/ledger_test.go | Updated OnlineAccountData conversion function call in tests. |
| agreement/common_test.go | Updated OnlineAccountData conversion function call in tests. |
| agreement/agreementtest/simulate_test.go | Updated OnlineAccountData conversion function call in tests. |
gmalouf
approved these changes
May 5, 2025
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6313 +/- ##
==========================================
- Coverage 51.60% 51.57% -0.04%
==========================================
Files 649 649
Lines 87048 87048
==========================================
- Hits 44923 44894 -29
- Misses 39263 39284 +21
- Partials 2862 2870 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
algorandskiy
approved these changes
May 5, 2025
cce
added a commit
to cce/go-algorand
that referenced
this pull request
May 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We have a conversion function in the basics.AccountData type to make a basics.OnlineAccountData type, but it is only used by tests. The actual conversion used by non-test code occurs in ledgercore.AccountData. However tests continue to use this function for setting up small tests with fake accounts and mocked ledgers. This moves it to the data/basics/testing package to hopefully reduce confusion, and make it so non-test code will continue to not use this method.
Test Plan
Existing tests were updated and should still pass.