Skip to content

Commit

Permalink
remove kafkaCluster parameter from testWebhookKafkaTopic()
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaialexandrescu committed Sep 5, 2023
1 parent 651a2c8 commit 274bc65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 7 additions & 6 deletions tests/e2e/kafkatopic_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)),
Expand All @@ -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),
)

Expand All @@ -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)),
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/koperator_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 274bc65

Please sign in to comment.