From dca99359b96965df887f4cff010679cc29969b5e Mon Sep 17 00:00:00 2001 From: jmichalo Date: Thu, 12 Oct 2023 13:52:41 +0200 Subject: [PATCH] [IT-rex tests] improve docker container startup ordering + some small optimizations --- integration-test-rex/README.md | 10 ++- .../jboss/pnc/integrationrex/BuildTest.java | 26 ++++---- .../integrationrex/DependentBuildsTest.java | 25 ++++---- .../pnc/integrationrex/RemoteServices.java | 29 +++++---- .../pnc/integrationrex/WaitingBuildTest.java | 20 ++++-- .../notifications/WebSocketClientTest.java | 18 ++++-- .../setup/arquillian/AfterDeploy.java | 35 +++++++++++ .../setup/arquillian/AfterUnDeploy.java | 35 +++++++++++ .../setup/arquillian/BeforeDeploy.java | 35 +++++++++++ .../setup/arquillian/BeforeUnDeploy.java | 36 +++++++++++ .../setup/arquillian/LifecycleExtension.java | 27 ++++++++ .../setup/arquillian/LifecycleObserver.java | 63 +++++++++++++++++++ .../testcontainers/InfinispanContainer.java | 5 -- .../integrationrex/utils/ResponseUtils.java | 2 +- ...boss.arquillian.core.spi.LoadableExtension | 1 + 15 files changed, 311 insertions(+), 56 deletions(-) create mode 100644 integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/AfterDeploy.java create mode 100644 integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/AfterUnDeploy.java create mode 100644 integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/BeforeDeploy.java create mode 100644 integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/BeforeUnDeploy.java create mode 100644 integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/LifecycleExtension.java create mode 100644 integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/LifecycleObserver.java create mode 100644 integration-test-rex/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension diff --git a/integration-test-rex/README.md b/integration-test-rex/README.md index 58c801e991..bf2efdacc7 100644 --- a/integration-test-rex/README.md +++ b/integration-test-rex/README.md @@ -1,8 +1,16 @@ Setup ----- -Rex, Keycloak and BPM are services required to run the tests. +Rex (with ISPN), Keycloak and BPM are services required to run the tests. Rex and Keycloak are running in TestContainers, BPM in mocked using WireMock. +Container strict start order: +1. Keycloak (IT tests wide) [Docker] + - 1 instance per entire IT tests run +2. ISPN (per IT test class) [Docker] +3. Rex (per IT test class) [Docker] +4. ORCH EAP container (per IT test class) [Local] +5. BPM Wiremock server (per IT test class) [Local] + Process of the test build: - Orch get auth token from Keycloak (services are configured with auth and the token is passed between them) - Orch sends the build tasks to Rex diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/BuildTest.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/BuildTest.java index cbef3f3935..f7bf504ffd 100644 --- a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/BuildTest.java +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/BuildTest.java @@ -47,7 +47,9 @@ import org.jboss.pnc.restclient.websocket.WebSocketClient; import org.jboss.pnc.test.category.ContainerTest; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; @@ -88,14 +90,20 @@ public class BuildTest extends RemoteServices { private BuildUtils buildUtils; - private static final String PNC_SOCKET_URL = "ws://localhost:8080" + NOTIFICATION_PATH; - WebSocketClient wsClient = new VertxWebSocketClient(); + private static BPMWireMock bpm; - private BPMWireMock bpm; + @BeforeClass + public static void startBPM() { + bpm = new BPMWireMock(8088); + } + + @AfterClass + public static void stopBPM() throws IOException { + bpm.close(); + } @Before public void beforeEach() throws ExecutionException, InterruptedException { - bpm = new BPMWireMock(8088); String token = KeycloakClient .getAuthTokensBySecret(authServerUrl, keycloakRealm, "test-user", "test-pass", "pnc", "", false) @@ -105,14 +113,6 @@ public void beforeEach() throws ExecutionException, InterruptedException { buildConfigurationClient = new BuildConfigurationClient(withBearerToken(token)); groupConfigurationClient = new GroupConfigurationClient(withBearerToken(token)); buildUtils = new BuildUtils(buildClient, new GroupBuildClient(withBearerToken(token))); - - wsClient.connect(PNC_SOCKET_URL).get(); - } - - @After - public void afterEach() throws IOException { - bpm.close(); - wsClient.disconnect(); } @Test @@ -532,7 +532,7 @@ public BPMWireMock(int port) { .withPostServeAction( "webhook", baseBPMWebhook().withBody(BPMResultsMock.mockBuildResultSuccess()) - .withFixedDelay(500))); + .withFixedDelay(250))); wireMockServer.start(); } diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/DependentBuildsTest.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/DependentBuildsTest.java index 7794bff96d..c8cfb2d25b 100644 --- a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/DependentBuildsTest.java +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/DependentBuildsTest.java @@ -44,8 +44,10 @@ import org.jboss.pnc.restclient.websocket.WebSocketClient; import org.jboss.pnc.test.category.ContainerTest; import org.junit.After; +import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; @@ -78,13 +80,21 @@ public class DependentBuildsTest extends RemoteServices { private BuildUtils buildUtils; - private BPMWireMock bpm; + private static BPMWireMock bpm; - private static final String PNC_SOCKET_URL = "ws://localhost:8080" + NOTIFICATION_PATH; - WebSocketClient wsClient = new VertxWebSocketClient(); private BuildClient buildClient; private BuildConfigurationClient buildConfigurationClient; + @BeforeClass + public static void startBPM() { + bpm = new BPMWireMock(8088); + } + + @AfterClass + public static void stopBPM() throws IOException { + bpm.close(); + } + @Before public void beforeEach() throws ExecutionException, InterruptedException { String token = KeycloakClient @@ -95,17 +105,8 @@ public void beforeEach() throws ExecutionException, InterruptedException { groupBuildClient = new GroupBuildClient(withBearerToken(token)); buildConfigurationClient = new BuildConfigurationClient(withBearerToken(token)); - wsClient.connect(PNC_SOCKET_URL).get(); - buildClient = new BuildClient(withBearerToken(token)); buildUtils = new BuildUtils(buildClient, new GroupBuildClient(withBearerToken(token))); - bpm = new BPMWireMock(8088); - } - - @After - public void afterEach() throws IOException { - bpm.close(); - wsClient.disconnect(); } @Test diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/RemoteServices.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/RemoteServices.java index a52ce65d25..5c2083aa00 100644 --- a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/RemoteServices.java +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/RemoteServices.java @@ -20,12 +20,12 @@ import dasniko.testcontainers.keycloak.KeycloakContainer; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.pnc.integrationrex.setup.Deployments; +import org.jboss.pnc.integrationrex.setup.arquillian.AfterDeploy; +import org.jboss.pnc.integrationrex.setup.arquillian.AfterUnDeploy; +import org.jboss.pnc.integrationrex.setup.arquillian.BeforeDeploy; import org.jboss.pnc.integrationrex.testcontainers.InfinispanContainer; import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; import org.jboss.util.StringPropertyReplacer; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testcontainers.Testcontainers; @@ -73,15 +73,20 @@ public class RemoteServices { authServerUrl = keycloakContainer.getAuthServerUrl(); } + @BeforeDeploy + public static void startContainers() throws IOException { + logger.info("Starting containers ..."); + System.out.println("Starting containers"); + startRemoteServices(); + } + @Deployment(testable = false) public static EnterpriseArchive deploy() throws IOException { return Deployments.testEar(); } - @BeforeClass - public static void beforeAll() throws IOException { - logger.info("Starting containers ..."); - startRemoteServices(); + @AfterDeploy + public static void exposeHostPorts() { // 8080 IS JBOSS CONTAINER // 8088 IS BPM WIREMOCK MOCK @@ -89,18 +94,12 @@ public static void beforeAll() throws IOException { logger.info("Containers started."); } - @AfterClass - public static void afterAll() throws InterruptedException { + @AfterUnDeploy + public static void stopContainers() throws InterruptedException { logger.info("Stopping containers ..."); ispnContainer.stop(); rexContainer.stop(); logger.info("Containers stopped."); - Thread.sleep(1000L); // make sure all resources are released - } - - @Before - public void w8() throws InterruptedException { - Thread.sleep(1000L); } private static Properties initTestProperties() { diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/WaitingBuildTest.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/WaitingBuildTest.java index 4a78f84da5..cc1f366b0d 100644 --- a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/WaitingBuildTest.java +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/WaitingBuildTest.java @@ -38,7 +38,9 @@ import org.jboss.pnc.restclient.websocket.WebSocketClient; import org.jboss.pnc.test.category.ContainerTest; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; @@ -77,14 +79,23 @@ public class WaitingBuildTest extends RemoteServices { BuildUtils buildUtils; private static final String PNC_SOCKET_URL = "ws://localhost:8080" + NOTIFICATION_PATH; - WebSocketClient wsClient = new VertxWebSocketClient(); - private BPMWireMock bpm; + private final WebSocketClient wsClient = new VertxWebSocketClient(); - @Before - public void beforeEach() throws ExecutionException, InterruptedException { + private static BPMWireMock bpm; + + @BeforeClass + public static void startBPM() { bpm = new BPMWireMock(8088); + } + + @AfterClass + public static void stopBPM() throws IOException { + bpm.close(); + } + @Before + public void beforeEach() throws ExecutionException, InterruptedException { String token = KeycloakClient .getAuthTokensBySecret(authServerUrl, keycloakRealm, "test-user", "test-pass", "pnc", "", false) .getToken(); @@ -99,7 +110,6 @@ public void beforeEach() throws ExecutionException, InterruptedException { @After public void afterEach() throws IOException { - bpm.close(); wsClient.disconnect(); } diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/notifications/WebSocketClientTest.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/notifications/WebSocketClientTest.java index 4258e39531..eaec57fa54 100644 --- a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/notifications/WebSocketClientTest.java +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/notifications/WebSocketClientTest.java @@ -50,7 +50,9 @@ import org.jboss.pnc.restclient.websocket.WebSocketClient; import org.jboss.pnc.test.category.ContainerTest; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; @@ -84,11 +86,20 @@ public class WebSocketClientTest extends RemoteServices { private AdvancedBuildConfigurationClient buildConfigurationClient; private AdvancedGroupConfigurationClient groupConfigurationClient; - private BuildTest.BPMWireMock bpm; + private static BuildTest.BPMWireMock bpm; + + @BeforeClass + public static void startBPM() { + bpm = new BuildTest.BPMWireMock(8088); + } + + @AfterClass + public static void stopBPM() throws IOException { + bpm.close(); + } @Before public void beforeEach() { - bpm = new BuildTest.BPMWireMock(8088); String token = KeycloakClient .getAuthTokensBySecret(authServerUrl, keycloakRealm, "test-user", "test-pass", "pnc", "", false) .getToken(); @@ -99,7 +110,6 @@ public void beforeEach() { @After public void afterEach() throws IOException { - bpm.close(); buildConfigurationClient.close(); groupConfigurationClient.close(); } @@ -149,7 +159,7 @@ public void testBuildListener() throws Exception { buildConfigurationClient.trigger(bc.getId(), new BuildParameters()); // then - Thread.sleep(1000); + Thread.sleep(500); unsubscriber.run(); wsClient.disconnect().get(); assertThat(notificationCounter).hasValueGreaterThanOrEqualTo(1); diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/AfterDeploy.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/AfterDeploy.java new file mode 100644 index 0000000000..24b45a978c --- /dev/null +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/AfterDeploy.java @@ -0,0 +1,35 @@ +/** + * JBoss, Home of Professional Open Source. + * Copyright 2014-2022 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.pnc.integrationrex.setup.arquillian; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotate methods that you want to trigger AFTER Orch EAP container finishes starting. + * + * Useful for running initialization tasks for Orch (functionally identical to @BeforeAll in JUnit) + * + * The method must be static. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface AfterDeploy { +} diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/AfterUnDeploy.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/AfterUnDeploy.java new file mode 100644 index 0000000000..96e8df2e30 --- /dev/null +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/AfterUnDeploy.java @@ -0,0 +1,35 @@ +/** + * JBoss, Home of Professional Open Source. + * Copyright 2014-2022 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.pnc.integrationrex.setup.arquillian; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotate methods that you want to trigger AFTER Orch EAP container finishes (all tests in class are finished). + * + * Useful for stopping Orch's dependencies or cleaning of environment outside Arquillian. + * + * The method must be static. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface AfterUnDeploy { +} diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/BeforeDeploy.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/BeforeDeploy.java new file mode 100644 index 0000000000..64503b8591 --- /dev/null +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/BeforeDeploy.java @@ -0,0 +1,35 @@ +/** + * JBoss, Home of Professional Open Source. + * Copyright 2014-2022 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.pnc.integrationrex.setup.arquillian; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotate methods that you want to trigger BEFORE Arquillian starts to deploy Orch EAP. + * + * Useful for starting Orch's dependencies or preparing environment for EAP. + * + * The method must be static. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface BeforeDeploy { +} diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/BeforeUnDeploy.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/BeforeUnDeploy.java new file mode 100644 index 0000000000..0f436e0abd --- /dev/null +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/BeforeUnDeploy.java @@ -0,0 +1,36 @@ +/** + * JBoss, Home of Professional Open Source. + * Copyright 2014-2022 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.pnc.integrationrex.setup.arquillian; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotate methods that you want to trigger just BEFORE Orch EAP container is undeployed (all tests in class are + * finished). + * + * Useful for running cleaning tasks for Orch before container stops (functionally identical to @AfterAll in JUnit) + * + * The method must be static. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface BeforeUnDeploy { +} diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/LifecycleExtension.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/LifecycleExtension.java new file mode 100644 index 0000000000..7f26535482 --- /dev/null +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/LifecycleExtension.java @@ -0,0 +1,27 @@ +/** + * JBoss, Home of Professional Open Source. + * Copyright 2014-2022 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.pnc.integrationrex.setup.arquillian; + +import org.jboss.arquillian.core.spi.LoadableExtension; + +public class LifecycleExtension implements LoadableExtension { + @Override + public void register(ExtensionBuilder extensionBuilder) { + extensionBuilder.observer(LifecycleObserver.class); + } +} diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/LifecycleObserver.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/LifecycleObserver.java new file mode 100644 index 0000000000..c6cf4e81e6 --- /dev/null +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/setup/arquillian/LifecycleObserver.java @@ -0,0 +1,63 @@ +/** + * JBoss, Home of Professional Open Source. + * Copyright 2014-2022 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.pnc.integrationrex.setup.arquillian; + +import org.jboss.arquillian.core.api.annotation.Observes; +import org.jboss.arquillian.test.spi.TestClass; + +import java.lang.reflect.Method; + +public class LifecycleObserver { + + public void executeBeforeDeploy( + @Observes org.jboss.arquillian.container.spi.event.container.BeforeDeploy event, + TestClass testClass) { + execute(testClass.getMethods(BeforeDeploy.class)); + } + + public void executeAfterDeploy( + @Observes org.jboss.arquillian.container.spi.event.container.AfterDeploy event, + TestClass testClass) { + execute(testClass.getMethods(AfterDeploy.class)); + } + + public void executeBeforeUnDeploy( + @Observes org.jboss.arquillian.container.spi.event.container.BeforeUnDeploy event, + TestClass testClass) { + execute(testClass.getMethods(BeforeUnDeploy.class)); + } + + public void executeAfterUnDeploy( + @Observes org.jboss.arquillian.container.spi.event.container.AfterUnDeploy event, + TestClass testClass) { + execute(testClass.getMethods(AfterUnDeploy.class)); + } + + private void execute(Method[] methods) { + if (methods == null) { + return; + } + for (Method method : methods) { + try { + method.invoke(null); + } catch (Exception e) { + throw new RuntimeException("Could not execute method: " + method, e); + } + } + } +} diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/testcontainers/InfinispanContainer.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/testcontainers/InfinispanContainer.java index 00b45174db..dc40b95b72 100644 --- a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/testcontainers/InfinispanContainer.java +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/testcontainers/InfinispanContainer.java @@ -42,9 +42,4 @@ private void addCredentials() { withEnv("USER", INFINISPAN_USERNAME); withEnv("PASS", INFINISPAN_PASSWORD); } - - public String getIPAddress() { - getMappedPort(11222); - return getHost() + ':' + getMappedPort(11222); - } } diff --git a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/utils/ResponseUtils.java b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/utils/ResponseUtils.java index d620b93d15..af894ff20a 100644 --- a/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/utils/ResponseUtils.java +++ b/integration-test-rex/src/test/java/org/jboss/pnc/integrationrex/utils/ResponseUtils.java @@ -33,7 +33,7 @@ public static void waitSynchronouslyFor(Supplier condition, long timeou long stopTime = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(timeout, timeUnit); do { try { - TimeUnit.SECONDS.sleep(1); + TimeUnit.MILLISECONDS.sleep(100); } catch (InterruptedException e) { throw new AssertionError("Unexpected interruption", e); } diff --git a/integration-test-rex/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/integration-test-rex/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension new file mode 100644 index 0000000000..e019b10a3f --- /dev/null +++ b/integration-test-rex/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension @@ -0,0 +1 @@ +org.jboss.pnc.integrationrex.setup.arquillian.LifecycleExtension \ No newline at end of file