Skip to content

Commit

Permalink
adding cluster dumps for Vault and LocalStack Kms in case they fail (k…
Browse files Browse the repository at this point in the history
…roxylicious#1538)

Signed-off-by: Francisco Vila <[email protected]>
  • Loading branch information
franvila authored Oct 1, 2024
1 parent 349be9a commit 541958d
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package io.kroxylicious.systemtests.extensions;

import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;

import org.junit.jupiter.api.extension.AfterEachCallback;
Expand All @@ -22,6 +23,9 @@

import io.kroxylicious.kms.service.TestKmsFacade;
import io.kroxylicious.kms.service.TestKmsFacadeFactory;
import io.kroxylicious.systemtests.installation.kms.aws.LocalStack;
import io.kroxylicious.systemtests.installation.kms.vault.Vault;
import io.kroxylicious.systemtests.utils.DeploymentUtils;

public class TestKubeKmsFacadeInvocationContextProvider implements TestTemplateInvocationContextProvider {

Expand Down Expand Up @@ -61,7 +65,18 @@ public List<Extension> getAdditionalExtensions() {
return kmsFacade;
}
},
(AfterEachCallback) extensionContext -> kmsFacade.stop());
(AfterEachCallback) extensionContext -> {
try {
Optional<Throwable> exception = extensionContext.getExecutionException();
exception.filter(t -> !t.getClass().getSimpleName().equals("AssumptionViolatedException")).ifPresent(e -> {
DeploymentUtils.collectClusterInfo(String.join(",", Vault.VAULT_DEFAULT_NAMESPACE, LocalStack.LOCALSTACK_DEFAULT_NAMESPACE),
extensionContext.getRequiredTestClass().getSimpleName(), extensionContext.getRequiredTestMethod().getName());
});
}
finally {
kmsFacade.stop();
}
});
}
}
}

0 comments on commit 541958d

Please sign in to comment.