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

Fix partial aggregate deployment state #1996

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2017 the original author or authors.
* Copyright 2015-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -146,6 +146,10 @@ public static DeploymentState aggregateState(Set<DeploymentState> states) {
logger.debug("aggregateState: Returning " + DeploymentState.error);
return DeploymentState.error;
}
if (states.contains(DeploymentState.deployed) && states.contains(DeploymentState.failed)) {
logger.debug("aggregateState: Returning " + DeploymentState.partial);
return DeploymentState.partial;
}
if (states.contains(DeploymentState.failed)) {
logger.debug("aggregateState: Returning " + DeploymentState.failed);
return DeploymentState.failed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ public void testDeployWithCommonApplicationProperties() throws Exception {

@Test
public void testAggregateState() {
assertThat(StreamDefinitionController.aggregateState(EnumSet.of(deployed, failed)), is(failed));
assertThat(StreamDefinitionController.aggregateState(EnumSet.of(deployed, failed)), is(partial));
assertThat(StreamDefinitionController.aggregateState(EnumSet.of(unknown, failed)), is(failed));
assertThat(StreamDefinitionController.aggregateState(EnumSet.of(deployed, failed, error)), is(error));
assertThat(StreamDefinitionController.aggregateState(EnumSet.of(deployed, undeployed)), is(partial));
Expand Down