Skip to content

Commit

Permalink
fix: send unchangedRootComponents to FSS even when deployment fails (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
indougnito authored Sep 22, 2022
1 parent 4163cf9 commit e2c5e13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ void GIVEN_jobs_deployment_WHEN_deployment_fails_with_component_broken_THEN_erro
assertEquals("ThingName", brokenStatusDetails.getThing());
assertEquals(MessageType.PARTIAL, brokenStatusDetails.getMessageType());
assertNull(brokenStatusDetails.getChunkInfo());
assertNull(brokenStatusDetails.getDeploymentInformation().getUnchangedRootComponents());
assertListEquals(Collections.singletonList("CustomerApp"),
brokenStatusDetails.getDeploymentInformation().getUnchangedRootComponents());
assertEquals(OverallStatus.UNHEALTHY, brokenStatusDetails.getOverallStatus());
assertListEquals(Arrays.asList(DeploymentErrorCode.DEPLOYMENT_FAILURE.name(),
DeploymentErrorCode.COMPONENT_UPDATE_ERROR.name(),
Expand Down Expand Up @@ -452,7 +453,8 @@ void GIVEN_local_deployment_WHEN_deployment_fails_with_component_broken_THEN_err
// Last FSS publish request should have info for broken component BrokenRun v1
FleetStatusDetails brokenStatusDetails = fleetStatusDetailsList.get().get(2);
assertEquals("ThingName", brokenStatusDetails.getThing());
assertNull(brokenStatusDetails.getDeploymentInformation().getUnchangedRootComponents());
assertListEquals(Collections.emptyList(),
brokenStatusDetails.getDeploymentInformation().getUnchangedRootComponents());
assertEquals(OverallStatus.UNHEALTHY, brokenStatusDetails.getOverallStatus());
assertEquals(MessageType.PARTIAL, brokenStatusDetails.getMessageType());
assertNull(brokenStatusDetails.getChunkInfo());
Expand Down Expand Up @@ -502,7 +504,8 @@ void GIVEN_local_deployment_WHEN_deployment_fails_with_invalid_component_recipe_
assertEquals(OverallStatus.HEALTHY, fleetStatusDetails.getOverallStatus());
assertEquals(MessageType.PARTIAL, fleetStatusDetails.getMessageType());
assertNull(fleetStatusDetails.getChunkInfo());
assertNull(fleetStatusDetails.getDeploymentInformation().getUnchangedRootComponents());
assertListEquals(Collections.singletonList("AppInvalidRecipe"),
fleetStatusDetails.getDeploymentInformation().getUnchangedRootComponents());
assertNotNull(fleetStatusDetails.getComponentDetails());
// DEPLOYMENT_FAILURE, COMPONENT_PACKAGE_LOADING_ERROR, IO_ERROR, IO_MAPPING_ERROR, RECIPE_PARSE_ERROR
assertListEquals(Arrays.asList(DeploymentErrorCode.DEPLOYMENT_FAILURE.name(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,7 @@ private DeploymentInformation getDeploymentInformation(Map<String, Object> deplo
deploymentInformation.setStatusDetails(statusDetails);
}
// Use unchangedRootComponents to update lastInstallationSource and lastReportedTimestamp in cloud.
// Only update the unchangedRootComponents list if a deployment is successful, because we should not display
// a failed deployment as component's last installation source.
if (deploymentDetails.containsKey(DEPLOYMENT_ROOT_PACKAGES_KEY_NAME)
&& JobStatus.SUCCEEDED.toString().equals(deploymentInformation.getStatus())) {
if (deploymentDetails.containsKey(DEPLOYMENT_ROOT_PACKAGES_KEY_NAME)) {
// Setting the unchangedRootComponents to be the entire list of root packages, and then later
// if a component changed state since last FSS update we will remove it from this list.
deploymentInformation.setUnchangedRootComponents((List<String>) deploymentDetails
Expand Down

0 comments on commit e2c5e13

Please sign in to comment.