Skip to content

Commit

Permalink
test: wait for keyring for plan apply tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tgross committed Sep 20, 2024
1 parent 68ecf67 commit e5a6568
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nomad/plan_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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{}

Expand Down

0 comments on commit e5a6568

Please sign in to comment.