use of com.aws.greengrass.deployment.DeploymentStatusKeeper.DEPLOYMENT_STATUS_DETAILS_KEY_NAME in project aws-greengrass-nucleus by aws-greengrass.
the class DeploymentServiceIntegrationTest method GIVEN_cloud_deployment_has_required_capabilities_WHEN_receives_deployment_THEN_fail_with_proper_detailed_status.
@Test
void GIVEN_cloud_deployment_has_required_capabilities_WHEN_receives_deployment_THEN_fail_with_proper_detailed_status() throws Exception {
CountDownLatch cdlDeployRedSignal = new CountDownLatch(1);
Consumer<GreengrassLogMessage> listener = m -> {
if (m.getMessage() != null) {
if (m.getMessage().contains("Current deployment finished") && m.getContexts().get("DeploymentId").equals("deployRedSignal")) {
cdlDeployRedSignal.countDown();
}
}
};
CountDownLatch deploymentCDL = new CountDownLatch(1);
DeploymentStatusKeeper deploymentStatusKeeper = kernel.getContext().get(DeploymentStatusKeeper.class);
deploymentStatusKeeper.registerDeploymentStatusConsumer(DeploymentType.SHADOW, (status) -> {
if (status.get(DEPLOYMENT_ID_KEY_NAME).equals("deployRedSignal") && status.get(DEPLOYMENT_STATUS_KEY_NAME).equals("FAILED")) {
deploymentCDL.countDown();
assertThat(((Map) status.get(DEPLOYMENT_STATUS_DETAILS_KEY_NAME)).get(DEPLOYMENT_FAILURE_CAUSE_KEY), equalTo("The current nucleus version doesn't support one or more capabilities that are required by " + "this deployment: ANOTHER_CAPABILITY"));
}
return true;
}, "dummy");
try (AutoCloseable l = TestUtils.createCloseableLogListener(listener)) {
submitSampleJobDocument(DeploymentServiceIntegrationTest.class.getResource("FleetConfigWithRequiredCapability.json").toURI(), "deployRedSignal", DeploymentType.SHADOW);
assertTrue(cdlDeployRedSignal.await(30, TimeUnit.SECONDS));
assertTrue(deploymentCDL.await(10, TimeUnit.SECONDS));
}
}
Aggregations