Skip to content

Commit 534540b

Browse files
committed
another fixes
Signed-off-by: Lukas Kral <[email protected]>
1 parent 764739a commit 534540b

File tree

6 files changed

+28
-13
lines changed

6 files changed

+28
-13
lines changed

systemtest/src/main/java/io/strimzi/systemtest/utils/kafkaUtils/KafkaTopicUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ public static void setFinalizersInAllTopicsToNull(String namespaceName) {
333333
public static void waitForTopicStatusMessage(String namespaceName, String topicName, String message) {
334334
LOGGER.info("Waiting for KafkaTopic: {}/{} to contain message: {} in its status", namespaceName, topicName, message);
335335

336-
TestUtils.waitFor(String.join("KafkaTopic: %s/%s status to contain message: %s", namespaceName, topicName, message), TestConstants.GLOBAL_POLL_INTERVAL, TestConstants.GLOBAL_TIMEOUT,
336+
TestUtils.waitFor(String.format("KafkaTopic: %s/%s status to contain message: %s", namespaceName, topicName, message), TestConstants.GLOBAL_POLL_INTERVAL, TestConstants.GLOBAL_TIMEOUT,
337337
() -> KafkaTopicResource.kafkaTopicClient().inNamespace(namespaceName).withName(topicName).get()
338338
.getStatus().getConditions().stream().anyMatch(condition -> condition.getMessage().contains(message))
339339
);

systemtest/src/test/java/io/strimzi/systemtest/AbstractST.java

+12-7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package io.strimzi.systemtest;
66

7+
import io.fabric8.kubernetes.api.model.Namespace;
78
import io.skodjob.testframe.resources.ClusterRoleBindingType;
89
import io.skodjob.testframe.resources.ClusterRoleType;
910
import io.skodjob.testframe.resources.CustomResourceDefinitionType;
@@ -82,15 +83,19 @@ public abstract class AbstractST implements TestSeparator {
8283
);
8384

8485
KubeResourceManager.get().addCreateCallback(resource -> {
85-
Map<String, String> labels = new HashMap<>();
86-
labels.put(TestConstants.TEST_SUITE_NAME_LABEL, StUtils.removePackageName(KubeResourceManager.get().getTestContext().getRequiredTestClass().getName()));
86+
if (resource instanceof Namespace namespace) {
87+
Map<String, String> labels = new HashMap<>(namespace.getMetadata().getLabels());
88+
labels.put(TestConstants.TEST_SUITE_NAME_LABEL, StUtils.removePackageName(KubeResourceManager.get().getTestContext().getRequiredTestClass().getName()));
8789

88-
if (KubeResourceManager.get().getTestContext().getTestMethod().isPresent()) {
89-
String testCaseName = KubeResourceManager.get().getTestContext().getRequiredTestMethod().getName();
90-
labels.put(TestConstants.TEST_CASE_NAME_LABEL, testCaseName);
91-
}
90+
if (KubeResourceManager.get().getTestContext().getTestMethod().isPresent()) {
91+
String testCaseName = KubeResourceManager.get().getTestContext().getRequiredTestMethod().getName();
92+
labels.put(TestConstants.TEST_CASE_NAME_LABEL, testCaseName);
93+
}
94+
95+
namespace.getMetadata().setLabels(labels);
9296

93-
resource.getMetadata().setLabels(labels);
97+
KubeResourceManager.get().kubeClient().getClient().resource(namespace).update();
98+
}
9499
});
95100
}
96101

systemtest/src/test/java/io/strimzi/systemtest/operators/topic/TopicST.java

+5
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ void testDeleteTopicEnableFalse() {
177177
.editOrNewEntityOperator()
178178
.withNewTopicOperator()
179179
.endTopicOperator()
180+
// create new container so all the changes will be wiped
181+
.editOrNewTemplate()
182+
.withNewTopicOperatorContainer()
183+
.endTopicOperatorContainer()
184+
.endTemplate()
180185
.endEntityOperator()
181186
.endSpec()
182187
.build());

systemtest/src/test/java/io/strimzi/systemtest/operators/user/UserST.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ void testTlsExternalUser() {
348348
.endSpec()
349349
.build());
350350

351-
resourceManager.createResourceWithWait(KafkaTopicTemplates.topic(testStorage.getClusterName(), testStorage.getTopicName(), testStorage.getNamespaceName()).build());
351+
resourceManager.createResourceWithWait(KafkaTopicTemplates.topic(testStorage.getNamespaceName(), testStorage.getTopicName(), testStorage.getClusterName()).build());
352352

353353
final KafkaUser tlsExternalUserWithQuotasAndAcls = KafkaUserTemplates.tlsExternalUser(testStorage.getNamespaceName(), testStorage.getKafkaUsername(), testStorage.getClusterName())
354354
.editSpec()

systemtest/src/test/java/io/strimzi/systemtest/specific/DrainCleanerST.java

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ void setup() {
9999
setupClusterOperator
100100
.withCustomConfiguration(new ClusterOperatorConfigurationBuilder()
101101
.withNamespaceName(TestConstants.DRAIN_CLEANER_NAMESPACE)
102+
.withNamespacesToWatch(TestConstants.DRAIN_CLEANER_NAMESPACE)
102103
.withOperationTimeout(TestConstants.CO_OPERATION_TIMEOUT_DEFAULT)
103104
.build()
104105
)

systemtest/src/test/java/io/strimzi/systemtest/upgrade/AbstractKRaftUpgradeST.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import io.fabric8.kubernetes.api.model.LabelSelector;
88
import io.fabric8.kubernetes.api.model.LabelSelectorBuilder;
99
import io.fabric8.kubernetes.api.model.Pod;
10+
import io.skodjob.testframe.resources.KubeResourceManager;
11+
import io.skodjob.testframe.resources.ResourceItem;
1012
import io.strimzi.api.kafka.model.common.Constants;
1113
import io.strimzi.api.kafka.model.connect.KafkaConnect;
1214
import io.strimzi.api.kafka.model.connect.KafkaConnectBuilder;
@@ -30,6 +32,7 @@
3032
import io.strimzi.systemtest.resources.crd.KafkaConnectResource;
3133
import io.strimzi.systemtest.resources.crd.KafkaNodePoolResource;
3234
import io.strimzi.systemtest.resources.crd.KafkaResource;
35+
import io.strimzi.systemtest.resources.crd.KafkaTopicResource;
3336
import io.strimzi.systemtest.storage.TestStorage;
3437
import io.strimzi.systemtest.templates.crd.KafkaConnectTemplates;
3538
import io.strimzi.systemtest.templates.crd.KafkaConnectorTemplates;
@@ -428,9 +431,12 @@ protected void deployKafkaConnectAndKafkaConnectorWithWaitForReadiness(
428431

429432
final String imageFullPath = Environment.getImageOutputRegistry(testStorage.getNamespaceName(), TestConstants.ST_CONNECT_BUILD_IMAGE_NAME, String.valueOf(new Random().nextInt(Integer.MAX_VALUE)));
430433

434+
LOGGER.info("Deploying KafkaConnect from: {}", kafkaConnectYaml.getPath());
435+
431436
KafkaConnect kafkaConnect = new KafkaConnectBuilder(ReadWriteUtils.readObjectFromYamlFilepath(kafkaConnectYaml, KafkaConnect.class))
432437
.editMetadata()
433438
.withName(CLUSTER_NAME)
439+
.withNamespace(testStorage.getNamespaceName())
434440
.addToAnnotations(Annotations.STRIMZI_IO_USE_CONNECTOR_RESOURCES, "true")
435441
.endMetadata()
436442
.editSpec()
@@ -446,10 +452,7 @@ protected void deployKafkaConnectAndKafkaConnectorWithWaitForReadiness(
446452
.endSpec()
447453
.build();
448454

449-
LOGGER.info("Deploying KafkaConnect from: {}", kafkaConnectYaml.getPath());
450-
451-
cmdKubeClient(testStorage.getNamespaceName()).applyContent(ReadWriteUtils.writeObjectToYamlString(kafkaConnect));
452-
ResourceManager.waitForResourceReadiness(testStorage.getNamespaceName(), getResourceApiVersion(KafkaConnect.RESOURCE_PLURAL), kafkaConnect.getMetadata().getName());
455+
resourceManager.createResourceWithWait(kafkaConnect);
453456

454457
// in our examples is no sink connector and thus we are using the same as in HEAD verification
455458
resourceManager.createResourceWithWait(KafkaConnectorTemplates.kafkaConnector(testStorage.getNamespaceName(), CLUSTER_NAME)
@@ -685,6 +688,7 @@ protected void applyCustomResourcesFromPath(String namespaceName, String example
685688
kafkaTopicYaml = new File(examplesPath + "/examples/topic/kafka-topic.yaml");
686689
LOGGER.info("Deploying KafkaTopic from: {}, in Namespace {}", kafkaTopicYaml.getPath(), namespaceName);
687690
cmdKubeClient(namespaceName).applyContent(ReadWriteUtils.readFile(kafkaTopicYaml));
691+
KubeResourceManager.get().pushToStack(new ResourceItem<>(() -> KafkaTopicResource.kafkaTopicClient().inNamespace(namespaceName).withName("my-topic").delete()));
688692
}
689693

690694
private String getKafkaYamlWithName(String name) {

0 commit comments

Comments
 (0)