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

Tests: Fix handling of empty local state in TestResourcesDataApp #4699

Merged

Conversation

michaeldiamant
Copy link
Contributor

Fixes the failed TestResourcesDataApp test run from https://app.circleci.com/pipelines/github/algorand/go-algorand/10048/workflows/dab1223e-f91d-4865-8824-ab00327a41f1/jobs/176490 by modifying the test to account for empty local state.

Notes:

  • https://github.com/algorand/go-algorand/pull/4669/files#diff-f98dee0358238dafbdeae29c761862fbc496f0af2335d85cdec69954a82ba848R214 generates an input that was previously not generated: NumUint = 0 and NumByteSlice = 0.
  • With NumUint = 0 and NumByteSlice = 0, IsEmptyAppFields returns true. I assume that's the intended behavior.
  • Rather than change the input generation scheme for the test, I chose to branch the test on appState.Schema.NumEntries() == 0.
  • Additionally - I coarsely wrapped the test invocation in a for-loop to run N-times due to the usage of randomly generated inputs.
    • If folks prefer, I can remove the wrapping for-loop. I think it'll help catch regressions, but I'm not tied to it.
    • I did consider other refactorings, but settled on the shown approach because I didn't feel more effort was warranted now. If folks wish to discuss, I can elaborate on alternatives.

@michaeldiamant michaeldiamant changed the title Fix handling of empty local state in TestResourcesDataApp Tests: Fix handling of empty local state in TestResourcesDataApp Oct 26, 2022
@codecov
Copy link

codecov bot commented Oct 26, 2022

Codecov Report

Merging #4699 (18f34b5) into master (ad08f74) will decrease coverage by 0.05%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4699      +/-   ##
==========================================
- Coverage   54.49%   54.44%   -0.06%     
==========================================
  Files         407      407              
  Lines       52389    52389              
==========================================
- Hits        28548    28521      -27     
- Misses      21455    21479      +24     
- Partials     2386     2389       +3     
Impacted Files Coverage Δ
ledger/blockqueue.go 85.63% <0.00%> (-2.88%) ⬇️
agreement/cryptoVerifier.go 67.60% <0.00%> (-2.12%) ⬇️
agreement/proposalManager.go 96.07% <0.00%> (-1.97%) ⬇️
ledger/acctupdates.go 68.85% <0.00%> (-1.35%) ⬇️
catchup/peerSelector.go 98.95% <0.00%> (-1.05%) ⬇️
data/transactions/verify/txn.go 76.19% <0.00%> (-0.96%) ⬇️
ledger/tracker.go 74.04% <0.00%> (-0.86%) ⬇️
cmd/tealdbg/debugger.go 72.69% <0.00%> (-0.81%) ⬇️
catchup/service.go 68.88% <0.00%> (-0.50%) ⬇️
network/wsNetwork.go 65.34% <0.00%> (-0.19%) ⬇️
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@michaeldiamant michaeldiamant marked this pull request as ready for review October 26, 2022 17:59
jannotti
jannotti previously approved these changes Oct 26, 2022
Copy link
Contributor

@jannotti jannotti left a comment

Choose a reason for hiding this comment

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

I think it's fine. it'd be slightly easier to read the diff w/o the for-loop, but I'm assuming I found the changes by looking only at the inserted if statements,

ledger/accountdb_test.go Show resolved Hide resolved
@michaeldiamant michaeldiamant merged commit 4e36847 into algorand:master Oct 26, 2022
@michaeldiamant michaeldiamant deleted the fix_TestResourcesDataApp branch October 26, 2022 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants