Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix assertAlertmanagersAreResilientToDisruption() #454

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions test/e2e/monitoring_stack_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,22 @@ func assertAlertmanagersAreOnDifferentNodes(t *testing.T, pods []corev1.Pod) {
}

func assertAlertmanagersAreResilientToDisruption(t *testing.T, pods []corev1.Pod) {
for i, pod := range pods {
lastPod := i == len(pods)-1
err := f.Evict(&pod, 0)
if lastPod && err == nil {
t.Fatal("expected an error when evicting the last pod, got nil")
errs := make([]error, len(pods))
for i := range pods {
pod := pods[i]
errs[i] = f.Evict(&pod, 0)
}

for i, err := range errs {
if i != len(errs)-1 {
if err != nil {
t.Fatalf("expected no error when evicting pod with index %d, got %v", i, err)
}
continue
}
if !lastPod && err != nil {
t.Fatalf("expected no error when evicting pod with index %d, got %v", i, err)

if err == nil {
t.Fatalf("expected an error when evicting the last pod %d, got nil", i)
}
}
}
Expand Down
Loading