summaryrefslogtreecommitdiffstats
path: root/documentapi
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-02-22 10:31:01 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-02-22 10:31:01 +0100
commitdc6f7e51c995ccc266fe9210b6358a0b0fc0f6b4 (patch)
treec9374112881796a6a03f358fd627a3ae60bee798 /documentapi
parent046dbbf99f17b2c50abab59edbc614391f9f3160 (diff)
Use fewer services in policy subset test
Diffstat (limited to 'documentapi')
-rwxr-xr-xdocumentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestCase.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestCase.java
index c054ec860ca..0aa5000b22a 100755
--- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestCase.java
+++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestCase.java
@@ -452,11 +452,12 @@ public class PolicyTestCase {
PolicyTestFrame frame = new PolicyTestFrame("docproc/cluster.default", manager);
frame.setMessage(new PutDocumentMessage(new DocumentPut(new DocumentPut(new Document(manager.getDocumentType("testdoc"),
new DocumentId("id:ns:testdoc::"))))));
+ int numberOfServices = 4;
- // Test requerying for adding nodes.
+ // Test re-querying for adding nodes.
frame.setHop(new HopSpec("test", "docproc/cluster.default/[SubsetService:2]/chain.default"));
Set<String> lst = new HashSet<>();
- for (int i = 1; i <= 10; ++i) {
+ for (int i = 1; i <= numberOfServices; ++i) {
frame.getNetwork().registerSession(i + "/chain.default");
assertTrue(frame.waitSlobrok("docproc/cluster.default/*/chain.default", i));
@@ -465,11 +466,11 @@ public class PolicyTestCase {
leaf.handleReply(new EmptyReply());
assertNotNull(frame.getReceptor().getReply(TIMEOUT));
}
- assertTrue(lst.size() > 1); // must have requeried
+ assertTrue(lst.size() > 1); // must have re-queried
// Test load balancing.
String prev = null;
- for (int i = 1; i <= 10; ++i) {
+ for (int i = 1; i <= numberOfServices; ++i) {
RoutingNode leaf = frame.select(1).get(0);
String next = leaf.getRoute().toString();
if (prev == null) {
@@ -482,25 +483,25 @@ public class PolicyTestCase {
assertNotNull(frame.getReceptor().getReply(TIMEOUT));
}
- // Test requerying for dropping nodes.
+ // Test re-querying for dropping nodes.
lst.clear();
- for (int i = 1; i <= 10; ++i) {
+ for (int i = 1; i <= numberOfServices; ++i) {
RoutingNode leaf = frame.select(1).get(0);
String route = leaf.getRoute().toString();
lst.add(route);
frame.getNetwork().unregisterSession(route.substring(frame.getIdentity().length() + 1));
- assertTrue(frame.waitSlobrok("docproc/cluster.default/*/chain.default", 10 - i));
+ assertTrue(frame.waitSlobrok("docproc/cluster.default/*/chain.default", numberOfServices - i));
Reply reply = new EmptyReply();
reply.addError(new Error(ErrorCode.NO_ADDRESS_FOR_SERVICE, route));
leaf.handleReply(reply);
assertNotNull(frame.getReceptor().getReply(TIMEOUT));
}
- assertEquals(10, lst.size());
+ assertEquals(numberOfServices, lst.size());
// Test merge behavior.
- frame.setHop(new HopSpec("test", "[SubsetService]"));
+ frame.setHop(new HopSpec("test", "[SubsetService:2]"));
frame.assertMergeOneReply("*");
frame.destroy();