Skip to content

Commit

Permalink
fix: duplicate monitoringstack name caused case unstable (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
lihongyan1 committed May 13, 2024
1 parent 2fcc415 commit 6d91f2e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/e2e/monitoring_stack_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestMonitoringStackController(t *testing.T) {
}, {
name: "Alertmanager runs in HA mode",
scenario: func(t *testing.T) {
stackName := "alerting"
stackName := "alerting-ha"
assertAlertmanagerCreated(t, stackName)
pods, err := f.GetStatefulSetPods("alertmanager-"+stackName, e2eTestNamespace)
if err != nil {
Expand Down Expand Up @@ -529,7 +529,7 @@ func assertPDBExpectedPodsAreHealthy(t *testing.T, name, namespace string) {
}

func assertAlertmanagerReceivesAlerts(t *testing.T) {
ms := newMonitoringStack(t, "alerting")
ms := newMonitoringStack(t, "alerting-receive")
if err := f.K8sClient.Create(context.Background(), ms); err != nil {
t.Fatal(err)
}
Expand All @@ -538,12 +538,12 @@ func assertAlertmanagerReceivesAlerts(t *testing.T) {
if err := f.K8sClient.Create(context.Background(), rule); err != nil {
t.Fatal(err)
}
f.AssertStatefulsetReady("alertmanager-alerting", e2eTestNamespace, framework.WithTimeout(2*time.Minute))(t)
f.AssertStatefulsetReady("alertmanager-alerting-receive", e2eTestNamespace, framework.WithTimeout(2*time.Minute))(t)

stopChan := make(chan struct{})
defer close(stopChan)
if err := wait.PollUntilContextTimeout(context.Background(), 5*time.Second, 5*time.Minute, true, func(ctx context.Context) (bool, error) {
err := f.StartServicePortForward("alerting-alertmanager", e2eTestNamespace, "9093", stopChan)
err := f.StartServicePortForward("alerting-receive-alertmanager", e2eTestNamespace, "9093", stopChan)
return err == nil, nil
}); err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 6d91f2e

Please sign in to comment.