Stabilize unit test (#3291)
* Stabilize unit test The FileWriterTest creates files in the source directory(failed to delete them due to a bug in the `deleteDir` method), making them being checked by checkstyle plugin and failed to pass. * Seperate compilation step
This commit is contained in:
parent
ca80e457cc
commit
37f367a3b7
|
|
@ -53,11 +53,17 @@ pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
stage('Compile Test Codes') {
|
||||
steps {
|
||||
sh './mvnw -f test/e2e/pom.xml clean'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run End-to-End Tests') {
|
||||
parallel {
|
||||
stage('Run Single Node Tests') {
|
||||
steps {
|
||||
sh './mvnw -DskipSurefire=false -Dbuild.id=${BUILD_ID} -f test/e2e/pom.xml -pl e2e-single-service -am verify'
|
||||
sh './mvnw -Dbuild.id=${BUILD_ID} -f test/e2e/pom.xml -pl e2e-single-service -am verify'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
11
apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/logging/core/FileWriterTest.java
Normal file → Executable file
11
apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/logging/core/FileWriterTest.java
Normal file → Executable file
|
|
@ -36,7 +36,7 @@ public class FileWriterTest {
|
|||
@BeforeClass
|
||||
public static void beforeTestFile() throws IOException {
|
||||
Config.Logging.MAX_FILE_SIZE = 10;
|
||||
File directory = new File("");
|
||||
File directory = new File(System.getProperty("java.io.tmpdir", "/tmp"));
|
||||
Config.Logging.DIR = directory.getCanonicalPath() + Constants.PATH_SEPARATOR + "/log-test/";
|
||||
}
|
||||
|
||||
|
|
@ -57,16 +57,13 @@ public class FileWriterTest {
|
|||
Config.Logging.DIR = "";
|
||||
}
|
||||
|
||||
private static boolean deleteDir(File dir) {
|
||||
private static void deleteDir(File dir) {
|
||||
if (dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
boolean success = deleteDir(new File(dir, children[i]));
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
deleteDir(new File(dir, children[i]));
|
||||
}
|
||||
}
|
||||
return dir.delete();
|
||||
dir.delete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue