Skip to content

Tests: 'Revert Tests Fix t.Parallel() errors in data package'#4995

Merged
onetechnical merged 1 commit intomasterfrom
revert-4981-paralleltest-data-package
Jan 10, 2023
Merged

Tests: 'Revert Tests Fix t.Parallel() errors in data package'#4995
onetechnical merged 1 commit intomasterfrom
revert-4981-paralleltest-data-package

Conversation

@gmalouf
Copy link
Copy Markdown
Contributor

@gmalouf gmalouf commented Jan 10, 2023

Reverts #4981

@onetechnical onetechnical changed the title Revert "Tests: Fix t.Parallel() errors in data package" Tests: Revert "Tests: Fix t.Parallel() errors in data package" Jan 10, 2023
@onetechnical onetechnical changed the title Tests: Revert "Tests: Fix t.Parallel() errors in data package" Tests: Revert "Tests Fix t.Parallel() errors in data package" Jan 10, 2023
@onetechnical onetechnical changed the title Tests: Revert "Tests Fix t.Parallel() errors in data package" Tests: Revert "Tests Fix t.Parallel() errors in data package" Jan 10, 2023
@onetechnical onetechnical changed the title Tests: Revert "Tests Fix t.Parallel() errors in data package" Tests: 'Revert Tests Fix t.Parallel() errors in data package' Jan 10, 2023
@algonautshant
Copy link
Copy Markdown
Contributor

My comment is particularly for txn_test.go:
Many of the tests here run way under 1 second (at least the ones I wrote).
This has been the result of hours of work to test everything needed to test within that time limit. They absolutely do not need the t.Parallel()
Many of the tests here rely on global counters in the code. If Two tests run together, they will fail.
I suggest that the authors of the tests be notified next time when making changes to the tests.

I feel bad here because I spent a lot of time carefully removing the t.Parallel() calls from this file, and only I see them come back and removed again...

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 10, 2023

Codecov Report

Merging #4995 (63f05c6) into master (ecdcbf9) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #4995   +/-   ##
=======================================
  Coverage   53.63%   53.64%           
=======================================
  Files         432      432           
  Lines       54057    54057           
=======================================
+ Hits        28996    28999    +3     
+ Misses      22818    22810    -8     
- Partials     2243     2248    +5     
Impacted Files Coverage Δ
crypto/merkletrie/trie.go 66.42% <0.00%> (-2.19%) ⬇️
agreement/cryptoVerifier.go 67.60% <0.00%> (-2.12%) ⬇️
agreement/proposalManager.go 96.07% <0.00%> (-1.97%) ⬇️
crypto/merkletrie/node.go 91.62% <0.00%> (-1.87%) ⬇️
data/transactions/verify/txn.go 70.24% <0.00%> (-0.49%) ⬇️
network/wsNetwork.go 64.92% <0.00%> (+0.17%) ⬆️
ledger/tracker.go 75.10% <0.00%> (+0.84%) ⬆️
catchup/service.go 70.53% <0.00%> (+1.20%) ⬆️
network/wsPeer.go 68.32% <0.00%> (+1.89%) ⬆️

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

