From 4240295af93924134c54268cc2b96ff6b9c9ebc0 Mon Sep 17 00:00:00 2001 From: Tomas Kyjovsky Date: Tue, 28 Nov 2017 17:35:13 +0100 Subject: [PATCH] KEYCLOAK-5922 Cluster tests don't work with non-undertow server --- .../wildfly-balancer/src/main/xslt/mod_cluster.xsl | 2 +- .../arquillian/AuthServerTestEnricher.java | 13 +++++++------ .../keycloak/testsuite/arquillian/SuiteContext.java | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/testsuite/integration-arquillian/servers/wildfly-balancer/src/main/xslt/mod_cluster.xsl b/testsuite/integration-arquillian/servers/wildfly-balancer/src/main/xslt/mod_cluster.xsl index f1be82ac11..1e0dc89557 100644 --- a/testsuite/integration-arquillian/servers/wildfly-balancer/src/main/xslt/mod_cluster.xsl +++ b/testsuite/integration-arquillian/servers/wildfly-balancer/src/main/xslt/mod_cluster.xsl @@ -67,7 +67,7 @@ - + diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java index d2092ffe02..e08a44da9e 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java @@ -216,12 +216,13 @@ public class AuthServerTestEnricher { suiteContext.setAuthServerInfo(container); containers.stream() - .filter(c -> c.getQualifier().startsWith(AUTH_SERVER_BACKEND)) - .forEach(c -> { - String portOffsetString = c.getArquillianContainer().getContainerConfiguration().getContainerProperties().getOrDefault("bindHttpPortOffset", "0"); - updateWithAuthServerInfo(c, Integer.valueOf(portOffsetString)); - suiteContext.addAuthServerBackendsInfo(0, c); - }); + .filter(c -> c.getQualifier().startsWith(AUTH_SERVER_BACKEND)) + .sorted((a, b) -> a.getQualifier().compareTo(b.getQualifier())) // ordering is expected by the cluster tests + .forEach(c -> { + int portOffset = Integer.parseInt(c.getQualifier().substring(AUTH_SERVER_BACKEND.length())); + updateWithAuthServerInfo(c, portOffset); + suiteContext.addAuthServerBackendsInfo(0, c); + }); if (suiteContext.getAuthServerBackendsInfo().isEmpty()) { throw new RuntimeException(String.format("No auth server container matching '%s' found in arquillian.xml.", AUTH_SERVER_BACKEND)); diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/SuiteContext.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/SuiteContext.java index bc4b09c84a..a8479a282c 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/SuiteContext.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/SuiteContext.java @@ -180,10 +180,10 @@ public final class SuiteContext { } } else if (isAuthServerCluster()) { sb.append(isAuthServerCluster() ? "\nFrontend: " : "") - .append(getAuthServerInfo().getQualifier()) + .append(getAuthServerInfo().getQualifier()).append(" - ").append(getAuthServerInfo().getContextRoot().toExternalForm()) .append("\n"); - getAuthServerBackendsInfo().forEach(bInfo -> sb.append(" Backend: ").append(bInfo).append("\n")); + getAuthServerBackendsInfo().forEach(bInfo -> sb.append(" Backend: ").append(bInfo).append(" - ").append(bInfo.getContextRoot().toExternalForm()).append("\n")); } else { sb.append(getAuthServerInfo().getQualifier()) .append("\n");