diff options
author | Tor Brede Vekterli <vekterli@yahoo-inc.com> | 2017-10-12 13:26:28 +0200 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahoo-inc.com> | 2017-10-12 13:26:28 +0200 |
commit | 244559a78c4ee8f5d2f69ad8a742304eb1b3c5d9 (patch) | |
tree | a3e54347754b091fc240888fd499fe04f1cc9586 /clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java | |
parent | eb92ec91d4ddcaf25ffd8a08e73addd8846d7ad8 (diff) |
Config-retired should not override explicit Down or Maintenance states
Previously, a config-retired node marked as Down by the Orchestrator
would remain as Retired in the cluster state until the node was
actually taken down entirely.
Diffstat (limited to 'clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java')
-rw-r--r-- | clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java index c0253d8a126..e56d8b02cd4 100644 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java +++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/NodeInfoTest.java @@ -6,6 +6,7 @@ import com.yahoo.vdslib.state.NodeType; import com.yahoo.vdslib.state.State; import org.junit.Test; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -77,4 +78,32 @@ public class NodeInfoTest { assertFalse(nodeInfo.recentlyObservedUnstableDuringInit()); } + @Test + public void down_wanted_state_overrides_config_retired_state() { + ClusterFixture fixture = ClusterFixture.forFlatCluster(3) + .markNodeAsConfigRetired(1) + .proposeStorageNodeWantedState(1, State.DOWN); + + NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1)); + assertEquals(State.DOWN, nodeInfo.getWantedState().getState()); + } + + @Test + public void maintenance_wanted_state_overrides_config_retired_state() { + ClusterFixture fixture = ClusterFixture.forFlatCluster(3) + .markNodeAsConfigRetired(1) + .proposeStorageNodeWantedState(1, State.MAINTENANCE); + + NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1)); + assertEquals(State.MAINTENANCE, nodeInfo.getWantedState().getState()); + } + + @Test + public void retired_state_overrides_default_up_wanted_state() { + final ClusterFixture fixture = ClusterFixture.forFlatCluster(3).markNodeAsConfigRetired(1); + + NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 1)); + assertEquals(State.RETIRED, nodeInfo.getWantedState().getState()); + } + } |