Skip to content

Commit 0997068

Browse files
committed
fix: missing image build step in generic_image_port_not_exposed test
Signed-off-by: mbodmer <marc.bodmer@email.ch>
1 parent d7dbad1 commit 0997068

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

testcontainers/tests/sync_runner.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,12 @@ fn generic_image_port_not_exposed() -> anyhow::Result<()> {
141141
let target_port = 8080;
142142

143143
// This image binds to 0.0.0.0:8080, does not EXPOSE ports in its dockerfile.
144-
let generic_server = GenericImage::new("no_expose_port", "latest")
145-
.with_wait_for(WaitFor::message_on_stdout("listening on 0.0.0.0:8080"));
146-
let node = generic_server.start()?;
144+
let node = GenericBuildableImage::new("no_expose_port", "latest")
145+
// "Dockerfile" is included already, so adding the build context directory is all what is needed
146+
.with_file(std::fs::canonicalize("../testimages/no_expose_port")?, ".")
147+
.build_image()?
148+
.with_wait_for(WaitFor::message_on_stdout("listening on 0.0.0.0:8080"))
149+
.start()?;
147150

148151
// Without exposing the port with `with_exposed_port()`, we cannot get a mapping to it.
149152
let res = node.get_host_port_ipv4(target_port.tcp());

0 commit comments

Comments
 (0)