Skip to content

Commit 3b4f845

Browse files
committed
Use gradle-oci for all images used in integration tests
1 parent 7786888 commit 3b4f845

File tree

4 files changed

+45
-46
lines changed

4 files changed

+45
-46
lines changed

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ testing {
259259

260260
ociImageDependencies {
261261
runtime("hivemq:hivemq4:latest") { isChanging = true }
262+
runtime("hivemq:hivemq-swarm:latest") { isChanging = true }
262263
}
263264
}
264265

src/integrationTest/java/com/hivemq/cli/commands/swarm/commander/SwarmStatusCommandIT.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.hivemq.cli.openapi.swarm.CommanderApi;
2424
import com.hivemq.cli.openapi.swarm.RunsApi;
2525
import com.hivemq.cli.utils.TestLoggerUtils;
26+
import io.github.sgtsilvio.gradle.oci.junit.jupiter.OciImages;
2627
import okhttp3.OkHttpClient;
2728
import org.jetbrains.annotations.NotNull;
2829
import org.junit.jupiter.api.AfterEach;
@@ -44,23 +45,22 @@
4445

4546
public class SwarmStatusCommandIT {
4647

47-
//TODO: Temporary fix, see: https://github.com/testcontainers/testcontainers-java/pull/8302
48-
private static final @NotNull String IMAGE_NAME = "hivemq/hivemq-swarm:4.22.0";
4948
private static final int REST_PORT = 8080;
5049

5150
private final @NotNull Network network = Network.newNetwork();
52-
private final @NotNull GenericContainer<?> swarm = new GenericContainer<>(IMAGE_NAME).withNetwork(network)
53-
.withNetworkAliases("swarm")
54-
.withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881")
55-
.withEnv("SWARM_COMMANDER_MODE", "rest")
56-
.withEnv("SWARM_REST_ENABLED", "true")
57-
.withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true")
58-
.withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT))
59-
.withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0")
60-
.waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1))
61-
.withEnv("LOG_LEVEL", "DEBUG")
62-
.withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String()))
63-
.withExposedPorts(REST_PORT);
51+
private final @NotNull GenericContainer<?> swarm =
52+
new GenericContainer<>(OciImages.getImageName("hivemq/hivemq-swarm")).withNetwork(network)
53+
.withNetworkAliases("swarm")
54+
.withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881")
55+
.withEnv("SWARM_COMMANDER_MODE", "rest")
56+
.withEnv("SWARM_REST_ENABLED", "true")
57+
.withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true")
58+
.withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT))
59+
.withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0")
60+
.waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1))
61+
.withEnv("LOG_LEVEL", "DEBUG")
62+
.withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String()))
63+
.withExposedPorts(REST_PORT);
6464

6565
private @NotNull CommandLine commandLine;
6666
private @NotNull PrintStream out;

src/integrationTest/java/com/hivemq/cli/commands/swarm/run/SwarmRunStartCommandIT.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,24 @@
5151

5252
public class SwarmRunStartCommandIT {
5353

54-
//TODO: Temporary fix, see: https://github.com/testcontainers/testcontainers-java/pull/8302
55-
private static final @NotNull String IMAGE_NAME = "hivemq/hivemq-swarm:4.22.0";
5654
private static final int REST_PORT = 8080;
5755

5856
private final @NotNull Network network = Network.newNetwork();
59-
private final @NotNull GenericContainer<?> swarm = new GenericContainer<>(IMAGE_NAME).withNetwork(network)
60-
.withNetworkAliases("swarm")
61-
.withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881")
62-
.withEnv("SWARM_COMMANDER_MODE", "rest")
63-
.withEnv("SWARM_REST_ENABLED", "true")
64-
.withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost")
65-
.withEnv("SWARM_AGENT_BIND_PORT", "3881")
66-
.withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true")
67-
.withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT))
68-
.withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0")
69-
.waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1))
70-
.withEnv("LOG_LEVEL", "DEBUG")
71-
.withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String()))
72-
.withExposedPorts(REST_PORT);
57+
private final @NotNull GenericContainer<?> swarm =
58+
new GenericContainer<>(OciImages.getImageName("hivemq/hivemq-swarm")).withNetwork(network)
59+
.withNetworkAliases("swarm")
60+
.withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881")
61+
.withEnv("SWARM_COMMANDER_MODE", "rest")
62+
.withEnv("SWARM_REST_ENABLED", "true")
63+
.withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost")
64+
.withEnv("SWARM_AGENT_BIND_PORT", "3881")
65+
.withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true")
66+
.withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT))
67+
.withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0")
68+
.waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1))
69+
.withEnv("LOG_LEVEL", "DEBUG")
70+
.withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String()))
71+
.withExposedPorts(REST_PORT);
7372

7473
private final @NotNull HiveMQContainer hivemq =
7574
new HiveMQContainer(OciImages.getImageName("hivemq/hivemq4")).withNetwork(network)

src/integrationTest/java/com/hivemq/cli/commands/swarm/run/SwarmRunStopCommandIT.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,24 @@
6464

6565
public class SwarmRunStopCommandIT {
6666

67-
//TODO: Temporary fix, see: https://github.com/testcontainers/testcontainers-java/pull/8302
68-
private static final @NotNull String IMAGE_NAME = "hivemq/hivemq-swarm:4.22.0";
6967
private static final int REST_PORT = 8080;
7068

7169
private final @NotNull Network network = Network.newNetwork();
72-
private final @NotNull GenericContainer<?> swarm = new GenericContainer<>(IMAGE_NAME).withNetwork(network)
73-
.withNetworkAliases("swarm")
74-
.withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881")
75-
.withEnv("SWARM_COMMANDER_MODE", "rest")
76-
.withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost")
77-
.withEnv("SWARM_AGENT_BIND_PORT", "3881")
78-
.withEnv("SWARM_REST_ENABLED", "true")
79-
.withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true")
80-
.withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT))
81-
.withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0")
82-
.waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1))
83-
.withEnv("LOG_LEVEL", "DEBUG")
84-
.withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String()))
85-
.withExposedPorts(REST_PORT);
70+
private final @NotNull GenericContainer<?> swarm =
71+
new GenericContainer<>(OciImages.getImageName("hivemq/hivemq-swarm")).withNetwork(network)
72+
.withNetworkAliases("swarm")
73+
.withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881")
74+
.withEnv("SWARM_COMMANDER_MODE", "rest")
75+
.withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost")
76+
.withEnv("SWARM_AGENT_BIND_PORT", "3881")
77+
.withEnv("SWARM_REST_ENABLED", "true")
78+
.withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true")
79+
.withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT))
80+
.withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0")
81+
.waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1))
82+
.withEnv("LOG_LEVEL", "DEBUG")
83+
.withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String()))
84+
.withExposedPorts(REST_PORT);
8685

8786
private final @NotNull HiveMQContainer hivemq =
8887
new HiveMQContainer(OciImages.getImageName("hivemq/hivemq4")).withNetwork(network)

0 commit comments

Comments
 (0)