From 72e7745b5c5962f0032d4dc320946cc3f18ed65c Mon Sep 17 00:00:00 2001 From: Evan Cordell Date: Wed, 8 Dec 2021 09:41:12 -0500 Subject: [PATCH] add a cap to iterations for newenemy test 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. --- e2e/newenemy/newenemy_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/e2e/newenemy/newenemy_test.go b/e2e/newenemy/newenemy_test.go index c83a32b729..f2a6ab2daf 100644 --- a/e2e/newenemy/newenemy_test.go +++ b/e2e/newenemy/newenemy_test.go @@ -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.Min(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