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

CI: add test partitioning based on partition test verifier output #3859

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

cce
Copy link
Contributor

@cce cce commented Apr 4, 2022

Summary

We have a test partitioning system that uses calls to partitiontest.PartitionTest(t) to shard tests. There is also a verification job to check for accidentally skipped or unnecessarily multiply-run tests. This cleans up some of the "RAN MULTIPLE TIMES" warnings of unnecessarily multiply-run tests from output like https://app.circleci.com/pipelines/github/algorand/go-algorand/5910/workflows/d5620b33-8dd4-4211-a1b1-1780a792126a/jobs/99253 and https://app.circleci.com/pipelines/github/algorand/go-algorand/5907/workflows/ee653582-9329-43f2-87fc-51dc047d2e3d/jobs/99171

Test Plan

Existing tests should pass, and there should be fewer "RAN MULTIPLE TIMES" warnings in the verification job output. There should be no "UNINTENTIONALLY SKIPPED" errors in the output (this would trigger a CI error).

@cce cce added the Enhancement label Apr 4, 2022
@cce cce self-assigned this Apr 4, 2022
@cce
Copy link
Contributor Author

cce commented Apr 6, 2022

image

image

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.

Seems fine. My comment is just curiosity.

Comment on lines +425 to +439
// TestEvalAppStateCountsWithTxnGroupBlackbox ensures txns in a group can't violate app state schema limits
// the test ensures that
// commitToParent -> applyChild copies child's cow state usage counts into parent
// and the usage counts correctly propagated from parent cow to child cow and back
func TestEvalAppStateCountsWithTxnGroup(t *testing.T) {
func TestEvalAppStateCountsWithTxnGroupBlackbox(t *testing.T) {
partitiontest.PartitionTest(t)

_, _, err := testEvalAppGroup(t, basics.StateSchema{NumByteSlice: 1})
require.Error(t, err)
require.Contains(t, err.Error(), "store bytes count 2 exceeds schema bytes count 1")
}

// TestEvalAppAllocStateWithTxnGroup ensures roundCowState.deltas and applyStorageDelta
// TestEvalAppAllocStateWithTxnGroupBlackbox ensures roundCowState.deltas and applyStorageDelta
// produce correct results when a txn group has storage allocate and storage update actions
func TestEvalAppAllocStateWithTxnGroup(t *testing.T) {
func TestEvalAppAllocStateWithTxnGroupBlackbox(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I certainly see nothing wrong with changing these names, but I'm curious if it mattered for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the skipped / multiply-run test counting checker in scripts/buildtools/check_tests.py uses the package + test name from the JUnit file to ensure all tests ran at least once (i.e. no tests were skipped by all shards). It got confused about there being two identically named tests in this package (there is also TestEvalAppStateCountsWithTxnGroup and TestEvalAppAllocStateWithTxnGroup in eval_test.go), so it was reporting it as not having been correctly sharded because the package naming for the blackbox test allows the same test name to be re-used.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have any easy way to catch that in the future, or conversely, can the checker take file name into account?

And wait - you can have two TestX() functions in the same package?!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the JUnit file only reports package and test names, so no ... but I was surprised too. It's because eval_test.go uses "package internal" and eval_blackbox_test.go uses "package internal_test" so the names don't conflict with each other — they're in two different package namespaces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, the checker's main job is to ensure no test was skipped by all shards, so it is still correct even if this happens in the future.

@cce cce merged commit 70a5532 into algorand:master Apr 6, 2022
@cce cce deleted the partition-duplicate-tests branch April 6, 2022 13:30
PhearZero pushed a commit to PhearNet/crypto that referenced this pull request Jan 17, 2025
tmc pushed a commit to tmc/go-algorand that referenced this pull request Mar 7, 2025
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