// TestStreamVerifierPostVBlocked tests the behavior when the return channel (result chan) of verified
// transactions is blocked, and checks droppedFromPool counter to confirm the drops
func TestStreamVerifierPostVBlocked(t *testing.T) {
partitiontest.PartitionTest(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.

This should remain.

}

func TestStreamVerifierMakeStreamVerifierErr(t *testing.T) {
partitiontest.PartitionTest(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.

This should remain.


// TestBlockWatcher runs multiple goroutines to check the concurency and correctness of the block watcher
func TestStreamVerifierBlockWatcher(t *testing.T) {
partitiontest.PartitionTest(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.

This should remain.

Comment thread data/txHandler_test.go
}

func TestMakeTxHandlerErrors(t *testing.T) {
partitiontest.PartitionTest(t)
Copy link
Copy Markdown
Contributor

@algonautshant algonautshant Jan 10, 2023

Choose a reason for hiding this comment

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

Please keep this.

Comment thread data/txHandler_test.go
// stops, starts in a loop, sends more transactions, and makes sure all the transactions
// are accounted for. It uses the production backlog worker
func TestTxHandlerRestartWithBacklogAndTxPool(t *testing.T) { //nolint:paralleltest // Not parallel because it mutates global metrics
partitiontest.PartitionTest(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.

Please don't remove this.

@gmalouf
Copy link
Copy Markdown
Contributor Author

gmalouf commented Jan 10, 2023

@algonautshant our intention is to straight revert this PR (fix the build) then to revisit with @jdtzmn

I suggest you/him align on a pattern/annotation to apply to tests to indicate which ones we've decided from past work can NOT be parallelized to save folks in the future from the pain. Even better if we can point out the why, though that might be a bridge too far.

defer registryCloseTest(t, registry, dbfile)

access, err := db.MakeAccessor(t.Name()+"_stateprooftest", false, true)
access, err := db.MakeAccessor("stateprooftest", false, true)
Copy link
Copy Markdown
Contributor

@algonautshant algonautshant Jan 10, 2023

Choose a reason for hiding this comment

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

Keeping this as is won't hurt. Keeping or reverting is fine here and other places for this.


// TestJsonMarshal ensures that BoxRef names are b64 encoded, since they may not be characters.
func TestJsonMarshal(t *testing.T) {
partitiontest.PartitionTest(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.

Need to keep this please partitiontest.PartitionTest(t)


// TestJsonUnmarshal ensures that BoxRef unmarshaling expects b64 names
func TestJsonUnmarshal(t *testing.T) {
partitiontest.PartitionTest(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.

Need to keep this please partitiontest.PartitionTest(t)

Copy link
Copy Markdown
Contributor

@algonautshant algonautshant left a comment

Choose a reason for hiding this comment

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

Looks good.
Some comments. Must keep the partitiontest.PartitionTest(t) wherever removed (I commented on all).
Will be nice to keep the linter and explanations for the t.parallel removals (I commented on all).

// encoded. These things could change without breaking the protocol, should stay
// the same for the sake of REST API compatibility.
func TestTxnJson(t *testing.T) {
partitiontest.PartitionTest(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.

Need to keep this please partitiontest.PartitionTest(t)

Comment thread data/txHandler_test.go
}
}

func TestTxHandlerRememberReportErrorsWithTxPool(t *testing.T) { //nolint:paralleltest // Not parallel because it mutates global metrics
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.

It's a good idea to keep the explanation here.

a.NoError(err)
}

func TestKeyregValidityPeriod(t *testing.T) { //nolint:paralleltest // Not parallel because it modifies config.Consensus
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.

It's a good idea to keep the explanation here.

require.Equal(t, bd2.NextProtocolSwitchOn-bd2.NextProtocolVoteBefore, basics.Round(5))
}

func TestBlockUnsupported(t *testing.T) { //nolint:paralleltest // Not parallel because it modifies config.Consensus
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.

It's a good idea to keep the explanation here.


const spProto = protocol.ConsensusVersion("test-state-proof-enabled")

func TestTxnValidationStateProof(t *testing.T) { //nolint:paralleltest // Not parallel because it modifies config.Consensus
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.

It's a good idea to keep the explanation here.

Comment thread data/txHandler_test.go
}

// TestTxHandlerIncomingTxHandleDrops accounts for the dropped txns when the verifier/exec pool is saturated
func TestTxHandlerIncomingTxHandleDrops(t *testing.T) { //nolint:paralleltest // Not parallel because it changes the backlog size
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.

It's a good idea to keep the explanation here.

Comment thread data/txHandler_test.go
}

// TestTxHandlerIncomingTxHandleDrops accounts for the dropped txns when the verifier/exec pool is saturated
func TestTxHandlerIncomingTxHandleDrops(t *testing.T) { //nolint:paralleltest // Not parallel because it changes the backlog size
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.

It's a good idea to keep the explanation here.

Comment thread data/txHandler_test.go
handler.Stop() // cancel the handler ctx
}

func TestTxHandlerPostProcessError(t *testing.T) { //nolint:paralleltest // Not parallel because it mutates global metrics
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.

It's a good idea to keep the explanation here.

Comment thread data/txHandler_test.go
require.Len(t, result, expected+1)
}

func TestTxHandlerPostProcessErrorWithVerify(t *testing.T) { //nolint:paralleltest // Not parallel because it mutates global metrics
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.

It's a good idea to keep the explanation here.

Comment thread data/txHandler_test.go
}

// TestTxHandlerRememberReportErrors checks Is and As statements work as expected
func TestTxHandlerRememberReportErrors(t *testing.T) { //nolint:paralleltest // Not parallel because incomingTxHandlerProcessing mutates global metrics
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.

It's a good idea to keep the explanation here.

@onetechnical onetechnical merged commit 149ebb8 into master Jan 10, 2023
@onetechnical onetechnical deleted the revert-4981-paralleltest-data-package branch January 10, 2023 17:39
winder pushed a commit to winder/go-algorand that referenced this pull request Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants