Skip to content

Commit

Permalink
Wait for Route53 failover lambda execution in eventually block (#877)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Emerson <[email protected]>
  • Loading branch information
ryanemerson committed Jul 2, 2024
1 parent ad872a5 commit 8c9b44c
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.junit.jupiter.api.Test;
import org.keycloak.benchmark.crossdc.client.AWSClient;
import org.keycloak.benchmark.crossdc.client.DatacenterInfo;
import org.keycloak.benchmark.crossdc.client.PrometheusClient;
import org.keycloak.benchmark.crossdc.junit.tags.ActiveActive;
import org.keycloak.benchmark.crossdc.junit.tags.ActivePassive;
import org.keycloak.benchmark.crossdc.util.K8sUtils;
Expand Down Expand Up @@ -73,10 +72,16 @@ public void logoutUserWithFailoverTest() throws IOException, URISyntaxException,
// in the following tests, therefore we will wait for the health check to be in ALARM state before proceeding
String healthCheckId = AWSClient.getHealthCheckId(DC_1.getKeycloakServerURL().substring("https://".length()));
AWSClient.waitForTheHealthCheckToBeInState(healthCheckId, StateValue.ALARM);
String route53HealthCheckPath = AWSClient.getRoute53HealthCheckPath(healthCheckId);

// Check the failover lambda was executed and the health check path was updated to a non-existing url
assertTrue(route53HealthCheckPath.endsWith("/lb-check-failed-over"), "Health check path was supposed to end with /lb-check-failed-over but was " + route53HealthCheckPath);
ByRef<String> route53HealthCheckPath = new ByRef<>("");
eventually(
() -> String.format("Health check path was supposed to end with /lb-check-failed-over but was '%s'", route53HealthCheckPath.get()),
() -> {
route53HealthCheckPath.set(AWSClient.getRoute53HealthCheckPath(healthCheckId));
return route53HealthCheckPath.get().endsWith("/lb-check-failed-over");
}
);
DC_2.kc().waitToBeActive(LOAD_BALANCER_KEYCLOAK);

// Verify if the user session UUID in code, we fetched from Keycloak exists in session cache key of external ISPN in DC2
Expand Down

0 comments on commit 8c9b44c

Please sign in to comment.