out.println(Json.asPrettyStringUnchecked(status)); } else { final JobId jobId = status.getDeploymentGroup().getJobId(); final String error = status.getError(); final List<HostSelector> hostSelectors = status.getDeploymentGroup().getHostSelectors(); out.printf("Status: %s%n", status.getStatus()); out.printf("Host selectors:%n"); for (final HostSelector hostSelector : hostSelectors) { printTable(out, jobId, status.getHostStatuses(), full);
return Response.ok(new DeploymentGroupStatusResponse( deploymentGroup, status, error, result, deploymentGroupStatus)).build(); } catch (final DeploymentGroupDoesNotExistException e) {
@Override public DeploymentGroupStatus call() throws Exception { final DeploymentGroupStatusResponse response = getOrNull( client.deploymentGroupStatus(name)); if (response != null) { final DeploymentGroupStatus status = response.getDeploymentGroupStatus(); final DeploymentGroupStatus.State actual = status.getState(); // The deployment group failed when we did not expect it to. if (actual == FAILED && actual != expected) { throw new AssertionError("Deployment group " + name + " failed unexpectedly: " + status.getError()); } // The deployment group reached our desired status. if (actual == expected) { return status; } } return null; } });
@Test public void testStopDeploymentGroup() throws Exception { cli("create-deployment-group", "--json", TEST_GROUP, "foo=bar", "baz=qux"); cli("create", "my_job:2", "my_image"); assertThat(cli("stop-deployment-group", TEST_GROUP), containsString("Deployment-group my_group stopped")); final DeploymentGroupStatusResponse status = Json.read( cli("deployment-group-status", "--json", TEST_GROUP), DeploymentGroupStatusResponse.class); assertEquals(DeploymentGroupStatusResponse.Status.FAILED, status.getStatus()); assertEquals("Stopped by user", status.getError()); }
@Test public void testStatusNoRollingUpdate() throws Exception { cli("create-deployment-group", "--json", TEST_GROUP, "foo=bar", "baz=qux"); assertEquals(DeploymentGroupStatusResponse.Status.IDLE, OBJECT_MAPPER.readValue(cli("deployment-group-status", "--json", TEST_GROUP), DeploymentGroupStatusResponse.class).getStatus()); }
if (!jobId.equals(status.getDeploymentGroup().getJobId())) { for (final DeploymentGroupStatusResponse.HostStatus hostStatus : status.getHostStatuses()) { final JobId hostJobId = hostStatus.getJobId(); final String host = hostStatus.getHost(); reported.size(), status.getHostStatuses().size())); if (status.getStatus() != DeploymentGroupStatusResponse.Status.ROLLING_OUT) { if (status.getStatus() == DeploymentGroupStatusResponse.Status.FAILED) { failed = true; error = status.getError();
return Response.ok(new DeploymentGroupStatusResponse( deploymentGroup, status, error, result, deploymentGroupStatus)).build(); } catch (final DeploymentGroupDoesNotExistException e) {
out.println(Json.asPrettyStringUnchecked(status)); } else { final JobId jobId = status.getDeploymentGroup().getJobId(); final String error = status.getError(); final List<HostSelector> hostSelectors = status.getDeploymentGroup().getHostSelectors(); out.printf("Status: %s%n", status.getStatus()); out.printf("Host selectors:%n"); for (final HostSelector hostSelector : hostSelectors) { printTable(out, jobId, status.getHostStatuses(), full);
if (!jobId.equals(status.getDeploymentGroup().getJobId())) { for (DeploymentGroupStatusResponse.HostStatus hostStatus : status.getHostStatuses()) { final JobId hostJobId = hostStatus.getJobId(); final String host = hostStatus.getHost(); reported.size(), status.getHostStatuses().size())); if (status.getStatus() != DeploymentGroupStatusResponse.Status.ROLLING_OUT) { if (status.getStatus() == DeploymentGroupStatusResponse.Status.FAILED) { failed = true; error = status.getError();