@@ -22,7 +22,7 @@ public class Container {
2222 private static final Logger LOG = Logger .getLogger (Container .class .getName ());
2323
2424 private static final String LOCALSTACK_NAME = "localstack/localstack" ;
25- private static final String LOCALSTACK_PORTS = "4567-4584 " ;
25+ private static final String LOCALSTACK_PORTS = "4566-4593 " ;
2626
2727 private static final int MAX_PORT_CONNECTION_ATTEMPTS = 10 ;
2828
@@ -92,13 +92,11 @@ public static Container getRunningLocalstackContainer(String containerId) {
9292 return new Container (containerId , portMappingsList );
9393 }
9494
95-
9695 private Container (String containerId , List <PortMapping > ports ) {
9796 this .containerId = containerId ;
9897 this .ports = Collections .unmodifiableList (ports );
9998 }
10099
101-
102100 /**
103101 * Given an internal port, retrieve the publicly addressable port that maps to it
104102 */
@@ -110,12 +108,10 @@ public int getExternalPortFor(int internalPort) {
110108 .orElseThrow (() -> new IllegalArgumentException ("Port: " + internalPort + " does not exist" ));
111109 }
112110
113-
114111 public void waitForAllPorts (String ip ) {
115112 ports .forEach (port -> waitForPort (ip , port ));
116113 }
117114
118-
119115 private void waitForPort (String ip , PortMapping port ) {
120116 int attempts = 0 ;
121117 do {
@@ -129,7 +125,6 @@ private void waitForPort(String ip, PortMapping port) {
129125 throw new IllegalStateException ("Could not open port:" + port .getExternalPort () + " on ip:" + port .getIp ());
130126 }
131127
132-
133128 private boolean isPortOpen (String ip , PortMapping port ) {
134129 try (Socket socket = new Socket ()) {
135130 socket .connect (new InetSocketAddress (ip , port .getExternalPort ()), 1000 );
@@ -139,7 +134,6 @@ private boolean isPortOpen(String ip, PortMapping port) {
139134 }
140135 }
141136
142-
143137 /**
144138 * Poll the docker logs until a specific token appears, then return. Primarily
145139 * used to look for the "Ready." token in the LocalStack logs.
@@ -159,18 +153,15 @@ public void waitForLogToken(Pattern pattern) {
159153 throw new IllegalStateException ("Could not find token: " + pattern + " in Docker logs: " + logs );
160154 }
161155
162-
163156 private boolean logContainsPattern (Pattern pattern ) {
164157 String logs = getContainerLogs ();
165158 return pattern .matcher (logs ).find ();
166159 }
167160
168-
169161 private String getContainerLogs () {
170162 return new LogCommand (containerId ).withNumberOfLines (NUM_LOG_LINES ).execute ();
171163 }
172164
173-
174165 private void waitForLogs (){
175166 try {
176167 Thread .sleep (POLL_INTERVAL );
@@ -180,7 +171,6 @@ private void waitForLogs(){
180171 }
181172 }
182173
183-
184174 /**
185175 * Stop the container
186176 */
@@ -192,7 +182,6 @@ public void stop() {
192182 LOG .info ("Stopped container: " + containerId );
193183 }
194184
195-
196185 /**
197186 * Run a command on the container via docker exec
198187 */
0 commit comments