Skip to content

Commit

Permalink
add a cap to iterations for newenemy test
Browse files Browse the repository at this point in the history
occasionally the number of iterations picked will take longer than the
timeout for the test suite. capping it means that we sometimes will not
run the full iterations to be convincing, but the effect should be
amortized over PR runs. The cap (and timeout) can be removed for any
change that we suspect may have implications for the test.
  • Loading branch information
ecordell committed Dec 8, 2021
1 parent 782a9d4 commit 7b1ffa7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion e2e/newenemy/newenemy_test.go
Expand Up @@ -139,7 +139,9 @@ func TestNoNewEnemy(t *testing.T) {

samplestddev := stddev / math.Sqrt(float64(sampleSize))
// how many iterations do we need to get > 3sigma from the mean?
iterations := int(math.Ceil(3*stddev*samplestddev + mean))
// cap max_iterations to control test runtime
const max_iterations = 100
iterations := int(math.Max(max_iterations, math.Ceil(3*stddev*samplestddev+mean)))

t.Logf("check spicedb is protected after %d attempts", iterations)
// *6 to cover the worst case where all requests are handled by the slow node
Expand Down

0 comments on commit 7b1ffa7

Please sign in to comment.