Skip to content

Commit

Permalink
Use IPv6 in in integration tests
Browse files Browse the repository at this point in the history
Specify IPv6 host `::1` which is the equivalent of IPv4 host `127.0.0.1`.
  • Loading branch information
schneems committed Nov 25, 2024
1 parent 5f9f5dd commit d39ea2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- `libcnb-test`:
- The host returned by `TestContext::start_container` will now use IPv6 `::1` rather than IPv4 `127.0.0.1`. If you are using `ContainerContext::address_for_port` to assemble a URL, you may need to wrap the parsed `ip` in brackets `http://[{ip}]` ([]())

## [0.26.0] - 2024-11-18

Expand Down
6 changes: 3 additions & 3 deletions libcnb-test/src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl From<DockerRunCommand> for Command {
}

for port in &docker_run_command.exposed_ports {
command.args(["--publish", &format!("127.0.0.1::{port}")]);
command.args(["--publish", &format!("[::1]::{port}")]);
}

for (source, target) in &docker_run_command.bind_mounts {
Expand Down Expand Up @@ -355,9 +355,9 @@ mod tests {
"--env",
"FOO=1",
"--publish",
"127.0.0.1::12345",
"[::1]::12345",
"--publish",
"127.0.0.1::55555",
"[::1]::55555",
"--mount",
"type=bind,source=./test-cache,target=/cache",
"--mount",
Expand Down

0 comments on commit d39ea2d

Please sign in to comment.