Skip to content

Commit

Permalink
Add timeout for cmd deleting dsci (#110)
Browse files Browse the repository at this point in the history
Signed-off-by: David Kornel <[email protected]>
  • Loading branch information
kornys authored Feb 28, 2024
1 parent 26dfbd2 commit a69568d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/io/odh/test/platform/KubeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void clearOdhRemainingResources() {
*/
public static void deleteDefaultDSCI() {
LOGGER.info("Clearing DSCI ...");
ResourceManager.getKubeCmdClient().exec(false, "delete", "dsci", "--all");
ResourceManager.getKubeCmdClient().exec(false, true, Long.valueOf(TestConstants.GLOBAL_TIMEOUT).intValue(), "delete", "dsci", "--all");
}

public static void waitForInstallPlan(String namespace, String csvName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ public ExecResult exec(boolean throwError, boolean logToOutput, String... comman
return Exec.exec(null, cmd, 0, logToOutput, throwError);
}

@Override
public ExecResult exec(boolean throwError, boolean logToOutput, int timeout, String... command) {
List<String> cmd = command(asList(command), false);
return Exec.exec(null, cmd, timeout, logToOutput, throwError);
}

@Override
public ExecResult execInCurrentNamespace(String... commands) {
return Exec.exec(namespacedCommand(commands));
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/io/odh/test/platform/cmdClient/KubeCmdClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ default K delete(String... files) {
*/
ExecResult exec(boolean throwError, boolean logToOutput, String... command);

/**
* Execute the given {@code command}. You can specify if potential failure will thrown the exception or not.
*
* @param throwError parameter which control thrown exception in case of failure
* @param command The command
* @param timeout tiemout in ms
* @param logToOutput determines if we want to print whole output of command
* @return The process result.
*/
ExecResult exec(boolean throwError, boolean logToOutput, int timeout, String... command);

/**
* Get the content of the given {@code resource} with the given {@code name} as YAML.
*
Expand Down

0 comments on commit a69568d

Please sign in to comment.