From 0fb7542249d7c652f9b9e1cfbf60a76929ec9802 Mon Sep 17 00:00:00 2001 From: Shane Date: Wed, 20 Nov 2024 22:57:05 +0800 Subject: [PATCH] revise one case Signed-off-by: Shane --- apis/keda/v1alpha1/scaledobject_webhook_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apis/keda/v1alpha1/scaledobject_webhook_test.go b/apis/keda/v1alpha1/scaledobject_webhook_test.go index 95743c26668..75edace5250 100644 --- a/apis/keda/v1alpha1/scaledobject_webhook_test.go +++ b/apis/keda/v1alpha1/scaledobject_webhook_test.go @@ -59,6 +59,7 @@ var _ = It("should validate the so creation when there are other SO for other wo workload := createDeployment(namespaceName, false, false) otherWorkload := createDeployment(namespaceName, false, false) + otherWorkload.Name = "other-workload" otherWorkload.Spec.Template.Name = "other-workload" so1 := createScaledObject(soName, namespaceName, workloadName, "apps/v1", "Deployment", false, map[string]string{}, "") @@ -556,22 +557,18 @@ var _ = It("shouldn't validate the so creation with cpu and memory when stateful }).Should(HaveOccurred()) }) -var _ = It("should validate the so creation without cpu and memory when custom resources", func() { +var _ = It("shouldn't validate the so creation without cpu and memory when custom resources without real StatefulSet", func() { namespaceName := "crd-not-resources" namespace := createNamespace(namespaceName) - workload := createStatefulSet(namespaceName, false, true) so := createScaledObject(soName, namespaceName, workloadName, "custom-api", "StatefulSet", true, map[string]string{}, "") err := k8sClient.Create(context.Background(), namespace) Expect(err).ToNot(HaveOccurred()) - err = k8sClient.Create(context.Background(), workload) - Expect(err).ToNot(HaveOccurred()) - Eventually(func() error { return k8sClient.Create(context.Background(), so) - }).ShouldNot(HaveOccurred()) + }).Should(HaveOccurred()) }) var _ = It("should validate so creation when all requirements are met for scaling to zero with cpu scaler", func() {