Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sleipnir committed Aug 6, 2024
2 parents 5af756c + 9778d70 commit 52de888
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'

- name: Run tests
run: mvn compile && mvn test
run: mvn compile test
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<protobuf.version>4.27.2</protobuf.version>
<grpc.version>1.65.0</grpc.version>
<logback-classic.version>1.4.12</logback-classic.version>
<testcontainers.version>1.20.0</testcontainers.version>
<testcontainers.version>1.20.1</testcontainers.version>
<junit.jupiter.version>5.10.3</junit.jupiter.version>
<junit.platform.version>1.8.2</junit.platform.version>
<surefire.plugin.version>3.0.0-M5</surefire.plugin.version>
Expand Down
19 changes: 7 additions & 12 deletions src/test/java/io/eigr/spawn/AbstractContainerBaseTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.eigr.spawn;

import com.github.dockerjava.api.model.HostConfig;
import com.github.dockerjava.api.model.PortBinding;
import io.eigr.spawn.api.Spawn;
import io.eigr.spawn.api.TransportOpts;
import io.eigr.spawn.api.exceptions.SpawnException;
Expand All @@ -24,16 +22,13 @@ public abstract class AbstractContainerBaseTest {
private static GenericContainer<?> SPAWN_CONTAINER;
private static final String spawnProxyImage = "eigr/spawn-proxy:1.4.1-rc.1";
private static final String userFunctionPort = "8091";
private static final String spawnProxyPort = "9004";
protected static Spawn spawnSystem;
protected static final String spawnSystemName = "spawn-system-test";

static {
Testcontainers.exposeHostPorts(8091);

SPAWN_CONTAINER = new GenericContainer<>(DockerImageName.parse(spawnProxyImage))
.withCreateContainerCmdModifier(e -> e.withHostConfig(HostConfig.newHostConfig()
.withPortBindings(PortBinding.parse("9004:9004"))))
.waitingFor(new LogMessageWaitStrategy()
.withRegEx(".*Proxy Application started successfully.*"))
.withEnv("SPAWN_PROXY_LOGGER_LEVEL", "DEBUG")
Expand All @@ -44,13 +39,12 @@ public abstract class AbstractContainerBaseTest {
.withEnv("NODE_COOKIE", "cookie-9ce3712b0c3ee21b582c30f942c0d4da-HLuZyQzy+nt0p0r/PVVFTp2tqfLom5igrdmwkYSuO+Q=")
.withEnv("POD_NAMESPACE", spawnSystemName)
.withEnv("POD_IP", spawnSystemName)
.withEnv("PROXY_HTTP_PORT", spawnProxyPort)
.withEnv("PROXY_HTTP_PORT", "9004")
.withEnv("USER_FUNCTION_PORT", userFunctionPort)
.withEnv("USER_FUNCTION_HOST", "host.docker.internal") // Docker
.withExtraHost("host.docker.internal", "host-gateway") // Docker
// .withEnv("USER_FUNCTION_HOST", "host.containers.internal") // Podman
// .withExtraHost("host.containers.internal", "host-gateway") // Podman
.withExposedPorts(9004);
.withEnv("USER_FUNCTION_HOST", "host.testcontainers.internal")
.withExtraHost("host.testcontainers.internal", "host-gateway")
.withExposedPorts(9004)
.withAccessToHost(true);
SPAWN_CONTAINER.start();

DependencyInjector injector = SimpleDependencyInjector.createInjector();
Expand All @@ -65,8 +59,9 @@ public abstract class AbstractContainerBaseTest {
.withActor(StatelessNamedActor.class)
.withTerminationGracePeriodSeconds(5)
.withTransportOptions(TransportOpts.builder()
.host(SPAWN_CONTAINER.getHost())
.port(8091)
.proxyPort(9004)
.proxyPort(SPAWN_CONTAINER.getMappedPort(9004))
.build())
.build();

Expand Down

0 comments on commit 52de888

Please sign in to comment.