Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Commit 274bc65

Browse files
remove kafkaCluster parameter from testWebhookKafkaTopic()
1 parent 651a2c8 commit 274bc65

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/e2e/kafkatopic_webhook.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"k8s.io/utils/ptr"
2525
)
2626

27-
func testWebhookKafkaTopic(kafkaCluster types.NamespacedName) {
27+
func testWebhookKafkaTopic() {
2828
// temporary section; to be refactored after kubeconfig injection PR
2929
var kubectlOptions k8s.KubectlOptions
3030
var err error
@@ -33,7 +33,8 @@ func testWebhookKafkaTopic(kafkaCluster types.NamespacedName) {
3333
GinkgoT().Fail()
3434
}
3535

36-
kubectlOptions.Namespace = kafkaCluster.Namespace
36+
kubectlOptions.Namespace = koperatorLocalHelmDescriptor.Namespace
37+
kafkaCluster := types.NamespacedName{Name: kafkaClusterName, Namespace: koperatorLocalHelmDescriptor.Namespace}
3738

3839
testWebhookCreateKafkaTopic(kubectlOptions, kafkaCluster)
3940
testWebhookUpdateKafkaTopic(kubectlOptions, kafkaCluster)
@@ -152,7 +153,7 @@ func testWebhookCreateKafkaTopic(kubectlOptions k8s.KubectlOptions, kafkaCluster
152153
Name: kafkaCluster.Name,
153154
Namespace: kafkaCluster.Namespace,
154155
},
155-
Name: overlappingTopicName + "different-cr-name", // Note: This information is relevant to this particular test case.
156+
Name: overlappingTopicName + "-different-cr-name", // Note: This information is relevant to this particular test case.
156157
Namespace: kubectlOptions.Namespace,
157158
Partitions: ptr.To(int32(2)),
158159
ReplicationFactor: ptr.To(int32(2)),
@@ -166,10 +167,10 @@ func testWebhookCreateKafkaTopic(kubectlOptions k8s.KubectlOptions, kafkaCluster
166167
)
167168
Expect(err).To(HaveOccurred())
168169
// Example error:
169-
// 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'
170+
// 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'
170171
Expect(len(strings.Split(err.Error(), "\n"))).To(Equal(1))
171172
Expect(err.Error()).To(
172-
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'",
173+
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'",
173174
caseData.Name, overlappingTopicName, caseData.Namespace),
174175
)
175176

@@ -180,7 +181,7 @@ func testWebhookCreateKafkaTopic(kubectlOptions k8s.KubectlOptions, kafkaCluster
180181
Name: kafkaCluster.Name,
181182
Namespace: kafkaCluster.Namespace,
182183
},
183-
Name: overlappingTopicName + "different-cr-name", // Note: This information is relevant to this particular test case.
184+
Name: overlappingTopicName + "-different-cr-name", // Note: This information is relevant to this particular test case.
184185
Namespace: kubectlOptions.Namespace,
185186
Partitions: ptr.To(int32(2)),
186187
ReplicationFactor: ptr.To(int32(2)),

tests/e2e/koperator_suite_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
. "github.com/onsi/ginkgo/v2"
2525
. "github.com/onsi/gomega"
2626
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27-
"k8s.io/apimachinery/pkg/types"
2827
)
2928

3029
func TestKoperator(t *testing.T) {
@@ -60,7 +59,7 @@ var _ = When("Testing e2e test altogether", Ordered, func() {
6059
testInstall()
6160
testInstallZookeeperCluster()
6261
testInstallKafkaCluster("../../config/samples/simplekafkacluster.yaml")
63-
testWebhookKafkaTopic(types.NamespacedName{Name: kafkaClusterName, Namespace: koperatorLocalHelmDescriptor.Namespace})
62+
testWebhookKafkaTopic()
6463
testProduceConsumeInternal()
6564
testUninstallKafkaCluster()
6665
testInstallKafkaCluster("../../config/samples/simplekafkacluster_ssl.yaml")

0 commit comments

Comments
 (0)