Skip to content

Commit

Permalink
Fix testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow-Devil committed Dec 3, 2024
1 parent 3942e35 commit e0808c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public BalServer() throws BallerinaTestException {
}

public BalServer(Path serverZipFile) throws BallerinaTestException {
setUpServerHome(serverZipFile);
setUpServerHome(serverZipFile.toAbsolutePath());
log.info("Server Home " + serverHome);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.ballerinalang.test.context.LogLeecher;
import org.ballerinalang.test.context.ServerLogReader;
import org.ballerinalang.test.context.Utils;
import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand All @@ -45,7 +46,8 @@
*/
public class StrandDumpTest extends BaseTest {

private static final Path testFileLocation = Path.of("src/test/resources/troubleshoot/strandDump");
private static final Path testFileLocation = Path.of("src/test/resources/troubleshoot/strandDump")
.toAbsolutePath();
private static final String JAVA_OPTS = "JAVA_OPTS";
private static final int TIMEOUT = 60000;
private BMainInstance bMainInstance;
Expand Down Expand Up @@ -74,18 +76,17 @@ public void testStrandDumpOfBalPackage() throws BallerinaTestException {
@Test
public void testStrandDumpDuringBalTest() throws BallerinaTestException {
if (Utils.isWindowsOS()) {
return;
throw new SkipException("Currently not working on windows");
}

Path expectedOutputFilePath = testFileLocation.resolve("testOutputs/balTestStrandDumpRegEx.txt");
Path steadyStateOutputFilePath = testFileLocation.resolve("testOutputs/balTestSteadyState.txt");
Path sourceRoot = testFileLocation;
String packageName = "testPackageWithModules";
Map<String, String> envProperties = new HashMap<>();
bMainInstance.addJavaAgents(envProperties);

String[] cmdArgs = new String[]{"bash", balServer.getServerHome() + "/bin/bal", "test", packageName};
ProcessBuilder processBuilder = new ProcessBuilder(cmdArgs).directory(sourceRoot.toFile());
ProcessBuilder processBuilder = new ProcessBuilder(cmdArgs).directory(testFileLocation.toFile());
startProcessAndVerifyStrandDump(processBuilder, envProperties, expectedOutputFilePath,
steadyStateOutputFilePath, false);
}
Expand All @@ -109,7 +110,7 @@ private void runJarAndVerifyStrandDump(Map<String, String> envProperties, Path j
Path expectedStrandDumpFilePath, Path steadyStateOutputFilePath)
throws BallerinaTestException {
if (Utils.isWindowsOS()) {
return;
throw new SkipException("Currently not working on windows");
}

List<String> runCmdSet = new ArrayList<>();
Expand All @@ -120,7 +121,7 @@ private void runJarAndVerifyStrandDump(Map<String, String> envProperties, Path j
runCmdSet.add("-Dballerina.home=" + tempBalHome);
runCmdSet.addAll(Arrays.asList("-jar", jarPath.toAbsolutePath().toString()));

ProcessBuilder processBuilder = new ProcessBuilder(runCmdSet).directory(commandDir.toFile());
ProcessBuilder processBuilder = new ProcessBuilder(runCmdSet).directory(commandDir.toAbsolutePath().toFile());
startProcessAndVerifyStrandDump(processBuilder, envProperties, expectedStrandDumpFilePath,
steadyStateOutputFilePath, true);
}
Expand Down

0 comments on commit e0808c1

Please sign in to comment.