File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
core/src/test/java/org/testcontainers/containers Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -162,14 +162,18 @@ public void shouldHonorUDPPorts() {
162162 GenericContainer container = new GenericContainer <>(image )
163163 .withExposedPorts (8080 , 8081 )
164164 .withCreateContainerCmdModifier (cmd -> {
165- //Add previously exposed ports
166- List <ExposedPort > ports = new ArrayList <>();
165+ //Add previously exposed ports and UDP port
166+ List <ExposedPort > exposedPorts = new ArrayList <>();
167167 for (ExposedPort p : cmd .getExposedPorts ()) {
168- ports .add (p );
168+ exposedPorts .add (p );
169169 }
170- //Add and expose UDP port
171- ports .add (ExposedPort .udp (99 ));
172- cmd .withExposedPorts (ports );
170+ exposedPorts .add (ExposedPort .udp (99 ));
171+ cmd .withExposedPorts (exposedPorts );
172+
173+ //Add previous port bindings and UDP port binding
174+ Ports ports = cmd .getPortBindings ();
175+ ports .bind (ExposedPort .udp (99 ), Ports .Binding .empty ());
176+ cmd .withPortBindings (ports );
173177 }
174178 )
175179 ) {
You can’t perform that action at this time.
0 commit comments