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 timeout for cmd deleting dsci #110

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
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
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
Loading