aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/dispatch
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2023-09-05 14:09:22 +0200
committerjonmv <venstad@gmail.com>2023-09-05 14:09:22 +0200
commitbbcc6e6677aa1d81591b9b9b3f108fc29ab14597 (patch)
tree0c8079bbea023eb37b2b0bd1016ab0c4894dcfc1 /container-search/src/test/java/com/yahoo/search/dispatch
parent05df635cab10d2e312a10e0620a0e6558a4de013 (diff)
Use updated groups when computing VIP status on monitor callbacks
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/dispatch')
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java
index c3ddeac5365..dd0980322c4 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/searchcluster/SearchClusterTest.java
@@ -25,7 +25,10 @@ import java.util.stream.IntStream;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.toMap;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author baldersheim
@@ -155,6 +158,18 @@ public class SearchClusterTest {
}
@Test
+ void requireThatVipStatusWorksWhenReconfiguredFromZeroNodes() {
+ try (State test = new State("test", 2, "a", "b")) {
+ test.clusterMonitor.start();
+ test.searchCluster.updateNodes(List.of(), test.clusterMonitor, 100.0);
+ assertEquals(Set.of(), test.searchCluster.groupList().nodes());
+
+ test.searchCluster.updateNodes(List.of(new Node("test", 0, "a", 0), new Node("test", 1, "b", 0)), test.clusterMonitor, 100.0);
+ assertTrue(test.vipStatus.isInRotation());
+ }
+ }
+
+ @Test
void requireThatVipStatusIsDefaultDownButComesUpAfterPinging() {
try (State test = new State("cluster.1", 2, "a", "b")) {
assertTrue(test.searchCluster.localCorpusDispatchTarget().isEmpty());