From c51495636ac3c1974c1d746c7fd5aaf3f24dcaac Mon Sep 17 00:00:00 2001 From: Shivam Sourav Jha <60891544+shivamsouravjha@users.noreply.github.com> Date: Sat, 13 Apr 2024 12:53:20 +0530 Subject: [PATCH] add: support of user command (#175) * refactor: moving jacoco download to url * refactor: add logs * refactor:logs * remove:logs Signed-off-by: shivamsouravjha * refactor: passing user command to jsk * refactor: app cmd name --------- Signed-off-by: shivamsouravjha --- v2/src/main/java/io/keploy/Keploy.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/v2/src/main/java/io/keploy/Keploy.java b/v2/src/main/java/io/keploy/Keploy.java index 450d9d7..5aae90c 100644 --- a/v2/src/main/java/io/keploy/Keploy.java +++ b/v2/src/main/java/io/keploy/Keploy.java @@ -29,6 +29,7 @@ public static class RunOptions { private boolean debug; private int port; private String path; + private String appCmd; public RunOptions() { this(10, false, 6789, "."); @@ -73,6 +74,14 @@ public void setDebug(boolean debug) { this.debug = debug; } + public void setappCmd(String appCmd) { + this.appCmd = appCmd; + } + + public String getappCmd() { + return this.appCmd; + } + public int getPort() { return port; } @@ -487,7 +496,6 @@ public RunTestSetResult(boolean success, String error) { } public static void runTests(String jarPath, RunOptions runOptions) { - String runCmd = "java -jar " + jarPath; if (runOptions.getPort() != 0) { serverPort = runOptions.getPort(); @@ -546,12 +554,12 @@ public static void runTests(String jarPath, RunOptions runOptions) { } } // unload the ebpf hooks from the kernel - stopKeploy(); // delete jacoco files - deleteJacocoFiles(); } catch (Exception e) { logger.error("Error occurred while fetching test sets: " + e.getMessage(), e); } + stopKeploy(); + deleteJacocoFiles(); } public static void startKeploy(String runCmd, int delay, boolean debug, int port) { @@ -735,8 +743,6 @@ private static void waitForTestRunCompletion(String testRunId, String testSet, S testRunStatus = Keploy.FetchTestSetStatus(testRunId, testSet); if (testRunStatus == Keploy.TestRunStatus.RUNNING) { - System.out.println("Test run still in progress"); - if (System.currentTimeMillis() - startTime > MAX_TIMEOUT) { System.out.println("Timeout reached, exiting loop"); break;