Skip to content

Commit

Permalink
add: support of user command (#175)
Browse files Browse the repository at this point in the history
* refactor:  moving jacoco download to url

* refactor: add logs

* refactor:logs

* remove:logs

Signed-off-by: shivamsouravjha <shivamsouravjha@gmail.com>

* refactor: passing user command to jsk

* refactor: app cmd name

---------

Signed-off-by: shivamsouravjha <shivamsouravjha@gmail.com>
  • Loading branch information
shivamsouravjha authored Apr 13, 2024
1 parent bfa899b commit c514956
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions v2/src/main/java/io/keploy/Keploy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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, ".");
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c514956

Please sign in to comment.