aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java')
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java43
1 files changed, 20 insertions, 23 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java
index 42df2a829e3..715154e85ba 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java
@@ -12,17 +12,14 @@ import com.yahoo.search.dispatch.searchcluster.PingFactory;
import com.yahoo.search.dispatch.searchcluster.Pinger;
import com.yahoo.search.dispatch.searchcluster.PongHandler;
import com.yahoo.search.dispatch.searchcluster.SearchCluster;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import static com.yahoo.search.dispatch.MockSearchCluster.createDispatchConfig;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author ollivir
@@ -30,7 +27,7 @@ import static org.junit.Assert.fail;
public class DispatcherTest {
@Test
- public void requireThatDispatcherSupportsSearchPath() {
+ void requireThatDispatcherSupportsSearchPath() {
SearchCluster cl = new MockSearchCluster("1", 2, 2);
Query q = new Query();
q.getModel().setSearchPath("1/0"); // second node in first group
@@ -46,7 +43,7 @@ public class DispatcherTest {
}
@Test
- public void requireThatDispatcherSupportsSingleNodeDirectDispatch() {
+ void requireThatDispatcherSupportsSingleNodeDirectDispatch() {
SearchCluster cl = new MockSearchCluster("1", 0, 0) {
@Override
public Optional<Node> localCorpusDispatchTarget() {
@@ -61,7 +58,7 @@ public class DispatcherTest {
}
@Test
- public void requireThatInvokerConstructionIsRetriedAndLastAcceptsAnyCoverage() {
+ void requireThatInvokerConstructionIsRetriedAndLastAcceptsAnyCoverage() {
SearchCluster cl = new MockSearchCluster("1", 2, 1);
MockInvokerFactory invokerFactory = new MockInvokerFactory(cl, (n, acceptIncompleteCoverage) -> {
@@ -78,7 +75,7 @@ public class DispatcherTest {
}
@Test
- public void requireThatInvokerConstructionDoesNotRepeatGroups() {
+ void requireThatInvokerConstructionDoesNotRepeatGroups() {
try {
SearchCluster cl = new MockSearchCluster("1", 2, 1);
@@ -94,49 +91,49 @@ public class DispatcherTest {
}
@Test
- public void testGroup0IsSelected() {
+ void testGroup0IsSelected() {
SearchCluster cluster = new MockSearchCluster("1", 3, 1);
Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true), new MockMetric());
cluster.pingIterationCompleted();
assertEquals(0,
- dispatcher.getSearchInvoker(new Query(), null).distributionKey().get().longValue());
+ dispatcher.getSearchInvoker(new Query(), null).distributionKey().get().longValue());
dispatcher.deconstruct();
}
@Test
- public void testGroup0IsSkippedWhenItIsBlockingFeed() {
+ void testGroup0IsSkippedWhenItIsBlockingFeed() {
SearchCluster cluster = new MockSearchCluster("1", 3, 1);
Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true), new MockMetric());
cluster.group(0).get().nodes().get(0).setBlockingWrites(true);
cluster.pingIterationCompleted();
- assertEquals("Blocking group is avoided",
- 1,
- (dispatcher.getSearchInvoker(new Query(), null).distributionKey().get()).longValue());
+ assertEquals(1,
+ (dispatcher.getSearchInvoker(new Query(), null).distributionKey().get()).longValue(),
+ "Blocking group is avoided");
dispatcher.deconstruct();
}
@Test
- public void testGroup0IsSelectedWhenMoreAreBlockingFeed() {
+ void testGroup0IsSelectedWhenMoreAreBlockingFeed() {
SearchCluster cluster = new MockSearchCluster("1", 3, 1);
Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true), new MockMetric());
cluster.group(0).get().nodes().get(0).setBlockingWrites(true);
cluster.group(1).get().nodes().get(0).setBlockingWrites(true);
cluster.pingIterationCompleted();
- assertEquals("Blocking group is used when multiple groups are blocking",
- 0,
- dispatcher.getSearchInvoker(new Query(), null).distributionKey().get().longValue());
+ assertEquals(0,
+ dispatcher.getSearchInvoker(new Query(), null).distributionKey().get().longValue(),
+ "Blocking group is used when multiple groups are blocking");
dispatcher.deconstruct();
}
@Test
- public void testGroup0IsSelectedWhenItIsBlockingFeedWhenNoOthers() {
+ void testGroup0IsSelectedWhenItIsBlockingFeedWhenNoOthers() {
SearchCluster cluster = new MockSearchCluster("1", 1, 1);
Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true), new MockMetric());
cluster.group(0).get().nodes().get(0).setBlockingWrites(true);
cluster.pingIterationCompleted();
- assertEquals("Blocking group is used when there is no alternative",
- 0,
- (dispatcher.getSearchInvoker(new Query(), null).distributionKey().get()).longValue());
+ assertEquals(0,
+ (dispatcher.getSearchInvoker(new Query(), null).distributionKey().get()).longValue(),
+ "Blocking group is used when there is no alternative");
dispatcher.deconstruct();
}