From aa2e297a4e36ffa4b9401fa5cb9f733b72835a37 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Tue, 1 Feb 2022 10:16:31 +0100 Subject: [PATCH] ci: address macos-latest test flakes (#4310) * sdk/opa_test: increase max delta 6ms was arbitrary, and so is 10ms. When GHA switched the macos-latest version, we've started seeing test flakiness here. 30ms (20ms+10ms) are still waaaay below the 1s that the test_plugin attempts need to shut down. * test/e2e/certrefresh: double wait time for macos runner Signed-off-by: Stephan Renatus --- sdk/opa_test.go | 2 +- test/e2e/certrefresh/certrefresh_test.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sdk/opa_test.go b/sdk/opa_test.go index 14afab6a38..ad8f953c0e 100644 --- a/sdk/opa_test.go +++ b/sdk/opa_test.go @@ -483,7 +483,7 @@ func TestStopWithDeadline(t *testing.T) { dur := time.Since(before) diff := dur - timeout - maxDelta := 6 * time.Millisecond + maxDelta := 10 * time.Millisecond if diff > maxDelta || diff < -maxDelta { t.Errorf("expected shutdown to have %v grace period, measured shutdown in %v (max delta %v)", timeout, dur, maxDelta) } diff --git a/test/e2e/certrefresh/certrefresh_test.go b/test/e2e/certrefresh/certrefresh_test.go index 70fa800706..8658bc3208 100644 --- a/test/e2e/certrefresh/certrefresh_test.go +++ b/test/e2e/certrefresh/certrefresh_test.go @@ -94,6 +94,7 @@ func TestMain(m *testing.M) { } func TestCertificateRotation(t *testing.T) { + wait := 20 * time.Millisecond // file reload happens every millisecond // before rotation cert := getCert(t) @@ -103,7 +104,7 @@ func TestCertificateRotation(t *testing.T) { // replace file on disk replaceCerts(t, certFile1, certKeyFile1) - time.Sleep(10 * time.Millisecond) // file reload happens every millisecond + time.Sleep(wait) // after rotation cert = getCert(t) @@ -113,7 +114,7 @@ func TestCertificateRotation(t *testing.T) { // replace file with nothing replaceCerts(t, os.DevNull, os.DevNull) - time.Sleep(10 * time.Millisecond) + time.Sleep(wait) // second cert still used cert = getCert(t) @@ -123,7 +124,7 @@ func TestCertificateRotation(t *testing.T) { // go back to first cert replaceCerts(t, certFile0, certKeyFile0) - time.Sleep(10 * time.Millisecond) + time.Sleep(wait) cert = getCert(t) if exp, act := serial0, string(cert.SerialNumber.String()); exp != act { t.Fatalf("expected signature %s, got %s", exp, act)