aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-08-29 14:06:41 +0200
committerJon Bratseth <bratseth@oath.com>2018-08-29 14:06:41 +0200
commitff75785574b30677ce17984551328990a991869e (patch)
tree85b7245827d2bc308b597e930bd14c476c5b2497 /container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java
parent89e6983eb08238e4912aeabb7b001ad966cfb23b (diff)
Be down initially
Before ths change containers used to come up in the initial VIP state of up ("in rotation") before having any information about downstream cløusters. This is problematic if the node determines that it should be down when learning the state of downstream clusters, especially when it is determining that it should be down due to failing to complete pings timely due to initialization load. This changes to starting in the down state. Crucially, this requires tracking the current state of clusters in a separate component such that the state survives reconfiguration and we avoid setting the state down briefly on each reconfiguration. In addition to the case where there are downstream clusters deciding the VIP state oif a container, there are two others: - There are no such clusters. In this case the VIP state will be up by default. - Some other component is explicitly deciding the VIP state. This commit makes that case clearer.
Diffstat (limited to 'container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java')
-rw-r--r--container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java b/container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java
index 725f8256ba3..e54f968f41d 100644
--- a/container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java
+++ b/container-core/src/test/java/com/yahoo/container/handler/VipStatusTestCase.java
@@ -13,13 +13,22 @@ import org.junit.Test;
public class VipStatusTestCase {
@Test
- public final void testSmoke() {
+ public void testVipStatusWorksWithClusters() {
+ ClustersStatus clustersStatus = new ClustersStatus();
+ clustersStatus.setContainerHasClusters(true);
+ VipStatus v = new VipStatus(clustersStatus);
+
Object cluster1 = new Object();
Object cluster2 = new Object();
Object cluster3 = new Object();
- VipStatus v = new VipStatus();
+
// initial state
+ assertFalse(v.isInRotation());
+
+ // one cluster becomes up
+ v.addToRotation(cluster1);
assertTrue(v.isInRotation());
+
// all clusters down
v.removeFromRotation(cluster1);
v.removeFromRotation(cluster2);