Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 7f6380d

Browse files
committed
Fix partial aggregate deployment state
- If the stream has at least one of the apps successfully deployed but at least one of the apps has failed, then the aggregate state needs to be set to `partital` instead of `failed` - This state will show the appropriate status description as: `In the case of multiple apps, some have successfully deployed, while others have not` Resolves #1974
1 parent 9899605 commit 7f6380d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/controller/StreamDefinitionController.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -146,6 +146,10 @@ public static DeploymentState aggregateState(Set<DeploymentState> states) {
146146
logger.debug("aggregateState: Returning " + DeploymentState.error);
147147
return DeploymentState.error;
148148
}
149+
if (states.contains(DeploymentState.deployed) && states.contains(DeploymentState.failed)) {
150+
logger.debug("aggregateState: Returning " + DeploymentState.partial);
151+
return DeploymentState.partial;
152+
}
149153
if (states.contains(DeploymentState.failed)) {
150154
logger.debug("aggregateState: Returning " + DeploymentState.failed);
151155
return DeploymentState.failed;

spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/controller/StreamControllerTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ public void testDeployWithCommonApplicationProperties() throws Exception {
889889

890890
@Test
891891
public void testAggregateState() {
892-
assertThat(StreamDefinitionController.aggregateState(EnumSet.of(deployed, failed)), is(failed));
892+
assertThat(StreamDefinitionController.aggregateState(EnumSet.of(deployed, failed)), is(partial));
893893
assertThat(StreamDefinitionController.aggregateState(EnumSet.of(unknown, failed)), is(failed));
894894
assertThat(StreamDefinitionController.aggregateState(EnumSet.of(deployed, failed, error)), is(error));
895895
assertThat(StreamDefinitionController.aggregateState(EnumSet.of(deployed, undeployed)), is(partial));

0 commit comments

Comments
 (0)