Skip to content

Commit

Permalink
Fix inconsistent map iteration order flake in test. (#10293)
Browse files Browse the repository at this point in the history
  • Loading branch information
seizethedave authored Dec 20, 2024
1 parent 457fe6c commit f2217e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/blockbuilder/schedulerpb/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ func TestSendUpdates(t *testing.T) {
require.Empty(t, sched.updates)

cli.sendUpdates(ctx)
require.EqualValues(t, []*UpdateJobRequest{
require.ElementsMatch(t, []*UpdateJobRequest{
{Key: &sched.jobs[0].key, WorkerId: "worker1", Spec: &sched.jobs[0].spec, Complete: false},
}, sched.updates)

cli.sendUpdates(ctx)
require.EqualValues(t, []*UpdateJobRequest{
require.ElementsMatch(t, []*UpdateJobRequest{
{Key: &sched.jobs[0].key, WorkerId: "worker1", Spec: &sched.jobs[0].spec, Complete: false},
{Key: &sched.jobs[0].key, WorkerId: "worker1", Spec: &sched.jobs[0].spec, Complete: false},
}, sched.updates)
Expand All @@ -64,15 +64,15 @@ func TestSendUpdates(t *testing.T) {

// Now we have one complete job and one incomplete. We should be sending updates for both.
cli.sendUpdates(ctx)
require.EqualValues(t, []*UpdateJobRequest{
require.ElementsMatch(t, []*UpdateJobRequest{
{Key: &sched.jobs[0].key, WorkerId: "worker1", Spec: &sched.jobs[0].spec, Complete: false},
{Key: &sched.jobs[0].key, WorkerId: "worker1", Spec: &sched.jobs[0].spec, Complete: false},
{Key: &sched.jobs[0].key, WorkerId: "worker1", Spec: &sched.jobs[0].spec, Complete: true},
{Key: &sched.jobs[1].key, WorkerId: "worker1", Spec: &sched.jobs[1].spec, Complete: false},
}, sched.updates)

cli.sendUpdates(ctx)
require.EqualValues(t, []*UpdateJobRequest{
require.ElementsMatch(t, []*UpdateJobRequest{
{Key: &sched.jobs[0].key, WorkerId: "worker1", Spec: &sched.jobs[0].spec, Complete: false},
{Key: &sched.jobs[0].key, WorkerId: "worker1", Spec: &sched.jobs[0].spec, Complete: false},
{Key: &sched.jobs[0].key, WorkerId: "worker1", Spec: &sched.jobs[0].spec, Complete: true},
Expand Down

0 comments on commit f2217e9

Please sign in to comment.