Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ST] Use real test execution instead of milis from epoch in collecting logs from CO #9628

Merged
merged 6 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public boolean matches(Object actualValue) {
if (lineLowerCase.contains("error") || lineLowerCase.contains("exception")) {
boolean ignoreListResult = false;
for (LogIgnoreList value : LogIgnoreList.values()) {
Matcher m = Pattern.compile(value.name).matcher(line);
Matcher m = Pattern.compile(value.name, Pattern.MULTILINE | Pattern.DOTALL).matcher(line);
if (m.find()) {
ignoreListResult = true;
break;
Expand Down Expand Up @@ -85,7 +85,19 @@ enum LogIgnoreList {
// connected to https://github.com/strimzi/strimzi-kafka-operator/issues/7529 - remove this once the issue will be fixed
RECONCILIATION_PODSET_ALREADY_EXISTS("ERROR StrimziPodSetController:[0-9]+ - Reconciliation.*[fF]ailed"
+ "(?s)(.*?)"
+ "io.fabric8.kubernetes.client.KubernetesClientException.*already exists");
+ "io.fabric8.kubernetes.client.KubernetesClientException.*already exists"),
REBALANCE_APPLY("KafkaRebalanceAssemblyOperator:.*Reconciliation.*KafkaRebalance.*: " +
"Status updated to \\[NotReady\\] due to error: io.netty.channel.AbstractChannel\\$AnnotatedConnectException: " +
"Connection refused.*"),
LEASE_LOCK_EXISTS("LeaderElector:.*Exception occurred while acquiring lock 'LeaseLock.*" +
"KubernetesClientException: Failure executing: POST at.*already exists.*"),
ZOOKEEPER_DNS_ERROR("Unable to resolve address:.*zookeeper.*java.net.UnknownHostException.*"),
LOGGER_DOES_NOT_EXISTS("Logger paprika does not exist"),
// This exception is logged on DEBUG level of the operator, however it is hit when logging is to JSON format where it is hard whitelist without this
ZOOKEEPER_END_OF_STREAM("org.apache.zookeeper.ClientCnxn$EndOfStreamException"),
// This is expected failure in some cases, so we can whitelist it
REBALANCE_NON_JBOD("Status updated to [NotReady] due to error: Cannot set rebalanceDisk=true for Kafka clusters with a non-JBOD storage config");


final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.strimzi.systemtest.utils.kafkaUtils.KafkaUserUtils;
import org.junit.jupiter.api.extension.ExtensionContext;

import java.time.Duration;
import java.util.Random;

import static io.strimzi.operator.common.Util.hashStub;
Expand Down Expand Up @@ -255,6 +256,10 @@ public long getTestExecutionStartTime() {
return (long) extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).get(TestConstants.TEST_EXECUTION_START_TIME_KEY);
}

public long getTestExecutionTimeInSeconds() {
return Duration.ofMillis(System.currentTimeMillis() - getTestExecutionStartTime()).getSeconds();
}

public KafkaTracingClients getTracingClients() {
return (KafkaTracingClients) extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).get(TestConstants.KAFKA_TRACING_CLIENT_KEY);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ void tearDownTestCase(ExtensionContext extensionContext) throws Exception {
// does not proceed with the next method (i.e., afterEachMustExecute()). This ensures that if such problem happen
// it will always execute the second method.
try {
assertNoCoErrorsLogged(clusterOperator.getDeploymentNamespace(), storageMap.get(extensionContext).getTestExecutionStartTime());
assertNoCoErrorsLogged(clusterOperator.getDeploymentNamespace(), storageMap.get(extensionContext).getTestExecutionTimeInSeconds());
afterEachMayOverride(extensionContext);
} finally {
afterEachMustExecute(extensionContext);
Expand Down