From e301b691788c121acea6332ee8449cf4a05e07e5 Mon Sep 17 00:00:00 2001 From: Derek Wang Date: Mon, 25 Jul 2022 16:00:14 -0700 Subject: [PATCH] fix: flaky e2e test cases (#2102) * fix: flaky e2e test cases Signed-off-by: Derek Wang --- test/e2e/fixtures/then.go | 10 + test/e2e/functional_test.go | 260 ++++++++---------- test/e2e/testdata/es-durable-consumer.yaml | 8 +- test/e2e/testdata/es-multi-dep.yaml | 8 +- test/e2e/testdata/es-multi-sensor.yaml | 8 +- .../e2e/testdata/sensor-durable-consumer.yaml | 1 - test/e2e/testdata/sensor-log-ha.yaml | 2 - test/e2e/testdata/sensor-multi-dep.yaml | 1 - test/e2e/testdata/sensor-multi-sensor-2.yaml | 1 - test/e2e/testdata/sensor-multi-sensor.yaml | 1 - .../sensor-trigger-spec-change-2.yaml | 1 - .../testdata/sensor-trigger-spec-change.yaml | 1 - test/util/util.go | 20 ++ 13 files changed, 159 insertions(+), 163 deletions(-) diff --git a/test/e2e/fixtures/then.go b/test/e2e/fixtures/then.go index 59e0221e3e..8a03a6fb2e 100644 --- a/test/e2e/fixtures/then.go +++ b/test/e2e/fixtures/then.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "testing" + "time" apierr "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -42,6 +43,15 @@ func (t *Then) ExpectEventBusDeleted() *Then { return t } +func (t *Then) ExpectNoSensorPodFound() *Then { + ctx := context.Background() + labelSelector := fmt.Sprintf("controller=sensor-controller,sensor-name=%s", t.sensor.Name) + if err := testutil.WaitForNoPodFound(ctx, t.kubeClient, Namespace, labelSelector, 20*time.Second); err != nil { + t.t.Fatalf("expected no sensor pod found: %v", err) + } + return t +} + // look for regex match in Sensor pod's log // if countOpt != nil, look for specific count of regex match; else look for at least one instance func (t *Then) ExpectEventSourcePodLogContains(regex string, options ...testutil.PodLogCheckOption) *Then { diff --git a/test/e2e/functional_test.go b/test/e2e/functional_test.go index 567934f33a..249aa139d4 100644 --- a/test/e2e/functional_test.go +++ b/test/e2e/functional_test.go @@ -90,21 +90,22 @@ func (s *FunctionalSuite) TestCreateCalendarEventSourceWithHA() { } func (s *FunctionalSuite) TestMetricsWithCalendar() { - t1 := s.Given().EventSource("@testdata/es-calendar-metrics.yaml"). + w1 := s.Given().EventSource("@testdata/es-calendar-metrics.yaml"). When(). CreateEventSource(). - WaitForEventSourceReady(). - Then(). - ExpectEventSourcePodLogContains(LogEventSourceStarted). - EventSourcePodPortForward(7777, 7777) + WaitForEventSourceReady() - defer t1.TerminateAllPodPortForwards() - defer t1.When().DeleteEventSource() + defer w1.DeleteEventSource() - t1.ExpectEventSourcePodLogContains(LogPublishEventSuccessful) + w1.Then(). + ExpectEventSourcePodLogContains(LogEventSourceStarted) + + defer w1.Then().EventSourcePodPortForward(17777, 7777).TerminateAllPodPortForwards() + + w1.Then().ExpectEventSourcePodLogContains(LogPublishEventSuccessful) // EventSource POD metrics - s.e("http://localhost:7777").GET("/metrics"). + s.e("http://localhost:17777").GET("/metrics"). Expect(). Status(200). Body(). @@ -112,21 +113,20 @@ func (s *FunctionalSuite) TestMetricsWithCalendar() { Contains("argo_events_events_sent_total"). Contains("argo_events_event_processing_duration_milliseconds") - t2 := s.Given().Sensor("@testdata/sensor-log-metrics.yaml"). + w2 := s.Given().Sensor("@testdata/sensor-log-metrics.yaml"). When(). CreateSensor(). - WaitForSensorReady(). - Then(). - ExpectSensorPodLogContains(LogSensorStarted). - SensorPodPortForward(7778, 7777) + WaitForSensorReady() + defer w2.DeleteSensor() - defer t2.TerminateAllPodPortForwards() - defer t2.When().DeleteSensor() + w2.Then(). + ExpectSensorPodLogContains(LogSensorStarted) + defer w2.Then().SensorPodPortForward(17778, 7777).TerminateAllPodPortForwards() - t2.ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger")) + w2.Then().ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger")) // Sensor POD metrics - s.e("http://localhost:7778").GET("/metrics"). + s.e("http://localhost:17778").GET("/metrics"). Expect(). Status(200). Body(). @@ -135,44 +135,45 @@ func (s *FunctionalSuite) TestMetricsWithCalendar() { } func (s *FunctionalSuite) TestMetricsWithWebhook() { - t1 := s.Given().EventSource("@testdata/es-test-metrics-webhook.yaml"). + w1 := s.Given().EventSource("@testdata/es-test-metrics-webhook.yaml"). When(). CreateEventSource(). - WaitForEventSourceReady(). - Then(). - ExpectEventSourcePodLogContains(LogEventSourceStarted). - EventSourcePodPortForward(12000, 12000). - EventSourcePodPortForward(7777, 7777) + WaitForEventSourceReady() - defer t1.TerminateAllPodPortForwards() - defer t1.When().DeleteEventSource() + defer w1.DeleteEventSource() - t2 := s.Given().Sensor("@testdata/sensor-test-metrics.yaml"). + w1.Then().ExpectEventSourcePodLogContains(LogEventSourceStarted) + + defer w1.Then(). + EventSourcePodPortForward(12300, 12000). + EventSourcePodPortForward(7717, 7777).TerminateAllPodPortForwards() + + w2 := s.Given().Sensor("@testdata/sensor-test-metrics.yaml"). When(). CreateSensor(). - WaitForSensorReady(). - Then(). - ExpectSensorPodLogContains(LogSensorStarted). - SensorPodPortForward(7778, 7777) + WaitForSensorReady() - defer t2.TerminateAllPodPortForwards() - defer t2.When().DeleteSensor() + defer w2.DeleteSensor() + w2.Then().ExpectSensorPodLogContains(LogSensorStarted) + + defer w2.Then(). + SensorPodPortForward(7718, 7777).TerminateAllPodPortForwards() time.Sleep(3 * time.Second) - s.e("http://localhost:12000").POST("/example").WithBytes([]byte("{}")). + s.e("http://localhost:12300").POST("/example").WithBytes([]byte("{}")). Expect(). Status(200) - t1.ExpectEventSourcePodLogContains(LogPublishEventSuccessful) + w1.Then().ExpectEventSourcePodLogContains(LogPublishEventSuccessful) // Post something invalid - s.e("http://localhost:12000").POST("/example").WithBytes([]byte("Invalid JSON")). + s.e("http://localhost:12300").POST("/example").WithBytes([]byte("Invalid JSON")). Expect(). Status(400) // EventSource POD metrics - s.e("http://localhost:7777").GET("/metrics"). + s.e("http://localhost:7717").GET("/metrics"). Expect(). Status(200). Body(). @@ -182,11 +183,11 @@ func (s *FunctionalSuite) TestMetricsWithWebhook() { Contains("argo_events_events_processing_failed_total") // Expect to see 1 success and 1 failure - t2.ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger")). + w2.Then().ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger")). ExpectSensorPodLogContains(LogTriggerActionFailed) // Sensor POD metrics - s.e("http://localhost:7778").GET("/metrics"). + s.e("http://localhost:7718").GET("/metrics"). Expect(). Status(200). Body(). @@ -223,62 +224,59 @@ func (s *FunctionalSuite) TestResourceEventSource() { func (s *FunctionalSuite) TestMultiDependencyConditions() { - t1 := s.Given().EventSource("@testdata/es-multi-dep.yaml"). + w1 := s.Given().EventSource("@testdata/es-multi-dep.yaml"). When(). CreateEventSource(). - WaitForEventSourceReady(). - Then(). - ExpectEventSourcePodLogContains(LogEventSourceStarted). - EventSourcePodPortForward(12001, 12000). - EventSourcePodPortForward(13001, 13000). - EventSourcePodPortForward(14001, 14000). - EventSourcePodPortForward(7777, 7777) + WaitForEventSourceReady() + defer w1.DeleteEventSource() - defer t1.When().DeleteEventSource() - defer t1.TerminateAllPodPortForwards() + w1.Then().ExpectEventSourcePodLogContains(LogEventSourceStarted) - t2 := s.Given().Sensor("@testdata/sensor-multi-dep.yaml"). + defer w1.Then(). + EventSourcePodPortForward(12011, 12000). + EventSourcePodPortForward(13011, 13000). + EventSourcePodPortForward(14011, 14000). + TerminateAllPodPortForwards() + + w2 := s.Given().Sensor("@testdata/sensor-multi-dep.yaml"). When(). CreateSensor(). - WaitForSensorReady(). - Then(). - ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)). - SensorPodPortForward(7778, 7777) + WaitForSensorReady() + defer w2.DeleteSensor() - defer t2.When().DeleteSensor() - defer t2.TerminateAllPodPortForwards() + w2.Then().ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)) time.Sleep(3 * time.Second) // need to verify the conditional logic is working successfully // If we trigger test-dep-1 (port 12000) we should see log-trigger-2 but not log-trigger-1 - s.e("http://localhost:12001").POST("/example").WithBytes([]byte("{}")). + s.e("http://localhost:12011").POST("/example1").WithBytes([]byte("{}")). Expect(). Status(200) - t1.ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(1)) + w1.Then().ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(1)) - t2.ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-2"), util.PodLogCheckOptionWithCount(1)). + w2.Then().ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-2"), util.PodLogCheckOptionWithCount(1)). ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(0)) // Then if we trigger test-dep-2 we should see log-trigger-2 - s.e("http://localhost:13001").POST("/example").WithBytes([]byte("{}")). + s.e("http://localhost:13011").POST("/example2").WithBytes([]byte("{}")). Expect(). Status(200) - t2.ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(1)) + w2.Then().ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(1)) // Then we trigger test-dep-2 again and shouldn't see anything - s.e("http://localhost:13001").POST("/example").WithBytes([]byte("{}")). + s.e("http://localhost:13011").POST("/example2").WithBytes([]byte("{}")). Expect(). Status(200) - t2.ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(1)) + w2.Then().ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(1)) // Finally trigger test-dep-3 and we should see log-trigger-1.. - s.e("http://localhost:14001").POST("/example").WithBytes([]byte("{}")). + s.e("http://localhost:14011").POST("/example3").WithBytes([]byte("{}")). Expect(). Status(200) - t2.ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(2)) + w2.Then().ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(2)) } // Start Pod with a multidependency condition @@ -290,62 +288,51 @@ func (s *FunctionalSuite) TestDurableConsumer() { // (because when Sensor pod restarts it sometimes takes a little while for the STAN bus to resend the message to the durable consumer) } - t1 := s.Given().EventSource("@testdata/es-durable-consumer.yaml"). + w1 := s.Given().EventSource("@testdata/es-durable-consumer.yaml"). When(). CreateEventSource(). - WaitForEventSourceReady(). - Then(). - ExpectEventSourcePodLogContains(LogEventSourceStarted). - EventSourcePodPortForward(12002, 12000). - EventSourcePodPortForward(13002, 13000). - EventSourcePodPortForward(14002, 14000). - EventSourcePodPortForward(7779, 7777) + WaitForEventSourceReady() + defer w1.DeleteEventSource() - defer t1.When().DeleteEventSource() - defer t1.TerminateAllPodPortForwards() + w1.Then().ExpectEventSourcePodLogContains(LogEventSourceStarted) + + defer w1.Then(). + EventSourcePodPortForward(12102, 12000). + EventSourcePodPortForward(13102, 13000).TerminateAllPodPortForwards() - t2 := s.Given().Sensor("@testdata/sensor-durable-consumer.yaml"). + w2 := s.Given().Sensor("@testdata/sensor-durable-consumer.yaml"). When(). CreateSensor(). - WaitForSensorReady(). - Then(). - ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)). - SensorPodPortForward(7780, 7777) + WaitForSensorReady() + + w2.Then(). + ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)) // test-dep-1 - s.e("http://localhost:12002").POST("/example").WithBytes([]byte("{}")). + s.e("http://localhost:12102").POST("/example1").WithBytes([]byte("{}")). Expect(). Status(200) - t1.ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(1)) - - t2.TerminateAllPodPortForwards() + w1.Then().ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(1)) // delete the Sensor - t2.When(). - DeleteSensor() - - time.Sleep(6 * time.Second) // need to give this time to be deleted before we create the new one + w2.DeleteSensor().Then().ExpectNoSensorPodFound() - t3 := s.Given().Sensor("@testdata/sensor-durable-consumer.yaml"). + w3 := s.Given().Sensor("@testdata/sensor-durable-consumer.yaml"). When(). CreateSensor(). - WaitForSensorReady(). - Then(). - ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)). - SensorPodPortForward(7780, 7777) + WaitForSensorReady() + defer w3.DeleteSensor() + + w3.Then(). + ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)) - defer t3.TerminateAllPodPortForwards() - defer t3.When().DeleteSensor() // test-dep-2 - s.e("http://localhost:13002").POST("/example").WithBytes([]byte("{}")). + s.e("http://localhost:13102").POST("/example2").WithBytes([]byte("{}")). Expect(). Status(200) - - time.Sleep(60 * time.Second) // takes a little while for the first dependency to get sent to our new consumer - - t1.ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(2)) - t3.ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(1)) + w1.Then().ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(2)) + w3.Then().ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(1)) } func (s *FunctionalSuite) TestMultipleSensors() { @@ -353,66 +340,59 @@ func (s *FunctionalSuite) TestMultipleSensors() { // Then send the other part of the condition and verify that only one triggers // Start EventSource - t1 := s.Given().EventSource("@testdata/es-multi-sensor.yaml"). + w1 := s.Given().EventSource("@testdata/es-multi-sensor.yaml"). When(). CreateEventSource(). - WaitForEventSourceReady(). - Then(). - ExpectEventSourcePodLogContains(LogEventSourceStarted). - EventSourcePodPortForward(12003, 12000). - EventSourcePodPortForward(13003, 13000). - EventSourcePodPortForward(14003, 14000). - EventSourcePodPortForward(7781, 7777) + WaitForEventSourceReady() + defer w1.DeleteEventSource() - defer t1.When().DeleteEventSource() - defer t1.TerminateAllPodPortForwards() + w1.Then(). + ExpectEventSourcePodLogContains(LogEventSourceStarted) + + defer w1.Then().EventSourcePodPortForward(12003, 12000). + EventSourcePodPortForward(13003, 13000). + EventSourcePodPortForward(14003, 14000).TerminateAllPodPortForwards() // Start one Sensor - t2 := s.Given().Sensor("@testdata/sensor-multi-sensor.yaml"). + w2 := s.Given().Sensor("@testdata/sensor-multi-sensor.yaml"). When(). CreateSensor(). - WaitForSensorReady(). - Then(). - ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)). - SensorPodPortForward(7782, 7777) + WaitForSensorReady() + defer w2.DeleteSensor() - defer t2.TerminateAllPodPortForwards() - defer t2.When().DeleteSensor() + w2.Then(). + ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)) time.Sleep(3 * time.Second) // Trigger first dependency // test-dep-1 - s.e("http://localhost:12003").POST("/example").WithBytes([]byte("{}")). + s.e("http://localhost:12003").POST("/example1").WithBytes([]byte("{}")). Expect(). Status(200) - t1.ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(1)) + w1.Then().ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(1)) // Start second Sensor - t3 := s.Given().Sensor("@testdata/sensor-multi-sensor-2.yaml"). + w3 := s.Given().Sensor("@testdata/sensor-multi-sensor-2.yaml"). When(). CreateSensor(). - WaitForSensorReady(). - Then(). - ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)). - SensorPodPortForward(7783, 7777) + WaitForSensorReady() + defer w3.DeleteSensor() - defer t3.TerminateAllPodPortForwards() - defer t3.When().DeleteSensor() - - time.Sleep(3 * time.Second) + w3.Then(). + ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)) // Trigger second dependency // test-dep-2 - s.e("http://localhost:13003").POST("/example").WithBytes([]byte("{}")). + s.e("http://localhost:13003").POST("/example2").WithBytes([]byte("{}")). Expect(). Status(200) - t1.ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(2)) + w1.Then().ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(2)) // Verify trigger occurs for first Sensor and not second - t2.ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1")) - t3.ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(0)) + w2.Then().ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1")) + w3.Then().ExpectSensorPodLogContains(LogTriggerActionSuccessful("log-trigger-1"), util.PodLogCheckOptionWithCount(0)) } @@ -428,8 +408,7 @@ func (s *FunctionalSuite) TestTriggerSpecChange() { ExpectEventSourcePodLogContains(LogEventSourceStarted). EventSourcePodPortForward(12004, 12000). EventSourcePodPortForward(13004, 13000). - EventSourcePodPortForward(14004, 14000). - EventSourcePodPortForward(7784, 7777) + EventSourcePodPortForward(14004, 14000) defer t1.When().DeleteEventSource() defer t1.TerminateAllPodPortForwards() @@ -441,8 +420,7 @@ func (s *FunctionalSuite) TestTriggerSpecChange() { CreateSensor(). WaitForSensorReady(). Then(). - ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)). - SensorPodPortForward(7785, 7777) + ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)) time.Sleep(3 * time.Second) @@ -454,9 +432,7 @@ func (s *FunctionalSuite) TestTriggerSpecChange() { t1.ExpectEventSourcePodLogContains(LogPublishEventSuccessful, util.PodLogCheckOptionWithCount(1)) - t2.TerminateAllPodPortForwards() - t2.When().DeleteSensor() - time.Sleep(3 * time.Second) + t2.When().DeleteSensor().Then().ExpectNoSensorPodFound() // Change Sensor's spec t2 = s.Given().Sensor("@testdata/sensor-trigger-spec-change-2.yaml"). @@ -464,10 +440,8 @@ func (s *FunctionalSuite) TestTriggerSpecChange() { CreateSensor(). WaitForSensorReady(). Then(). - ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)). - SensorPodPortForward(7786, 7777) + ExpectSensorPodLogContains(LogSensorStarted, util.PodLogCheckOptionWithCount(1)) - defer t2.TerminateAllPodPortForwards() defer t2.When().DeleteSensor() time.Sleep(3 * time.Second) diff --git a/test/e2e/testdata/es-durable-consumer.yaml b/test/e2e/testdata/es-durable-consumer.yaml index ecd9c5238f..f7a1dd877e 100644 --- a/test/e2e/testdata/es-durable-consumer.yaml +++ b/test/e2e/testdata/es-durable-consumer.yaml @@ -6,13 +6,13 @@ spec: webhook: example1: port: "12000" - endpoint: /example + endpoint: /example1 method: POST example2: port: "13000" - endpoint: /example + endpoint: /example2 method: POST example3: port: "14000" - endpoint: /example - method: POST \ No newline at end of file + endpoint: /example3 + method: POST diff --git a/test/e2e/testdata/es-multi-dep.yaml b/test/e2e/testdata/es-multi-dep.yaml index a64a884121..6256d99fbe 100644 --- a/test/e2e/testdata/es-multi-dep.yaml +++ b/test/e2e/testdata/es-multi-dep.yaml @@ -6,13 +6,13 @@ spec: webhook: example1: port: "12000" - endpoint: /example + endpoint: /example1 method: POST example2: port: "13000" - endpoint: /example + endpoint: /example2 method: POST example3: port: "14000" - endpoint: /example - method: POST \ No newline at end of file + endpoint: /example3 + method: POST diff --git a/test/e2e/testdata/es-multi-sensor.yaml b/test/e2e/testdata/es-multi-sensor.yaml index cd4ca09d4f..9b3ffdbc9c 100644 --- a/test/e2e/testdata/es-multi-sensor.yaml +++ b/test/e2e/testdata/es-multi-sensor.yaml @@ -6,13 +6,13 @@ spec: webhook: example1: port: "12000" - endpoint: /example + endpoint: /example1 method: POST example2: port: "13000" - endpoint: /example + endpoint: /example2 method: POST example3: port: "14000" - endpoint: /example - method: POST \ No newline at end of file + endpoint: /example3 + method: POST diff --git a/test/e2e/testdata/sensor-durable-consumer.yaml b/test/e2e/testdata/sensor-durable-consumer.yaml index d29c0063f1..16138237bd 100644 --- a/test/e2e/testdata/sensor-durable-consumer.yaml +++ b/test/e2e/testdata/sensor-durable-consumer.yaml @@ -5,7 +5,6 @@ metadata: spec: replicas: 1 template: - serviceAccountName: argo-events-sa container: env: - name: DEBUG_LOG diff --git a/test/e2e/testdata/sensor-log-ha.yaml b/test/e2e/testdata/sensor-log-ha.yaml index d52ee3d832..f6efabe2be 100644 --- a/test/e2e/testdata/sensor-log-ha.yaml +++ b/test/e2e/testdata/sensor-log-ha.yaml @@ -4,8 +4,6 @@ metadata: name: e2e-log-ha spec: replicas: 2 - template: - serviceAccountName: argo-events-sa dependencies: - name: test-dep eventSourceName: e2e-calendar-ha diff --git a/test/e2e/testdata/sensor-multi-dep.yaml b/test/e2e/testdata/sensor-multi-dep.yaml index 9f6fe398fe..73d50034da 100644 --- a/test/e2e/testdata/sensor-multi-dep.yaml +++ b/test/e2e/testdata/sensor-multi-dep.yaml @@ -5,7 +5,6 @@ metadata: spec: replicas: 1 template: - serviceAccountName: argo-events-sa container: env: - name: DEBUG_LOG diff --git a/test/e2e/testdata/sensor-multi-sensor-2.yaml b/test/e2e/testdata/sensor-multi-sensor-2.yaml index 7528012b2c..165baf05d3 100644 --- a/test/e2e/testdata/sensor-multi-sensor-2.yaml +++ b/test/e2e/testdata/sensor-multi-sensor-2.yaml @@ -5,7 +5,6 @@ metadata: spec: replicas: 1 template: - serviceAccountName: argo-events-sa container: env: - name: DEBUG_LOG diff --git a/test/e2e/testdata/sensor-multi-sensor.yaml b/test/e2e/testdata/sensor-multi-sensor.yaml index 0fa7ca2de0..f3b9e77615 100644 --- a/test/e2e/testdata/sensor-multi-sensor.yaml +++ b/test/e2e/testdata/sensor-multi-sensor.yaml @@ -5,7 +5,6 @@ metadata: spec: replicas: 1 template: - serviceAccountName: argo-events-sa container: env: - name: DEBUG_LOG diff --git a/test/e2e/testdata/sensor-trigger-spec-change-2.yaml b/test/e2e/testdata/sensor-trigger-spec-change-2.yaml index 736e4cf6be..f4032c052f 100644 --- a/test/e2e/testdata/sensor-trigger-spec-change-2.yaml +++ b/test/e2e/testdata/sensor-trigger-spec-change-2.yaml @@ -5,7 +5,6 @@ metadata: spec: replicas: 1 template: - serviceAccountName: argo-events-sa container: env: - name: DEBUG_LOG diff --git a/test/e2e/testdata/sensor-trigger-spec-change.yaml b/test/e2e/testdata/sensor-trigger-spec-change.yaml index c52c0a33d4..9d34202353 100644 --- a/test/e2e/testdata/sensor-trigger-spec-change.yaml +++ b/test/e2e/testdata/sensor-trigger-spec-change.yaml @@ -5,7 +5,6 @@ metadata: spec: replicas: 1 template: - serviceAccountName: argo-events-sa container: env: - name: DEBUG_LOG diff --git a/test/util/util.go b/test/util/util.go index 11b65e4f86..17f13d121a 100644 --- a/test/util/util.go +++ b/test/util/util.go @@ -415,3 +415,23 @@ func podLogContainsCount(ctx context.Context, client kubernetes.Interface, names } } } + +func WaitForNoPodFound(ctx context.Context, kubeClient kubernetes.Interface, namespace, labelSelector string, timeout time.Duration) error { + ctx, cancel := context.WithTimeout(ctx, timeout) + defer cancel() + for { + podList, err := kubeClient.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{LabelSelector: labelSelector}) + if err != nil { + return fmt.Errorf("error getting pod list: %w", err) + } + if len(podList.Items) == 0 { + return nil + } + select { + case <-ctx.Done(): + return fmt.Errorf("timeout waiting for pod disappearing") + default: + } + time.Sleep(2 * time.Second) + } +}