mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-13 03:42:35 -06:00
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 <stephan.renatus@gmail.com>
This commit is contained in:
+1
-1
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user