Skip to content

Use add exposed ports instead of set exposed ports #76

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

Merged
merged 3 commits into from
Jun 16, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Fix problem if topology isn't applied correctly
- Bump testcontainers to 1.18.0
- Move rocks building in build phase
- Use "addExposedPorts" instead of "withExposedPorts"

## [0.5.4] - 2023-03-31
- Use tarantool image as base instead of centos in cartridge container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.testcontainers.containers.exceptions.CartridgeTopologyException;
import org.testcontainers.images.builder.ImageFromDockerfile;
import org.testcontainers.shaded.org.apache.commons.lang3.ArrayUtils;

import java.net.URL;
import java.util.Arrays;
Expand Down Expand Up @@ -216,6 +217,16 @@ private static ImageFromDockerfile withBuildArgs(ImageFromDockerfile image, Map<
return image;
}

public TarantoolCartridgeContainer withFixedExposedPort(int hostPort, int containerPort) {
super.addFixedExposedPort(hostPort, containerPort);
return this;
}

public TarantoolCartridgeContainer withExposedPort(Integer port) {
super.addExposedPort(port);
return this;
}

private static Map<String, String> mergeBuildArguments(Map<String, String> buildArgs) {
Map<String, String> args = new HashMap<>(buildArgs);

Expand Down Expand Up @@ -463,7 +474,7 @@ protected void configure() {
addFixedExposedPort(port, port);
}
} else {
withExposedPorts(instanceFileParser.getExposablePorts());
addExposedPorts(ArrayUtils.toPrimitive(instanceFileParser.getExposablePorts()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ public TarantoolContainer withPort(int port) {
return this;
}

public TarantoolContainer withFixedExposedPort(int hostPort, int containerPort) {
super.addFixedExposedPort(hostPort, containerPort);
return this;
}

public TarantoolContainer withExposedPort(Integer port) {
super.addExposedPort(port);
return this;
}

@Override
public String getHost() {
return host;
Expand Down Expand Up @@ -349,7 +359,7 @@ protected void configure() {
if (useFixedPorts) {
addFixedExposedPort(port, port);
} else {
withExposedPorts(port);
addExposedPorts(port);
}

withCommand("tarantool", normalizePath(
Expand Down