Skip to content

Commit

Permalink
[NO JIRA] Improve SanityTest to not build another time (#4554)
Browse files Browse the repository at this point in the history
  • Loading branch information
leveretka authored Nov 17, 2023
1 parent 4832244 commit b43aaa3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ sanity_task:
sanity_script:
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
- mvn clean install -DskipTests=true
- mvn clean compile --projects java-checks-test-sources --also-make-dependents
- mvn verify -f sonar-java-plugin/pom.xml -Psanity -Dtest=SanityTest
cleanup_before_cache_script: cleanup_maven_repository

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,11 @@
class SanityTest {

private static final Logger LOG = LoggerFactory.getLogger(SanityTest.class);
public static final String DEFAULT_MODULE = "default";

@RegisterExtension
public final LogTesterJUnit5 logTester = new LogTesterJUnit5().setLevel(Level.DEBUG);

private static final String TARGET_CLASSES = "../java-checks/target/test-classes";
private static final String TEST_FILES_EXTRA_CLASSES = "../java-checks/src/test/resources/";

private static final String AWS_MODULE = "aws";

private static final String[] FILE_DIRECTORIES = {
Expand Down Expand Up @@ -117,7 +115,7 @@ void test() throws Exception {
List<InputFile> inputFiles = getJavaInputFiles(moduleBaseDir);
assertThat(inputFiles).hasSizeGreaterThanOrEqualTo(checks.size());

List<File> classpath = getClassPath();
List<File> classpath = getClassPathFromModule(DEFAULT_MODULE);
classpath.addAll(getClassPathFromModule(AWS_MODULE));
assertThat(classpath).isNotEmpty();

Expand Down Expand Up @@ -248,14 +246,6 @@ private static boolean isNotParsingErrorFile(String filename) {
return !(filename.contains("ParsingError") || filename.contains("ParseError"));
}

private static List<File> getClassPath() {
List<File> classpath = new ArrayList<>();
classpath.addAll(FilesUtils.getClassPath(FilesUtils.DEFAULT_TEST_JARS_DIRECTORY));
classpath.add(new File(TARGET_CLASSES).getAbsoluteFile());
classpath.add(new File(TEST_FILES_EXTRA_CLASSES).getAbsoluteFile());
return classpath;
}

private static List<File> getClassPathFromModule(String module) {
List<File> classpath = new ArrayList<>();
classpath.addAll(FilesUtils.getClassPath(FilesUtils.TEST_SOURCES_ROOT + module + FilesUtils.TARGET_TEST_JARS));
Expand Down

0 comments on commit b43aaa3

Please sign in to comment.