Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean jandex index after test #12207

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ public void canDetectOutputChangeWhenBuilding() throws Exception {
assertThat(runnerJar).exists();
}

@Test
public void canDetectUpToDateTests() throws Exception {
createProject(SourceType.JAVA);

BuildResult firstBuild = runGradleWrapper(projectRoot, "test");

assertThat(firstBuild.getTasks().get(":test")).isEqualTo(BuildResult.SUCCESS_OUTCOME);

BuildResult secondBuild = runGradleWrapper(projectRoot, "test");

assertThat(secondBuild.getTasks().get(":test")).isEqualTo(BuildResult.UPTODATE_OUTCOME);
}

@Test
public void canDetectSystemPropertyChangeWhenBuilding() throws Exception {
createProject(SourceType.JAVA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,15 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx
}
});
}

public static void removeIndex(Class<?> requiredTestClass) {
Path indexPath = indexPath(requiredTestClass);
if (Files.exists(indexPath)) {
try {
Files.delete(indexPath);
} catch (IOException e) {
throw new IllegalStateException("Unable to delete file index", e);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ public void close() throws IOException {
}
tm.close();
}
try {
TestClassIndexer.removeIndex(requiredTestClass);
} catch (Exception ignored) {
}
}
}
};
Expand Down