Skip to content

Commit

Permalink
Rename forListeningPort(int... port) to forListeningPorts(int... port…
Browse files Browse the repository at this point in the history
…s) (#7425)
  • Loading branch information
eddumelendez authored Aug 18, 2023
1 parent f1b0b07 commit f4856a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
@Slf4j
public class HostPortWaitStrategy extends AbstractWaitStrategy {

private int[] port;
private int[] ports;

@Override
@SneakyThrows(InterruptedException.class)
protected void waitUntilReady() {
final Set<Integer> externalLivenessCheckPorts;
if (this.port == null) {
if (this.ports == null || this.ports.length == 0) {
externalLivenessCheckPorts = getLivenessCheckPorts();
if (externalLivenessCheckPorts.isEmpty()) {
if (log.isDebugEnabled()) {
Expand All @@ -46,7 +46,7 @@ protected void waitUntilReady() {
} else {
externalLivenessCheckPorts =
Arrays
.stream(this.port)
.stream(this.ports)
.mapToObj(port -> waitStrategyTarget.getMappedPort(port))
.collect(Collectors.toSet());
}
Expand Down Expand Up @@ -124,8 +124,8 @@ private Set<Integer> getInternalPorts(Set<Integer> externalLivenessCheckPorts, L
.collect(Collectors.toSet());
}

public HostPortWaitStrategy forPort(int... port) {
this.port = port;
public HostPortWaitStrategy forPorts(int... ports) {
this.ports = ports;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public static HostPortWaitStrategy forListeningPort() {
}

/**
* Convenience method to return a WaitStrategy for an exposed or mapped port.
* Convenience method to return a WaitStrategy for exposed or mapped ports.
*
* @param port the port to check
* @param ports the port to check
* @return the WaitStrategy
*/
public static HostPortWaitStrategy forListeningPort(int... port) {
return new HostPortWaitStrategy().forPort(port);
public static HostPortWaitStrategy forListeningPorts(int... ports) {
return new HostPortWaitStrategy().forPorts(ports);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class ExplicitHostPortWaitStrategyTest {
.withExposedPorts()
.withCommand("sh", "-c", "while true; do nc -lp 8080; done")
.withExposedPorts(8080)
.waitingFor(Wait.forListeningPort(8080).withStartupTimeout(Duration.ofSeconds(10)));
.waitingFor(Wait.forListeningPorts(8080).withStartupTimeout(Duration.ofSeconds(10)));

@Test
public void testWaiting() {}
Expand Down

0 comments on commit f4856a0

Please sign in to comment.