From e5a6568da79d15c1f8e53e88e0e385a6017dd35c Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Fri, 20 Sep 2024 10:01:03 -0400 Subject: [PATCH] test: wait for keyring for plan apply tests In #23977 we merged a change to how the keyring was stored. Because keyring initialization takes slightly longer now, this uncovered existing timing bugs in some of our tests where tests that require the keyring (ex. plan applier tests) were waiting for the leader but not the keyring initialization. Fix some of the examples we've seen cause test flakes. --- nomad/plan_endpoint_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nomad/plan_endpoint_test.go b/nomad/plan_endpoint_test.go index 5c39df0d2b0..e2c4cc52e21 100644 --- a/nomad/plan_endpoint_test.go +++ b/nomad/plan_endpoint_test.go @@ -25,7 +25,7 @@ func TestPlanEndpoint_Submit(t *testing.T) { }) defer cleanupS1() codec := rpcClient(t, s1) - testutil.WaitForLeader(t, s1.RPC) + testutil.WaitForKeyring(t, s1.RPC, s1.Region()) // Create the register request eval1 := mock.Eval() @@ -67,7 +67,7 @@ func TestPlanEndpoint_Submit_Bad(t *testing.T) { }) defer cleanupS1() codec := rpcClient(t, s1) - testutil.WaitForLeader(t, s1.RPC) + testutil.WaitForKeyring(t, s1.RPC, s1.Region()) // Mock a valid eval being dequeued by a worker eval := mock.Eval() @@ -141,7 +141,7 @@ func TestPlanEndpoint_ApplyConcurrent(t *testing.T) { c.NumSchedulers = 0 }) defer cleanupS1() - testutil.WaitForLeader(t, s1.RPC) + testutil.WaitForKeyring(t, s1.RPC, s1.Region()) plans := []*structs.Plan{}