Skip to content

Commit 764739a

Browse files
committed
fix collecting list of namespaces, disable topic finalizers, fix tiered storage for rbac
Signed-off-by: Lukas Kral <[email protected]>
1 parent 1fe424e commit 764739a

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

systemtest/src/main/java/io/strimzi/systemtest/logs/TestLogCollector.java

+8-12
Original file line numberDiff line numberDiff line change
@@ -276,18 +276,14 @@ public void collectLogs(String testClass, String testCase) {
276276
}
277277

278278
private List<String> getListOfNamespaces(String testClass, String testCase) {
279-
List<String> namespaces = new ArrayList<>();
280-
281-
namespaces.addAll(
282-
KubeResourceManager.get().kubeClient().getClient()
283-
.namespaces()
284-
.withLabelSelector(getTestClassLabelSelector(testClass))
285-
.list()
286-
.getItems()
287-
.stream()
288-
.map(namespace -> namespace.getMetadata().getName())
289-
.toList()
290-
);
279+
List<String> namespaces = new ArrayList<>(KubeResourceManager.get().kubeClient().getClient()
280+
.namespaces()
281+
.withLabelSelector(getTestClassLabelSelector(testClass))
282+
.list()
283+
.getItems()
284+
.stream()
285+
.map(namespace -> namespace.getMetadata().getName())
286+
.toList());
291287

292288
if (testCase != null) {
293289
namespaces.addAll(

systemtest/src/main/java/io/strimzi/systemtest/resources/NamespaceManager.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.HashSet;
2525
import java.util.List;
2626
import java.util.Map;
27+
import java.util.Optional;
2728
import java.util.Set;
2829

2930
import static io.strimzi.test.k8s.KubeClusterResource.kubeClient;
@@ -335,14 +336,11 @@ public static void labelNamespace(String namespaceName, Map<String, String> labe
335336
*/
336337
public List<String> getListOfNamespacesForTestClassAndTestCase(String testClass, String testCase) {
337338
List<String> namespaces = new ArrayList<>();
338-
namespaces.addAll(getMapWithSuiteNamespaces().get(new CollectorElement(testClass)));
339339

340-
if (testCase != null) {
341-
Set<String> namespacesForTestCase = getMapWithSuiteNamespaces().get(new CollectorElement(testClass, testCase));
340+
Optional.ofNullable(getMapWithSuiteNamespaces().get(new CollectorElement(testClass))).ifPresent(namespaces::addAll);
342341

343-
if (namespacesForTestCase != null) {
344-
namespaces.addAll(getMapWithSuiteNamespaces().get(new CollectorElement(testClass, testCase)));
345-
}
342+
if (testCase != null) {
343+
Optional.ofNullable(getMapWithSuiteNamespaces().get(new CollectorElement(testClass, testCase))).ifPresent(namespaces::addAll);
346344
}
347345

348346
return namespaces;

systemtest/src/main/java/io/strimzi/systemtest/templates/crd/KafkaTemplates.java

+10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import io.fabric8.kubernetes.api.model.ResourceRequirementsBuilder;
1313
import io.strimzi.api.kafka.model.common.metrics.JmxPrometheusExporterMetrics;
1414
import io.strimzi.api.kafka.model.common.metrics.JmxPrometheusExporterMetricsBuilder;
15+
import io.strimzi.api.kafka.model.common.template.ContainerEnvVarBuilder;
1516
import io.strimzi.api.kafka.model.kafka.KafkaBuilder;
1617
import io.strimzi.api.kafka.model.kafka.listener.GenericKafkaListenerBuilder;
1718
import io.strimzi.api.kafka.model.kafka.listener.KafkaListenerType;
@@ -215,6 +216,15 @@ private static void setDefaultLogging(KafkaBuilder kafkaBuilder) {
215216
.addToLoggers("rootLogger.level", "DEBUG")
216217
.endInlineLogging()
217218
.endTopicOperator()
219+
.editOrNewTemplate()
220+
.editOrNewTopicOperatorContainer()
221+
.addToEnv(new ContainerEnvVarBuilder()
222+
.withName("STRIMZI_USE_FINALIZERS")
223+
.withValue("false")
224+
.build()
225+
)
226+
.endTopicOperatorContainer()
227+
.endTemplate()
218228
.endEntityOperator()
219229
.endSpec();
220230
}

systemtest/src/test/java/io/strimzi/systemtest/kafka/TieredStorageST.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import io.strimzi.systemtest.docs.TestDocsLabels;
2020
import io.strimzi.systemtest.kafkaclients.internalClients.KafkaClients;
2121
import io.strimzi.systemtest.kafkaclients.internalClients.admin.AdminClient;
22-
import io.strimzi.systemtest.resources.NamespaceManager;
2322
import io.strimzi.systemtest.resources.ResourceManager;
2423
import io.strimzi.systemtest.resources.crd.KafkaTopicResource;
2524
import io.strimzi.systemtest.resources.imageBuild.ImageBuild;
@@ -196,17 +195,17 @@ void setup() throws IOException {
196195
// we skip test case for kind + podman
197196
assumeFalse(cluster.isKind() && ContainerRuntimeUtils.getRuntime().equals(TestConstants.PODMAN));
198197

198+
// for RBAC, we are creating everything in co-namespace
199+
// in order to not delete the Namespace (as in the install() method) we need to install CO first and then
200+
// do everything else.
201+
setupClusterOperator
202+
.withDefaultConfiguration()
203+
.install();
204+
199205
suiteStorage = new TestStorage(ResourceManager.getTestContext());
200206

201-
NamespaceManager.getInstance().createNamespaceAndPrepare(suiteStorage.getNamespaceName());
202-
cluster.setNamespace(suiteStorage.getNamespaceName());
203-
204207
ImageBuild.buildImage(suiteStorage.getNamespaceName(), IMAGE_NAME, TIERED_STORAGE_DOCKERFILE, BUILT_IMAGE_TAG, Environment.KAFKA_TIERED_STORAGE_BASE_IMAGE);
205208
SetupMinio.deployMinio(suiteStorage.getNamespaceName());
206209
SetupMinio.createBucket(suiteStorage.getNamespaceName(), BUCKET_NAME);
207-
208-
setupClusterOperator
209-
.withDefaultConfiguration()
210-
.install();
211210
}
212211
}

0 commit comments

Comments
 (0)