Skip to content

Commit

Permalink
fix(deployment): propagate interrupt from list groups operation (#1554)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosentino11 authored Jul 17, 2024
1 parent 6bd81f5 commit f225de5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public DeploymentResult call() throws InterruptedException {
}
}

@SuppressWarnings({"PMD.AvoidCatchingGenericException"})
@SuppressWarnings({"PMD.AvoidCatchingGenericException", "PMD.AvoidRethrowingException"})
private Map<String, Set<ComponentRequirementIdentifier>> getNonTargetGroupToRootPackagesMap(
DeploymentDocument deploymentDocument)
throws DeploymentTaskFailureException, InterruptedException {
Expand All @@ -208,6 +208,8 @@ private Map<String, Set<ComponentRequirementIdentifier>> getNonTargetGroupToRoot
} else {
throw new DeploymentTaskFailureException("Error fetching thing group information", e);
}
} catch (InterruptedException e) {
throw e;
} catch (Exception e) {
if (isLocalDeployment && ThingGroupHelper.RETRYABLE_EXCEPTIONS.contains(e.getClass())) {
logger.atWarn().setCause(e).log("Failed to get thing group hierarchy, local deployment will proceed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ void GIVEN_deploymentDocument_WHEN_thingGroupHelper_throws_error_THEN_deployment
assertEquals("Error fetching thing group information. Original error message", failureMessage);
}

@Test
void GIVEN_deploymentDocument_WHEN_thingGroupHelper_interrupted_THEN_deployment_task_interrupted() throws Exception {
when(mockThingGroupHelper.listThingGroupsForDevice(anyInt())).thenThrow(InterruptedException.class);
assertThrows(InterruptedException.class, deploymentTask::call);
}

@Test
void GIVEN_deploymentDocument_WHEN_resolveDependencies_errored_THEN_deploymentTask_aborted(ExtensionContext context)
throws Exception {
Expand Down

0 comments on commit f225de5

Please sign in to comment.