@@ -149,7 +149,7 @@ public HttpResponse execute(HttpRequest req) throws UncheckedIOException {
149149 .add (caps , new TestSessionFactory ((id , c ) -> new Handler (c )))
150150 .maximumConcurrentSessions (2 );
151151 if (isDownloadsTestCase ) {
152- builder = builder .enableManagedDownloads (true ).sessionTimeout (Duration . ofSeconds (1 ));
152+ builder = builder .enableManagedDownloads (true ).sessionTimeout (ofSeconds (1 ));
153153 }
154154 local = builder .build ();
155155 local2 = builder .build ();
@@ -568,7 +568,7 @@ void canUploadAFile() throws IOException {
568568 assertThat (new String (Files .readAllBytes (uploadDir .listFiles ()[0 ].toPath ()))).isEqualTo (hello );
569569
570570 node .stop (session .getId ());
571- assertThat (baseDir ). doesNotExist ( );
571+ waitUntilDirGetsDeleted (baseDir );
572572 }
573573
574574 @ Test
@@ -644,7 +644,7 @@ void canDownloadMultipleFile() throws IOException {
644644 TemporaryFilesystem downloadsTfs = local .getDownloadsFilesystem (session .getId ());
645645 File someDir = getTemporaryFilesystemBaseDir (downloadsTfs );
646646 node .stop (session .getId ());
647- assertThat (someDir ). doesNotExist ( );
647+ waitUntilDirGetsDeleted (someDir );
648648 }
649649 }
650650
@@ -975,6 +975,10 @@ private List<String> listFileDownloads(SessionId sessionId) {
975975 return (List <String >) map .get ("names" );
976976 }
977977
978+ private void waitUntilDirGetsDeleted (File dir ) {
979+ new FluentWait <>(dir ).withTimeout (ofSeconds (2 )).until (file -> !file .exists ());
980+ }
981+
978982 private static class MyClock extends Clock {
979983
980984 private final AtomicReference <Instant > now ;
0 commit comments