Skip to content

Commit

Permalink
revise cloudevent test
Browse files Browse the repository at this point in the history
Signed-off-by: Shane <[email protected]>
  • Loading branch information
ctccxxd committed Dec 8, 2024
1 parent 22b489d commit c017a92
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/internals/cloudevent_source/cloudevent_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -116,7 +114,7 @@ metadata:
namespace: {{.TestNamespace}}
spec:
scaleTargetRef:
name: test
name: {{.DeploymentName}}
triggers:
- type: kubernetes-workload
metadata:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c017a92

Please sign in to comment.