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

Feature/gradle oci in extensions #443

Merged
merged 7 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ testing {

ociImageDependencies {
runtime("hivemq:hivemq4:latest") { isChanging = true }
runtime("hivemq:hivemq-swarm:latest") { isChanging = true }
}
}

Expand Down Expand Up @@ -308,6 +309,16 @@ testing {
tasks.named("check") {
dependsOn(integrationTest, systemTest)
}

tasks.named("integrationTestOciRegistryData", oci.imagesTaskClass) {
val linuxAmd64 = oci.platformSelector(oci.platform("linux", "amd64"))
val linuxArm64v8 = oci.platformSelector(oci.platform("linux", "arm64", "v8"))
platformSelector = if (System.getenv("CI_RUN") != null) {
linuxAmd64
} else {
linuxAmd64.and(linuxArm64v8)
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ graalvm-native = { id = "org.graalvm.buildtools.native", version = "0.10.2" }
launch4j = { id = "edu.sc.seis.launch4j", version = "3.0.6" }
license = { id = "com.github.hierynomus.license", version = "0.16.1" }
nebula-ospackage = { id = "com.netflix.nebula.ospackage", version = "11.9.1" }
oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.10.0" }
oci = { id = "io.github.sgtsilvio.gradle.oci", version = "0.15.1" }
openapi-generator = { id = "org.openapi.generator", version = "4.3.1" } # >= 5.0.0 breaks the tasks
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.hivemq.cli.openapi.swarm.CommanderApi;
import com.hivemq.cli.openapi.swarm.RunsApi;
import com.hivemq.cli.utils.TestLoggerUtils;
import io.github.sgtsilvio.gradle.oci.junit.jupiter.OciImages;
import okhttp3.OkHttpClient;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.AfterEach;
Expand All @@ -44,23 +45,22 @@

public class SwarmStatusCommandIT {

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

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

private @NotNull CommandLine commandLine;
private @NotNull PrintStream out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,24 @@

public class SwarmRunStartCommandIT {

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

private final @NotNull Network network = Network.newNetwork();
private final @NotNull GenericContainer<?> swarm = new GenericContainer<>(IMAGE_NAME).withNetwork(network)
.withNetworkAliases("swarm")
.withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881")
.withEnv("SWARM_COMMANDER_MODE", "rest")
.withEnv("SWARM_REST_ENABLED", "true")
.withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost")
.withEnv("SWARM_AGENT_BIND_PORT", "3881")
.withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true")
.withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT))
.withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0")
.waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1))
.withEnv("LOG_LEVEL", "DEBUG")
.withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String()))
.withExposedPorts(REST_PORT);
private final @NotNull GenericContainer<?> swarm =
new GenericContainer<>(OciImages.getImageName("hivemq/hivemq-swarm")).withNetwork(network)
.withNetworkAliases("swarm")
.withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881")
.withEnv("SWARM_COMMANDER_MODE", "rest")
.withEnv("SWARM_REST_ENABLED", "true")
.withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost")
.withEnv("SWARM_AGENT_BIND_PORT", "3881")
.withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true")
.withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT))
.withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0")
.waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1))
.withEnv("LOG_LEVEL", "DEBUG")
.withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String()))
.withExposedPorts(REST_PORT);

private final @NotNull HiveMQContainer hivemq =
new HiveMQContainer(OciImages.getImageName("hivemq/hivemq4")).withNetwork(network)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,24 @@

public class SwarmRunStopCommandIT {

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

private final @NotNull Network network = Network.newNetwork();
private final @NotNull GenericContainer<?> swarm = new GenericContainer<>(IMAGE_NAME).withNetwork(network)
.withNetworkAliases("swarm")
.withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881")
.withEnv("SWARM_COMMANDER_MODE", "rest")
.withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost")
.withEnv("SWARM_AGENT_BIND_PORT", "3881")
.withEnv("SWARM_REST_ENABLED", "true")
.withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true")
.withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT))
.withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0")
.waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1))
.withEnv("LOG_LEVEL", "DEBUG")
.withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String()))
.withExposedPorts(REST_PORT);
private final @NotNull GenericContainer<?> swarm =
new GenericContainer<>(OciImages.getImageName("hivemq/hivemq-swarm")).withNetwork(network)
.withNetworkAliases("swarm")
.withEnv("SWARM_COMMANDER_AGENTS", "localhost:3881")
.withEnv("SWARM_COMMANDER_MODE", "rest")
.withEnv("SWARM_AGENT_BIND_ADDRESS", "localhost")
.withEnv("SWARM_AGENT_BIND_PORT", "3881")
.withEnv("SWARM_REST_ENABLED", "true")
.withEnv("SWARM_REST_LISTENER_HTTP_ENABLED", "true")
.withEnv("SWARM_REST_LISTENER_HTTP_PORT", Integer.toString(REST_PORT))
.withEnv("SWARM_REST_LISTENER_HTTP_HOST", "0.0.0.0")
.waitingFor(Wait.forLogMessage("(.*)Commander REST-API: successfully started.(.*)", 1))
.withEnv("LOG_LEVEL", "DEBUG")
.withLogConsumer(outputFrame -> System.out.print("SWARM: " + outputFrame.getUtf8String()))
.withExposedPorts(REST_PORT);

private final @NotNull HiveMQContainer hivemq =
new HiveMQContainer(OciImages.getImageName("hivemq/hivemq4")).withNetwork(network)
Expand Down
Loading