From c017a92faf9f4bc75abbb15620c87712111741b6 Mon Sep 17 00:00:00 2001 From: Shane Date: Sun, 8 Dec 2024 20:20:14 +0800 Subject: [PATCH] revise cloudevent test Signed-off-by: Shane --- .../cloudevent_source/cloudevent_source_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/internals/cloudevent_source/cloudevent_source_test.go b/tests/internals/cloudevent_source/cloudevent_source_test.go index b1001c7c1e3..aa1b87aa440 100644 --- a/tests/internals/cloudevent_source/cloudevent_source_test.go +++ b/tests/internals/cloudevent_source/cloudevent_source_test.go @@ -13,8 +13,6 @@ import ( "github.com/joho/godotenv" "github.com/stretchr/testify/assert" "k8s.io/client-go/kubernetes" - - . "github.com/kedacore/keda/v2/tests/helper" ) const ( @@ -116,7 +114,7 @@ metadata: namespace: {{.TestNamespace}} spec: scaleTargetRef: - name: test + name: {{.DeploymentName}} triggers: - type: kubernetes-workload metadata: @@ -379,6 +377,7 @@ func testErrEventSourceEmitValue(t *testing.T, _ *kubernetes.Clientset, data tem t.Log("--- test emitting eventsource about scaledobject err---") KubectlApplyWithTemplate(t, data, "cloudEventSourceTemplate", ceTemplate) + KubectlApplyWithTemplate(t, data, "deploymentTemplate", deploymentTemplate) KubectlApplyWithTemplate(t, data, "scaledObjectErrTemplate", scaledObjectErrTemplate) // wait 15 seconds to ensure event propagation @@ -430,8 +429,8 @@ func testErrEventSourceEmitValue(t *testing.T, _ *kubernetes.Clientset, data tem func testEventSourceEmitValue(t *testing.T, _ *kubernetes.Clientset, data templateData) { t.Log("--- test emitting eventsource about scaledobject removed---") - KubectlApplyWithTemplate(t, data, "scaledObjectTemplate", scaledObjectTemplate) KubectlApplyWithTemplate(t, data, "deploymentTemplate", deploymentTemplate) + KubectlApplyWithTemplate(t, data, "scaledObjectTemplate", scaledObjectTemplate) // wait 15 seconds to ensure event propagation time.Sleep(5 * time.Second) @@ -483,6 +482,7 @@ func testErrEventSourceExcludeValue(t *testing.T, _ *kubernetes.Clientset, data } KubectlApplyWithTemplate(t, data, "cloudEventSourceWithExcludeTemplate", ceTemplate) + KubectlApplyWithTemplate(t, data, "deploymentTemplate", deploymentTemplate) KubectlApplyWithTemplate(t, data, "scaledObjectErrTemplate", scaledObjectErrTemplate) // wait 15 seconds to ensure event propagation @@ -524,6 +524,7 @@ func testErrEventSourceIncludeValue(t *testing.T, _ *kubernetes.Clientset, data } KubectlApplyWithTemplate(t, data, "cloudEventSourceWithIncludeTemplate", ceTemplate) + KubectlApplyWithTemplate(t, data, "deploymentTemplate", deploymentTemplate) KubectlApplyWithTemplate(t, data, "scaledObjectErrTemplate", scaledObjectErrTemplate) // wait 15 seconds to ensure event propagation