use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi by strimzi.
the class TopicST method testTopicModificationOfReplicationFactor.
@ParallelTest
void testTopicModificationOfReplicationFactor(ExtensionContext extensionContext) {
String topicName = mapWithTestTopics.get(extensionContext.getDisplayName());
resourceManager.createResource(extensionContext, KafkaTopicTemplates.topic(TOPIC_CLUSTER_NAME, topicName, namespace).editSpec().withReplicas(3).endSpec().build());
KafkaTopicResource.replaceTopicResourceInSpecificNamespace(topicName, t -> t.getSpec().setReplicas(1), namespace);
KafkaTopicUtils.waitForKafkaTopicNotReady(namespace, topicName);
String exceptedMessage = "Changing 'spec.replicas' is not supported. This KafkaTopic's 'spec.replicas' should be reverted to 3 and then the replication should be changed directly in Kafka.";
assertThat(KafkaTopicResource.kafkaTopicClient().inNamespace(namespace).withName(topicName).get().getStatus().getConditions().get(0).getMessage().contains(exceptedMessage), is(true));
String topicCRDMessage = KafkaTopicResource.kafkaTopicClient().inNamespace(namespace).withName(topicName).get().getStatus().getConditions().get(0).getMessage();
assertThat(topicCRDMessage, containsString(exceptedMessage));
cmdKubeClient(namespace).deleteByName(KafkaTopic.RESOURCE_SINGULAR, topicName);
KafkaTopicUtils.waitForKafkaTopicDeletion(namespace, topicName);
}
use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi by strimzi.
the class UserST method testUpdateUser.
@ParallelTest
@Tag(ACCEPTANCE)
void testUpdateUser(ExtensionContext extensionContext) {
String userName = mapWithTestUsers.get(extensionContext.getDisplayName());
resourceManager.createResource(extensionContext, KafkaUserTemplates.tlsUser(namespace, userClusterName, userName).build());
String kafkaUserSecret = TestUtils.toJsonString(kubeClient(namespace).getSecret(userName));
assertThat(kafkaUserSecret, hasJsonPath("$.data['ca.crt']", notNullValue()));
assertThat(kafkaUserSecret, hasJsonPath("$.data['user.crt']", notNullValue()));
assertThat(kafkaUserSecret, hasJsonPath("$.data['user.key']", notNullValue()));
assertThat(kafkaUserSecret, hasJsonPath("$.metadata.name", equalTo(userName)));
assertThat(kafkaUserSecret, hasJsonPath("$.metadata.namespace", equalTo(namespace)));
KafkaUser kUser = KafkaUserResource.kafkaUserClient().inNamespace(namespace).withName(userName).get();
String kafkaUserAsJson = TestUtils.toJsonString(kUser);
assertThat(kafkaUserAsJson, hasJsonPath("$.metadata.name", equalTo(userName)));
assertThat(kafkaUserAsJson, hasJsonPath("$.metadata.namespace", equalTo(namespace)));
assertThat(kafkaUserAsJson, hasJsonPath("$.spec.authentication.type", equalTo(Constants.TLS_LISTENER_DEFAULT_NAME)));
long observedGeneration = KafkaUserResource.kafkaUserClient().inNamespace(namespace).withName(userName).get().getStatus().getObservedGeneration();
KafkaUserResource.replaceUserResourceInSpecificNamespace(userName, ku -> {
ku.getMetadata().setResourceVersion(null);
ku.getSpec().setAuthentication(new KafkaUserScramSha512ClientAuthentication());
}, namespace);
KafkaUserUtils.waitForKafkaUserIncreaseObserverGeneration(namespace, observedGeneration, userName);
KafkaUserUtils.waitForKafkaUserCreation(namespace, userName);
String anotherKafkaUserSecret = TestUtils.toJsonString(kubeClient(namespace).getSecret(namespace, userName));
assertThat(anotherKafkaUserSecret, hasJsonPath("$.data.password", notNullValue()));
kUser = Crds.kafkaUserOperation(kubeClient().getClient()).inNamespace(namespace).withName(userName).get();
kafkaUserAsJson = TestUtils.toJsonString(kUser);
assertThat(kafkaUserAsJson, hasJsonPath("$.metadata.name", equalTo(userName)));
assertThat(kafkaUserAsJson, hasJsonPath("$.metadata.namespace", equalTo(namespace)));
assertThat(kafkaUserAsJson, hasJsonPath("$.spec.authentication.type", equalTo("scram-sha-512")));
Crds.kafkaUserOperation(kubeClient().getClient()).inNamespace(namespace).delete(kUser);
KafkaUserUtils.waitForKafkaUserDeletion(userName);
}
use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi by strimzi.
the class UserST method testUserWithNameMoreThan64Chars.
@ParallelTest
void testUserWithNameMoreThan64Chars(ExtensionContext extensionContext) {
// 65 character username
String userWithLongName = "user" + "abcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijk";
// 64 character username
String userWithCorrectName = "user-with-correct-name" + "abcdefghijklmnopqrstuvxyzabcdefghijklmnopq";
// 65 character username
String saslUserWithLongName = "sasl-user" + "abcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdef";
// Create user with correct name
resourceManager.createResource(extensionContext, KafkaUserTemplates.tlsUser(userClusterName, userWithCorrectName).editMetadata().withNamespace(namespace).endMetadata().build());
KafkaUserUtils.waitUntilKafkaUserStatusConditionIsPresent(namespace, userWithCorrectName);
Condition condition = KafkaUserResource.kafkaUserClient().inNamespace(namespace).withName(userWithCorrectName).get().getStatus().getConditions().get(0);
verifyCRStatusCondition(condition, "True", Ready);
// Create sasl user with long name, shouldn't fail
resourceManager.createResource(extensionContext, KafkaUserTemplates.scramShaUser(userClusterName, saslUserWithLongName).editMetadata().withNamespace(namespace).endMetadata().build());
resourceManager.createResource(extensionContext, false, KafkaUserTemplates.defaultUser(userClusterName, userWithLongName).editMetadata().withNamespace(namespace).endMetadata().withNewSpec().withNewKafkaUserTlsClientAuthentication().endKafkaUserTlsClientAuthentication().endSpec().build());
KafkaUserUtils.waitUntilKafkaUserStatusConditionIsPresent(namespace, userWithLongName);
condition = KafkaUserResource.kafkaUserClient().inNamespace(namespace).withName(userWithLongName).get().getStatus().getConditions().get(0);
verifyCRStatusCondition(condition, "only up to 64 characters", "InvalidResourceException", "True", NotReady);
}
use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi by strimzi.
the class UserST method testTlsUserWithQuotas.
@ParallelTest
void testTlsUserWithQuotas(ExtensionContext extensionContext) {
KafkaUser user = KafkaUserTemplates.tlsUser(namespace, userClusterName, "encrypted-arnost").build();
testUserWithQuotas(extensionContext, user);
}
use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi by strimzi.
the class LogSettingST method testBridgeLogSetting.
@ParallelTest
void testBridgeLogSetting(ExtensionContext extensionContext) {
String clusterName = mapWithClusterNames.get(extensionContext.getDisplayName());
String bridgeName = clusterName + "-bridge";
resourceManager.createResource(extensionContext, KafkaBridgeTemplates.kafkaBridge(bridgeName, LOG_SETTING_CLUSTER_NAME, KafkaResources.plainBootstrapAddress(LOG_SETTING_CLUSTER_NAME), 1).editMetadata().withNamespace(namespace).endMetadata().editSpec().withNewInlineLogging().withLoggers(BRIDGE_LOGGERS).endInlineLogging().withNewJvmOptions().withGcLoggingEnabled(true).endJvmOptions().endSpec().build());
String bridgeDepName = KafkaBridgeResources.deploymentName(bridgeName);
Map<String, String> bridgePods = DeploymentUtils.depSnapshot(namespace, bridgeDepName);
String bridgeMap = KafkaBridgeResources.metricsAndLogConfigMapName(bridgeName);
LOGGER.info("Checking if Bridge has log level set properly");
assertThat("Bridge's log level is set properly", checkLoggersLevel(namespace, BRIDGE_LOGGERS, bridgeMap), is(true));
assertThat("Bridge's GC logging is enabled", checkGcLoggingDeployments(namespace, bridgeDepName), is(true));
KafkaBridgeResource.replaceBridgeResourceInSpecificNamespace(bridgeName, bridge -> bridge.getSpec().setJvmOptions(JVM_OPTIONS), namespace);
DeploymentUtils.waitTillDepHasRolled(namespace, bridgeDepName, 1, bridgePods);
assertThat("Bridge GC logging is disabled", checkGcLoggingDeployments(namespace, bridgeDepName), is(false));
kubectlGetStrimziUntilOperationIsSuccessful(namespace, bridgeName);
checkContainersHaveProcessOneAsTini(namespace, bridgeName);
}
Aggregations