-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix: retry gg local cli deployment status command in case of exceptions #199
Conversation
Unit Tests Coverage Report for aws-greengrass-testing-features
Minimum allowed coverage is Generated by 🐒 cobertura-action against 0256d26 |
Unit Tests Coverage Report for aws-greengrass-testing-launcher
Minimum allowed coverage is Generated by 🐒 cobertura-action against 0256d26 |
Unit Tests Coverage Report for aws-greengrass-testing-platform-api
Minimum allowed coverage is Generated by 🐒 cobertura-action against 0256d26 |
Unit Tests Coverage Report for aws-greengrass-testing-platform-pillbox
Minimum allowed coverage is Generated by 🐒 cobertura-action against 0256d26 |
try { | ||
String deploymentId = scenarioContext.get(LOCAL_DEPLOYMENT_ID); | ||
String response = platform.commands().executeToString(CommandInput.builder() | ||
.line(testContext.installRoot().resolve("bin").resolve("greengrass-cli").toString()) | ||
.addAllArgs(Arrays.asList("deployment", "status", "--deploymentId", deploymentId)) | ||
.build()); | ||
LOGGER.debug(String.format("deployment status response received for deployment ID %s is %s", | ||
deploymentId, response)); | ||
String[] responseArray = response.split(":"); | ||
return responseArray[responseArray.length - 1].trim(); | ||
} catch (CommandExecutionException e) { | ||
LOGGER.info("Exception occurred while getting the deployment status. Will try again", e); | ||
} | ||
return ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is it retrying? Once it enters catch block it will print the statement and exit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command is retried in the following condition since ""
in not one of the terminal statuses (FAILED/SUCCEEDED).
Line 94 in 0256d26
waitSteps.untilTerminal(() -> this.getLocalDeploymentStatus(), status::equals, |
Issue #, if available:
Description of changes:
Sometimes, GG throws access denied exceptions such as the following, when Greengrass local cli command is run.
This change ignores such exceptions and retries the command until it is succeeded.
Why is this change necessary:
How was this change tested:
Any additional information or context required to review the change:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.