Skip to content

Commit

Permalink
bugfix: fixed flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lprimak committed Sep 26, 2024
1 parent c426991 commit 595f5a1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ private void extractFileInDestinationDir() {
} catch (IOException e) {
System.err.println("Failed to unzip file: " + e.getMessage());
}
markerFileHandler.deleteMarkerFile();
System.out.printf("Resolver: Successfully extracted maven binaries from %s%n", fileToExtract);
if (markerFileHandler.deleteMarkerFile()) {
System.out.printf("Resolver: Successfully extracted maven binaries from %s%n", fileToExtract);
}
}

private static InputStream getCompressorInputStream(String fileExtension, FileInputStream fileInputStream) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ void createMarkerFile() {
}
}

void deleteMarkerFile() {
boolean deleteMarkerFile() {
if (markerFile.exists() && !markerFile.delete()) {
log.warning("failed to delete marker file: " + markerFile);
return false;
}
return true;
}

boolean waitTillMarkerFileIsGone(long timeoutInMilliseconds, String processName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void testDaemonShouldWaitForBuildSuccess() throws TimeoutException {
.withWaitUntilOutputLineMatches(".*BUILD SUCCESS.*")
.build();

Awaitility.await("Wait till thread is not be alive").atMost(20, TimeUnit.SECONDS)
Awaitility.await("Wait till thread is not be alive").atMost(45, TimeUnit.SECONDS)
.until(() -> !daemonBuild.isAlive());

Assertions.assertNotNull(daemonBuild.getBuiltProject());
Expand All @@ -60,7 +60,7 @@ void testDaemonWithoutWaitShouldNotReachTheEndOfTheBuild() {
Assertions.assertTrue(daemonBuild.isAlive());
Assertions.assertNull(daemonBuild.getBuiltProject());

Awaitility.await("Wait till thread is not be alive").atMost(20, TimeUnit.SECONDS)
Awaitility.await("Wait till thread is not be alive").atMost(45, TimeUnit.SECONDS)
.until(() -> !daemonBuild.isAlive());

Assertions.assertFalse(daemonBuild.isAlive());
Expand Down

0 comments on commit 595f5a1

Please sign in to comment.