diff --git a/test/with_api_v1/acceptance/send_test.go b/test/with_api_v1/acceptance/send_test.go index a7adb999..a6ee0b55 100644 --- a/test/with_api_v1/acceptance/send_test.go +++ b/test/with_api_v1/acceptance/send_test.go @@ -15,7 +15,6 @@ package test import ( "fmt" - "sync" "testing" "time" @@ -272,12 +271,8 @@ receivers: func TestResolved(t *testing.T) { t.Parallel() - var wg sync.WaitGroup - wg.Add(10) - - for i := 0; i < 10; i++ { - go func() { - conf := ` + for i := 0; i < 2; i++ { + conf := ` global: resolve_timeout: 10s @@ -293,38 +288,34 @@ receivers: - url: 'http://%s' ` - at := NewAcceptanceTest(t, &AcceptanceOpts{ - Tolerance: 150 * time.Millisecond, - }) + at := NewAcceptanceTest(t, &AcceptanceOpts{ + Tolerance: 150 * time.Millisecond, + }) - co := at.Collector("webhook") - wh := NewWebhook(co) + co := at.Collector("webhook") + wh := NewWebhook(co) - am := at.Alertmanager(fmt.Sprintf(conf, wh.Address())) + am := at.Alertmanager(fmt.Sprintf(conf, wh.Address())) - am.Push(At(1), - Alert("alertname", "test", "lbl", "v1"), - Alert("alertname", "test", "lbl", "v2"), - Alert("alertname", "test", "lbl", "v3"), - ) + am.Push(At(1), + Alert("alertname", "test", "lbl", "v1"), + Alert("alertname", "test", "lbl", "v2"), + Alert("alertname", "test", "lbl", "v3"), + ) - co.Want(Between(2, 2.5), - Alert("alertname", "test", "lbl", "v1").Active(1), - Alert("alertname", "test", "lbl", "v2").Active(1), - Alert("alertname", "test", "lbl", "v3").Active(1), - ) - co.Want(Between(12, 13), - Alert("alertname", "test", "lbl", "v1").Active(1, 11), - Alert("alertname", "test", "lbl", "v2").Active(1, 11), - Alert("alertname", "test", "lbl", "v3").Active(1, 11), - ) + co.Want(Between(2, 2.5), + Alert("alertname", "test", "lbl", "v1").Active(1), + Alert("alertname", "test", "lbl", "v2").Active(1), + Alert("alertname", "test", "lbl", "v3").Active(1), + ) + co.Want(Between(12, 13), + Alert("alertname", "test", "lbl", "v1").Active(1, 11), + Alert("alertname", "test", "lbl", "v2").Active(1, 11), + Alert("alertname", "test", "lbl", "v3").Active(1, 11), + ) - at.Run() - wg.Done() - }() + at.Run() } - - wg.Wait() } func TestResolvedFilter(t *testing.T) { diff --git a/test/with_api_v2/acceptance/send_test.go b/test/with_api_v2/acceptance/send_test.go index 4b97272f..8fba1d41 100644 --- a/test/with_api_v2/acceptance/send_test.go +++ b/test/with_api_v2/acceptance/send_test.go @@ -15,7 +15,6 @@ package test import ( "fmt" - "sync" "testing" "time" @@ -272,12 +271,8 @@ receivers: func TestResolved(t *testing.T) { t.Parallel() - var wg sync.WaitGroup - wg.Add(10) - - for i := 0; i < 10; i++ { - go func() { - conf := ` + for i := 0; i < 2; i++ { + conf := ` global: resolve_timeout: 10s @@ -293,38 +288,34 @@ receivers: - url: 'http://%s' ` - at := NewAcceptanceTest(t, &AcceptanceOpts{ - Tolerance: 150 * time.Millisecond, - }) + at := NewAcceptanceTest(t, &AcceptanceOpts{ + Tolerance: 150 * time.Millisecond, + }) - co := at.Collector("webhook") - wh := NewWebhook(co) + co := at.Collector("webhook") + wh := NewWebhook(co) - am := at.Alertmanager(fmt.Sprintf(conf, wh.Address())) + am := at.Alertmanager(fmt.Sprintf(conf, wh.Address())) - am.Push(At(1), - Alert("alertname", "test", "lbl", "v1"), - Alert("alertname", "test", "lbl", "v2"), - Alert("alertname", "test", "lbl", "v3"), - ) + am.Push(At(1), + Alert("alertname", "test", "lbl", "v1"), + Alert("alertname", "test", "lbl", "v2"), + Alert("alertname", "test", "lbl", "v3"), + ) - co.Want(Between(2, 2.5), - Alert("alertname", "test", "lbl", "v1").Active(1), - Alert("alertname", "test", "lbl", "v2").Active(1), - Alert("alertname", "test", "lbl", "v3").Active(1), - ) - co.Want(Between(12, 13), - Alert("alertname", "test", "lbl", "v1").Active(1, 11), - Alert("alertname", "test", "lbl", "v2").Active(1, 11), - Alert("alertname", "test", "lbl", "v3").Active(1, 11), - ) + co.Want(Between(2, 2.5), + Alert("alertname", "test", "lbl", "v1").Active(1), + Alert("alertname", "test", "lbl", "v2").Active(1), + Alert("alertname", "test", "lbl", "v3").Active(1), + ) + co.Want(Between(12, 13), + Alert("alertname", "test", "lbl", "v1").Active(1, 11), + Alert("alertname", "test", "lbl", "v2").Active(1, 11), + Alert("alertname", "test", "lbl", "v3").Active(1, 11), + ) - at.Run() - wg.Done() - }() + at.Run() } - - wg.Wait() } func TestResolvedFilter(t *testing.T) {