Skip to content

Tests: Extend TestCatchpointAfterTxns to catch catchpoint write corruption#4818

Merged
michaeldiamant merged 5 commits intoalgorand:masterfrom
michaeldiamant:kvs_catchpoint_test
Nov 30, 2022
Merged

Tests: Extend TestCatchpointAfterTxns to catch catchpoint write corruption#4818
michaeldiamant merged 5 commits intoalgorand:masterfrom
michaeldiamant:kvs_catchpoint_test

Conversation

@michaeldiamant
Copy link
Copy Markdown
Contributor

Extends catchpoint tests to help catch regressions:

Notes:

  • If folks prefer to not have an isolated test case, I can revert to the initial commit (a776629).
  • I ran out of time to convert existing test usage from mocks to DoubleLedger. As is, the PR contains a kludgey if-statement (Skip invariant check for tests using mocks). Even as is, I think the PR presents a value add.

@michaeldiamant michaeldiamant marked this pull request as ready for review November 21, 2022 14:11
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 21, 2022

Codecov Report

Merging #4818 (c9425ed) into master (5b45539) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4818      +/-   ##
==========================================
- Coverage   54.63%   54.62%   -0.02%     
==========================================
  Files         417      417              
  Lines       53734    53734              
==========================================
- Hits        29358    29350       -8     
- Misses      21940    21941       +1     
- Partials     2436     2443       +7     
Impacted Files Coverage Δ
ledger/accountdb.go 72.46% <ø> (+0.11%) ⬆️
ledger/blockqueue.go 85.63% <0.00%> (-2.88%) ⬇️
crypto/merkletrie/trie.go 66.42% <0.00%> (-2.19%) ⬇️
crypto/merkletrie/node.go 91.62% <0.00%> (-1.87%) ⬇️
catchup/peerSelector.go 98.95% <0.00%> (-1.05%) ⬇️
catchup/service.go 68.96% <0.00%> (-0.50%) ⬇️
network/wsNetwork.go 67.17% <0.00%> (-0.09%) ⬇️
ledger/catchpointtracker.go 59.49% <0.00%> (+0.47%) ⬆️
data/transactions/verify/txn.go 76.03% <0.00%> (+0.92%) ⬆️

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

Comment thread ledger/accountdb.go Outdated
Comment thread ledger/catchpointwriter_test.go Outdated
Comment thread ledger/catchpointwriter_test.go
Comment thread ledger/catchpointwriter_test.go Outdated
defer dl.Close()
// Exercises interactions between transaction evaluation and catchpoint
// generation to confirm catchpoints include expected transactions.
t.Run("chunks", func(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are we gaining something from pushing things into a t.Run? It obscures the diff, and I don't think it has the isolation properties you might be hoping for anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jannotti It's subjective - I think there are 2 discrete test cases here. I felt they can be left under the same test name (TestCatchpointAfterTxns) and separated by t.Run.

The PR's initial commit shows everything inline as 1 test case without t.Run. As mentioned in the PR description, I'm willing to remove t.Run if reviewers feel strongly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jannotti Per our verbal, c9425ed removes t.Run in favor of discrete tests.

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