Skip to content

Commit

Permalink
test(runtime): fix concurrency in disruption tests (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
hspedro authored May 2, 2024
1 parent 1aaa800 commit 471ce4f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/adapters/runtime/kubernetes/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,19 @@ func TestMitigateDisruption(t *testing.T) {
}
}()

pdb, err := client.PolicyV1().PodDisruptionBudgets(scheduler.Name).Get(ctx, scheduler.Name, metav1.GetOptions{})
require.NoError(t, err)
require.NotNil(t, pdb)
require.Equal(t, pdb.Name, scheduler.Name)
require.Equal(t, pdb.Spec.MinAvailable.IntVal, int32(0))

time.Sleep(time.Millisecond * 100)
newValue := 100
err = kubernetesRuntime.MitigateDisruption(ctx, scheduler, newValue, 0.0)
require.NoError(t, err)

time.Sleep(time.Millisecond * 100)
pdb, err := client.PolicyV1().PodDisruptionBudgets(scheduler.Name).Get(ctx, scheduler.Name, metav1.GetOptions{})
pdb, err = client.PolicyV1().PodDisruptionBudgets(scheduler.Name).Get(ctx, scheduler.Name, metav1.GetOptions{})
require.NoError(t, err)
require.NotNil(t, pdb)
require.Equal(t, pdb.Name, scheduler.Name)
Expand Down

0 comments on commit 471ce4f

Please sign in to comment.