Skip to content

Commit

Permalink
Reduce wait times and only add JAVA_OPTS_APPEND to the list of env va…
Browse files Browse the repository at this point in the history
…rs if it has a value
  • Loading branch information
EricWittmann committed Feb 13, 2025
1 parent 3ba8133 commit 0c72719
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ protected Deployment desired(ApicurioRegistry3 primary, Context<ApicurioRegistry
});

// Set the JAVA_OPTS_APPEND env var that may have been built up
envVars.put(EnvironmentVariables.JAVA_OPTS_APPEND, javaOptsAppend.toEnvVar());
if (!javaOptsAppend.isEmpty()) {
envVars.put(EnvironmentVariables.JAVA_OPTS_APPEND, javaOptsAppend.toEnvVar());
}

// Set the ENV VARs on the deployment's container spec.
var container = getContainerFromDeployment(deployment, REGISTRY_APP_CONTAINER_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,46 +118,46 @@ public void beforeEach(TestInfo testInfo) {
}

protected static void checkDeploymentExists(ApicurioRegistry3 primary, String component, int replicas) {
await().ignoreExceptions().untilAsserted(() -> {
await().atMost(Duration.ofSeconds(30)).ignoreExceptions().untilAsserted(() -> {
assertThat(client.apps().deployments()
.withName(primary.getMetadata().getName() + "-" + component + "-deployment").get()
.getStatus().getReadyReplicas()).isEqualTo(replicas);
});
}

protected static void checkDeploymentDoesNotExist(ApicurioRegistry3 primary, String component) {
await().ignoreExceptions().untilAsserted(() -> {
await().atMost(Duration.ofSeconds(30)).ignoreExceptions().untilAsserted(() -> {
assertThat(client.apps().deployments()
.withName(primary.getMetadata().getName() + "-" + component + "-deployment").get())
.isNull();
});
}

protected static void checkServiceExists(ApicurioRegistry3 primary, String component) {
await().ignoreExceptions().untilAsserted(() -> {
await().atMost(Duration.ofSeconds(30)).ignoreExceptions().untilAsserted(() -> {
assertThat(client.services()
.withName(primary.getMetadata().getName() + "-" + component + "-service").get())
.isNotNull();
});
}

protected static void checkServiceDoesNotExist(ApicurioRegistry3 primary, String component) {
await().ignoreExceptions().untilAsserted(() -> {
await().atMost(Duration.ofSeconds(30)).ignoreExceptions().untilAsserted(() -> {
assertThat(client.services()
.withName(primary.getMetadata().getName() + "-" + component + "-service").get()).isNull();
});
}

protected static void checkIngressExists(ApicurioRegistry3 primary, String component) {
await().ignoreExceptions().untilAsserted(() -> {
await().atMost(Duration.ofSeconds(30)).ignoreExceptions().untilAsserted(() -> {
assertThat(client.network().v1().ingresses()
.withName(primary.getMetadata().getName() + "-" + component + "-ingress").get())
.isNotNull();
});
}

protected static void checkIngressDoesNotExist(ApicurioRegistry3 primary, String component) {
await().ignoreExceptions().untilAsserted(() -> {
await().atMost(Duration.ofSeconds(30)).ignoreExceptions().untilAsserted(() -> {
assertThat(client.network().v1().ingresses()
.withName(primary.getMetadata().getName() + "-" + component + "-ingress").get()).isNull();
});
Expand All @@ -167,7 +167,7 @@ protected static PodDisruptionBudget checkPodDisruptionBudgetExists(ApicurioRegi
String component) {
final ValueOrNull<PodDisruptionBudget> rval = new ValueOrNull<>();

await().ignoreExceptions().untilAsserted(() -> {
await().atMost(Duration.ofSeconds(30)).ignoreExceptions().untilAsserted(() -> {
PodDisruptionBudget pdb = client.policy().v1().podDisruptionBudget()
.withName(primary.getMetadata().getName() + "-" + component + "-poddisruptionbudget")
.get();
Expand All @@ -181,7 +181,7 @@ protected static PodDisruptionBudget checkPodDisruptionBudgetExists(ApicurioRegi
protected static NetworkPolicy checkNetworkPolicyExists(ApicurioRegistry3 primary, String component) {
final ValueOrNull<NetworkPolicy> rval = new ValueOrNull<>();

await().ignoreExceptions().untilAsserted(() -> {
await().atMost(Duration.ofSeconds(30)).ignoreExceptions().untilAsserted(() -> {
NetworkPolicy networkPolicy = client.network().v1().networkPolicies()
.withName(primary.getMetadata().getName() + "-" + component + "-networkpolicy").get();
assertThat(networkPolicy).isNotNull();
Expand Down Expand Up @@ -220,7 +220,7 @@ private static void createTestResources() throws Exception {

private static void startOperatorLogs() {
List<Pod> operatorPods = new ArrayList<>();
await().ignoreExceptions().untilAsserted(() -> {
await().atMost(Duration.ofSeconds(30)).ignoreExceptions().untilAsserted(() -> {
operatorPods.clear();
operatorPods.addAll(client.pods()
.withLabels(Map.of(
Expand Down

0 comments on commit 0c72719

Please sign in to comment.