@@ -62,13 +62,16 @@ public void asyncLogContainer() throws Exception {
6262
6363 LogContainerTestCallback loggingCallback = new LogContainerTestCallback ();
6464
65+ //this essentially test the since=0 case
6566 dockerClient .logContainerCmd (container .getId ()).withStdErr ().withStdOut ().exec (loggingCallback );
6667
6768 loggingCallback .awaitCompletion ();
6869
6970 assertTrue (loggingCallback .toString ().contains (snippet ));
7071 }
7172
73+
74+
7275 @ Test
7376 public void asyncLogNonExistingContainer () throws Exception {
7477
@@ -135,4 +138,30 @@ public void asyncMultipleLogContainer() throws Exception {
135138 assertTrue (loggingCallback .toString ().contains (snippet ));
136139 }
137140
141+ @ Test
142+ public void asyncLogContainerWithSince () throws Exception {
143+ String snippet = "hello world" ;
144+
145+ CreateContainerResponse container = dockerClient .createContainerCmd ("busybox" ).withCmd ("/bin/echo" , snippet )
146+ .exec ();
147+
148+ LOG .info ("Created container: {}" , container .toString ());
149+ assertThat (container .getId (), not (isEmptyString ()));
150+
151+ dockerClient .startContainerCmd (container .getId ()).exec ();
152+
153+ int exitCode = dockerClient .waitContainerCmd (container .getId ()).exec ();
154+
155+ assertThat (exitCode , equalTo (0 ));
156+
157+ LogContainerTestCallback loggingCallback = new LogContainerTestCallback ();
158+
159+ int oneMinuteIntoFuture = (int )(System .currentTimeMillis ()/1000 ) + 60 ;
160+ dockerClient .logContainerCmd (container .getId ()).withStdErr ().withStdOut ().withSince (oneMinuteIntoFuture ).exec (loggingCallback );
161+
162+ loggingCallback .awaitCompletion ();
163+
164+ assertFalse (loggingCallback .toString ().contains (snippet ));
165+ }
166+
138167}
0 commit comments