summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTsachi Herman <tsachi.herman@algorand.com>2022-02-24 19:43:43 -0500
committerGitHub <noreply@github.com>2022-02-24 19:43:43 -0500
commit7a129374c8aa7b33da05494bfb4cc73070cf1b19 (patch)
treeb40fa75d21b34dbbac3377194fc7d2f77db17553
parent1bb149d3f18e46cf7750a9d798e2c24a9b51ed8f (diff)
fix test (#3683)
Summary The TestPseudonodeFailedEnqueuedTasks test wasn't accounting correctly for errPseudonodeBacklogFull errors. Test Plan Run 1000 times localy. I was able to reproduce it consistently.
-rw-r--r--agreement/pseudonode_test.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/agreement/pseudonode_test.go b/agreement/pseudonode_test.go
index b4209ffde..dfb9f2ce1 100644
--- a/agreement/pseudonode_test.go
+++ b/agreement/pseudonode_test.go
@@ -520,11 +520,12 @@ func TestPseudonodeFailedEnqueuedTasks(t *testing.T) {
for i := 0; i < pseudonodeVerificationBacklog*2; i++ {
ch, err = pb.MakeProposals(context.Background(), startRound, period(i))
if err != nil {
- require.Subset(t, []int{pseudonodeVerificationBacklog, pseudonodeVerificationBacklog + 1}, []int{i})
+ require.ErrorAs(t, errPseudonodeBacklogFull, &err)
break
}
channels = append(channels, ch)
}
+ enqueuedProposals := len(channels)
require.Error(t, err, "MakeProposals did not returned an error when being overflowed with requests")
require.True(t, errors.Is(err, errPseudonodeBacklogFull))
@@ -533,17 +534,17 @@ func TestPseudonodeFailedEnqueuedTasks(t *testing.T) {
for i := 0; i < pseudonodeVerificationBacklog*2; i++ {
ch, err = pb.MakeVotes(context.Background(), startRound, period(i), step(i%5), makeProposalValue(period(i), accounts[0].Address()), persist)
if err != nil {
- require.Subset(t, []int{pseudonodeVerificationBacklog, pseudonodeVerificationBacklog + 1}, []int{i})
+ require.ErrorAs(t, errPseudonodeBacklogFull, &err)
break
}
channels = append(channels, ch)
}
require.Error(t, err, "MakeVotes did not returned an error when being overflowed with requests")
-
+ enqueuedVotes := len(channels) - enqueuedProposals
// drain output channels.
for _, ch := range channels {
drainChannel(ch)
}
- require.Equal(t, 330, subStrLogger.instancesFound[0])
- require.Equal(t, 330, subStrLogger.instancesFound[1])
+ require.Equal(t, enqueuedVotes*len(accounts), subStrLogger.instancesFound[0])
+ require.Equal(t, enqueuedProposals*len(accounts), subStrLogger.instancesFound[1])
}