Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: support of user command #175

Merged
merged 6 commits into from
Apr 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck> reported by reviewdog 🐶
Missing a Javadoc comment.


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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck> reported by reviewdog 🐶
Class 'RunOptions' looks like designed for extension (can be subclassed), but the method 'setappCmd' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'RunOptions' final or making the method 'setappCmd' static/final/abstract/empty, or adding allowed annotation for the method.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck> reported by reviewdog 🐶
Missing a Javadoc comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck> reported by reviewdog 🐶
Parameter appCmd should be final.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck> reported by reviewdog 🐶
'appCmd' hides a field.

this.appCmd = appCmd;
}

public String getappCmd() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck> reported by reviewdog 🐶
Class 'RunOptions' looks like designed for extension (can be subclassed), but the method 'getappCmd' does not have javadoc that explains how to do that safely. If class is not designed for extension consider making the class 'RunOptions' final or making the method 'getappCmd' static/final/abstract/empty, or adding allowed annotation for the method.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck> reported by reviewdog 🐶
Missing a Javadoc comment.

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
Loading