From 274bc652fd25663488999e03fa1ea02f7e4b8da7 Mon Sep 17 00:00:00 2001 From: Mihai Alexandrescu Date: Thu, 31 Aug 2023 11:53:46 +0300 Subject: [PATCH] remove kafkaCluster parameter from testWebhookKafkaTopic() --- tests/e2e/kafkatopic_webhook.go | 13 +++++++------ tests/e2e/koperator_suite_test.go | 3 +-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/e2e/kafkatopic_webhook.go b/tests/e2e/kafkatopic_webhook.go index d4e880ee33..4921b97376 100644 --- a/tests/e2e/kafkatopic_webhook.go +++ b/tests/e2e/kafkatopic_webhook.go @@ -24,7 +24,7 @@ import ( "k8s.io/utils/ptr" ) -func testWebhookKafkaTopic(kafkaCluster types.NamespacedName) { +func testWebhookKafkaTopic() { // temporary section; to be refactored after kubeconfig injection PR var kubectlOptions k8s.KubectlOptions var err error @@ -33,7 +33,8 @@ func testWebhookKafkaTopic(kafkaCluster types.NamespacedName) { GinkgoT().Fail() } - kubectlOptions.Namespace = kafkaCluster.Namespace + kubectlOptions.Namespace = koperatorLocalHelmDescriptor.Namespace + kafkaCluster := types.NamespacedName{Name: kafkaClusterName, Namespace: koperatorLocalHelmDescriptor.Namespace} testWebhookCreateKafkaTopic(kubectlOptions, kafkaCluster) testWebhookUpdateKafkaTopic(kubectlOptions, kafkaCluster) @@ -152,7 +153,7 @@ func testWebhookCreateKafkaTopic(kubectlOptions k8s.KubectlOptions, kafkaCluster Name: kafkaCluster.Name, Namespace: kafkaCluster.Namespace, }, - Name: overlappingTopicName + "different-cr-name", // Note: This information is relevant to this particular test case. + Name: overlappingTopicName + "-different-cr-name", // Note: This information is relevant to this particular test case. Namespace: kubectlOptions.Namespace, Partitions: ptr.To(int32(2)), ReplicationFactor: ptr.To(int32(2)), @@ -166,10 +167,10 @@ func testWebhookCreateKafkaTopic(kubectlOptions k8s.KubectlOptions, kafkaCluster ) Expect(err).To(HaveOccurred()) // Example error: - // error while running command: exit status 1; The KafkaTopic "topic-test-internal-different-cr-name" is invalid: spec.name: Invalid value: "topic-test-internal": kafkaTopic CR 'topic-test-internal' in namesapce 'kafka' is already referencing to Kafka topic 'topic-test-internal' + // error while running command: exit status 1; The KafkaTopic "topic-test-internal-different-cr-name" is invalid: spec.name: Invalid value: "topic-test-internal": kafkaTopic CR 'topic-test-internal' in namespace 'kafka' is already referencing to Kafka topic 'topic-test-internal' Expect(len(strings.Split(err.Error(), "\n"))).To(Equal(1)) Expect(err.Error()).To( - ContainSubstring("The KafkaTopic %[1]q is invalid: spec.name: Invalid value: %[2]q: kafkaTopic CR '%[2]s' in namesapce '%[3]s' is already referencing to Kafka topic '%[2]s'", + ContainSubstring("The KafkaTopic %[1]q is invalid: spec.name: Invalid value: %[2]q: kafkaTopic CR '%[2]s' in namespace '%[3]s' is already referencing to Kafka topic '%[2]s'", caseData.Name, overlappingTopicName, caseData.Namespace), ) @@ -180,7 +181,7 @@ func testWebhookCreateKafkaTopic(kubectlOptions k8s.KubectlOptions, kafkaCluster Name: kafkaCluster.Name, Namespace: kafkaCluster.Namespace, }, - Name: overlappingTopicName + "different-cr-name", // Note: This information is relevant to this particular test case. + Name: overlappingTopicName + "-different-cr-name", // Note: This information is relevant to this particular test case. Namespace: kubectlOptions.Namespace, Partitions: ptr.To(int32(2)), ReplicationFactor: ptr.To(int32(2)), diff --git a/tests/e2e/koperator_suite_test.go b/tests/e2e/koperator_suite_test.go index 72051b0486..6d406dd54b 100644 --- a/tests/e2e/koperator_suite_test.go +++ b/tests/e2e/koperator_suite_test.go @@ -24,7 +24,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" ) func TestKoperator(t *testing.T) { @@ -60,7 +59,7 @@ var _ = When("Testing e2e test altogether", Ordered, func() { testInstall() testInstallZookeeperCluster() testInstallKafkaCluster("../../config/samples/simplekafkacluster.yaml") - testWebhookKafkaTopic(types.NamespacedName{Name: kafkaClusterName, Namespace: koperatorLocalHelmDescriptor.Namespace}) + testWebhookKafkaTopic() testProduceConsumeInternal() testUninstallKafkaCluster() testInstallKafkaCluster("../../config/samples/simplekafkacluster_ssl.yaml")