summaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/test/java/com
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2019-03-15 11:10:30 +0100
committerTor Brede Vekterli <vekterli@verizonmedia.com>2019-03-15 13:23:33 +0100
commit1c8c0c815f872347c2ed85e997fbede3e29f3686 (patch)
tree3be1d71d4f012bdf9a5e0d847c04e6142750f2de /clustercontroller-core/src/test/java/com
parent33b3bdca77a0141e4f20185024f8e772209ffbef (diff)
Bind deferred activation decision to concrete bundle instance, not global config
Ensure that deferred activation flags are propagated during building and cloning.
Diffstat (limited to 'clustercontroller-core/src/test/java/com')
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundleTest.java26
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcasterTest.java7
2 files changed, 33 insertions, 0 deletions
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundleTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundleTest.java
index fa802f7fd71..e10694d553f 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundleTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateBundleTest.java
@@ -4,8 +4,11 @@ package com.yahoo.vespa.clustercontroller.core;
import com.yahoo.vdslib.state.*;
import org.junit.Test;
+import java.util.function.Function;
+
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -117,4 +120,27 @@ public class ClusterStateBundleTest {
assertFalse(bundle.deferredActivation());
}
+ @Test
+ public void simple_bundle_without_derived_states_propagates_deferred_activation_flag() {
+ var bundle = ClusterStateBundle
+ .builder(annotatedStateOf("distributor:2 storage:2"))
+ .deferredActivation(false) // defaults to true
+ .deriveAndBuild();
+ assertFalse(bundle.deferredActivation());
+ }
+
+ @Test
+ public void cloning_preserves_false_deferred_activation_flag() {
+ var bundle = createTestBundleBuilder(true).deferredActivation(false).deriveAndBuild();
+ var derived = bundle.cloneWithMapper(Function.identity());
+ assertEquals(bundle, derived);
+ }
+
+ @Test
+ public void cloning_preserves_true_deferred_activation_flag() {
+ var bundle = createTestBundleBuilder(true).deferredActivation(true).deriveAndBuild();
+ var derived = bundle.cloneWithMapper(Function.identity());
+ assertEquals(bundle, derived);
+ }
+
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcasterTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcasterTest.java
index 75b65f5d85f..40175cd7bc9 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcasterTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/SystemStateBroadcasterTest.java
@@ -133,4 +133,11 @@ public class SystemStateBroadcasterTest {
// TODO
}
+
+ /*
+ TODO test
+ - activation not sent before distributors have acked
+ - activation not sent if two phase activation is disabled
+ */
+
}