Skip to content

Commit 04ffd18

Browse files
authored
Merge pull request #50324 from xstefank/lra-tck-fix
Fix LRA TCK so it is possible to run it with the separate coordinator
2 parents c14c9ab + 62d6b59 commit 04ffd18

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tcks/microprofile-lra/src/main/java/io/quarkus/tck/lra/LRACoordinatorManager.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class LRACoordinatorManager {
1616
private static final int DEFAULT_PRECEDENCE = -100;
1717
private static final Logger LOGGER = LoggerFactory.getLogger(LRACoordinatorManager.class);
1818
private final int coordinatorPort = getFreePort(50000, 60000);
19+
private String quarkusLraDevservicesEnabledValue = null;
1920

2021
private GenericContainer coordinatorContainer;
2122

@@ -30,25 +31,31 @@ public void beforeClass(
3031
// need to run with host network because coordinator calls the TCK services from the container
3132
.withNetworkMode("host")
3233
.waitingFor(Wait.forLogMessage(".*lra-coordinator-quarkus.*", 1));
33-
;
3434

3535
coordinatorContainer.start();
3636
coordinatorContainer.followOutput(logConsumer);
3737
System.setProperty("lra.coordinator.url", String.format("http://localhost:%d/lra-coordinator", coordinatorPort));
3838
// Can we reuse Dev Services for LRA coordinator here?
39-
System.setProperty("quarkus.lra.devservices.enabled", "false");
4039
}
40+
41+
// Always disable Quarkus LRA Dev Services (even if ran without a separate coordinator)
42+
quarkusLraDevservicesEnabledValue = System.getProperty("quarkus.lra.devservices.enabled");
43+
System.setProperty("quarkus.lra.devservices.enabled", "false");
4144
}
4245

4346
public void afterClass(
4447
@Observes(precedence = DEFAULT_PRECEDENCE) org.jboss.arquillian.test.spi.event.suite.AfterSuite event) {
4548
if (coordinatorContainer != null && coordinatorContainer.isRunning()) {
4649
coordinatorContainer.stop();
50+
51+
// clear the system property so that it does not affect other tests
52+
System.clearProperty("lra.coordinator.url");
4753
}
4854

49-
// clear the system property so that it does not affect other tests
50-
System.clearProperty("lra.coordinator.url");
51-
System.clearProperty("quarkus.lra.devservices.enabled");
55+
if (quarkusLraDevservicesEnabledValue != null) {
56+
System.setProperty("quarkus.lra.devservices.enabled", quarkusLraDevservicesEnabledValue);
57+
quarkusLraDevservicesEnabledValue = null;
58+
}
5259
}
5360

5461
public int getFreePort(int from, int to) {

0 commit comments

Comments
 (0)