Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to run MP LRA TCK with externally managed coordinator #31944

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.jboss.arquillian.core.api.annotation.Observes;
import org.jboss.logging.Logger;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;

public class LRACoordinatorManager {
Expand All @@ -18,16 +19,20 @@ public class LRACoordinatorManager {

public void beforeClass(
@Observes(precedence = DEFAULT_PRECEDENCE) org.jboss.arquillian.test.spi.event.suite.BeforeSuite event) {
LOGGER.debug("Starting LRA coordinator on port " + coordinatorPort);
coordinatorContainer = new GenericContainer<>(DockerImageName.parse("quay.io/jbosstm/lra-coordinator:latest"))
// lra-coordinator is a Quarkus service
.withEnv("QUARKUS_HTTP_PORT", String.valueOf(coordinatorPort))
// need to run with host network because coordinator calls the TCK services from the container
.withNetworkMode("host");
if (System.getProperty("lra.coordinator.url") == null) {
LOGGER.debug("Starting LRA coordinator on port " + coordinatorPort);
coordinatorContainer = new GenericContainer<>(DockerImageName.parse("quay.io/jbosstm/lra-coordinator:latest"))
// lra-coordinator is a Quarkus service
.withEnv("QUARKUS_HTTP_PORT", String.valueOf(coordinatorPort))
// need to run with host network because coordinator calls the TCK services from the container
.withNetworkMode("host")
.waitingFor(Wait.forLogMessage(".*lra-coordinator-quarkus.*", 1));
;

coordinatorContainer.start();
coordinatorContainer.start();

System.setProperty("lra.coordinator.url", String.format("http://localhost:%d/lra-coordinator", coordinatorPort));
System.setProperty("lra.coordinator.url", String.format("http://localhost:%d/lra-coordinator", coordinatorPort));
}
}

public void afterClass(
Expand Down