aboutsummaryrefslogtreecommitdiffstats
path: root/configserver/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'configserver/src/test')
-rw-r--r--configserver/src/test/apps/app-with-multiple-clusters/hosts.xml7
-rw-r--r--configserver/src/test/apps/app-with-multiple-clusters/schemas/bar.sd14
-rw-r--r--configserver/src/test/apps/app-with-multiple-clusters/schemas/bax.sd10
-rw-r--r--configserver/src/test/apps/app-with-multiple-clusters/schemas/baz.sd10
-rw-r--r--configserver/src/test/apps/app-with-multiple-clusters/services.xml33
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java59
6 files changed, 106 insertions, 27 deletions
diff --git a/configserver/src/test/apps/app-with-multiple-clusters/hosts.xml b/configserver/src/test/apps/app-with-multiple-clusters/hosts.xml
new file mode 100644
index 00000000000..f4256c9fc81
--- /dev/null
+++ b/configserver/src/test/apps/app-with-multiple-clusters/hosts.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<hosts>
+ <host name="mytesthost">
+ <alias>node1</alias>
+ </host>
+</hosts>
diff --git a/configserver/src/test/apps/app-with-multiple-clusters/schemas/bar.sd b/configserver/src/test/apps/app-with-multiple-clusters/schemas/bar.sd
new file mode 100644
index 00000000000..b66695b17df
--- /dev/null
+++ b/configserver/src/test/apps/app-with-multiple-clusters/schemas/bar.sd
@@ -0,0 +1,14 @@
+# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+search bar {
+
+ field zoo type string {
+ indexing: input moo | index | summary
+ }
+
+ document bar {
+ field moo type string {
+ indexing: summary | attribute
+ }
+ }
+
+} \ No newline at end of file
diff --git a/configserver/src/test/apps/app-with-multiple-clusters/schemas/bax.sd b/configserver/src/test/apps/app-with-multiple-clusters/schemas/bax.sd
new file mode 100644
index 00000000000..f9f6aba766e
--- /dev/null
+++ b/configserver/src/test/apps/app-with-multiple-clusters/schemas/bax.sd
@@ -0,0 +1,10 @@
+# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+search bax {
+
+ document bax {
+ field moo type string {
+ indexing: summary | attribute
+ }
+ }
+
+} \ No newline at end of file
diff --git a/configserver/src/test/apps/app-with-multiple-clusters/schemas/baz.sd b/configserver/src/test/apps/app-with-multiple-clusters/schemas/baz.sd
new file mode 100644
index 00000000000..58f0aa16fd0
--- /dev/null
+++ b/configserver/src/test/apps/app-with-multiple-clusters/schemas/baz.sd
@@ -0,0 +1,10 @@
+# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+search baz {
+
+ document baz {
+ field moo type string {
+ indexing: summary | attribute
+ }
+ }
+
+} \ No newline at end of file
diff --git a/configserver/src/test/apps/app-with-multiple-clusters/services.xml b/configserver/src/test/apps/app-with-multiple-clusters/services.xml
new file mode 100644
index 00000000000..735bd04b2f9
--- /dev/null
+++ b/configserver/src/test/apps/app-with-multiple-clusters/services.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright 2020 Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<services version="1.0">
+
+ <content id="foo" version="1.0">
+ <redundancy>2</redundancy>
+ <documents>
+ <document type="bar" mode="index"/>
+ <document type="baz" mode="streaming"/>
+ <document type="bax" mode="index"/>
+ </documents>
+ <nodes>
+ <node hostalias="node1" distribution-key="0"/>
+ </nodes>
+ </content>
+
+ <content id="boo" version="1.0">
+ <redundancy>2</redundancy>
+ <documents>
+ <document type="bar" mode="store-only"/>
+ </documents>
+ <nodes>
+ <node hostalias="node1" distribution-key="1"/>
+ </nodes>
+ </content>
+
+ <container version="1.0">
+ <nodes>
+ <node hostalias="node1" />
+ </nodes>
+ </container>
+
+</services>
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
index f9b33791a36..60683b96f07 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
@@ -77,6 +77,7 @@ import static org.mockito.Mockito.when;
public class ApplicationHandlerTest {
private static final File testApp = new File("src/test/apps/app");
+ private static final File testAppMultipleClusters = new File("src/test/apps/app-with-multiple-clusters");
private static final File testAppJdiscOnly = new File("src/test/apps/app-jdisc-only");
private final static TenantName mytenantName = TenantName.from("mytenant");
@@ -215,42 +216,55 @@ public class ApplicationHandlerTest {
ApplicationCuratorDatabase database = applicationRepository.getTenant(applicationId).getApplicationRepo().database();
reindexing(applicationId, GET, "{\"error-code\": \"NOT_FOUND\", \"message\": \"Reindexing status not found for default.default\"}", 404);
- applicationRepository.deploy(testApp, prepareParams(applicationId));
+ applicationRepository.deploy(testAppMultipleClusters, prepareParams(applicationId));
ApplicationReindexing expected = ApplicationReindexing.ready(clock.instant());
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
clock.advance(Duration.ofSeconds(1));
- reindex(applicationId, "", "{\"message\":\"Reindexing application default.default\"}");
- expected = expected.withReady(clock.instant());
+ reindex(applicationId, "", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar, bax, baz] in 'foo' of application default.default\"}");
+ expected = expected.withReady("boo", "bar", clock.instant())
+ .withReady("foo", "bar", clock.instant())
+ .withReady("foo", "baz", clock.instant())
+ .withReady("foo", "bax", clock.instant());
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
clock.advance(Duration.ofSeconds(1));
- expected = expected.withReady(clock.instant());
- reindex(applicationId, "?clusterId=", "{\"message\":\"Reindexing application default.default\"}");
+ reindex(applicationId, "?indexedOnly=true", "{\"message\":\"Reindexing document types [bar] in 'foo' of application default.default\"}");
+ expected = expected.withReady("foo", "bar", clock.instant());
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
clock.advance(Duration.ofSeconds(1));
- expected = expected.withReady(clock.instant());
- reindex(applicationId, "?documentType=moo", "{\"message\":\"Reindexing application default.default\"}");
+ expected = expected.withReady("boo", "bar", clock.instant())
+ .withReady("foo", "bar", clock.instant())
+ .withReady("foo", "baz", clock.instant())
+ .withReady("foo", "bax", clock.instant());
+ reindex(applicationId, "?clusterId=", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar, bax, baz] in 'foo' of application default.default\"}");
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
clock.advance(Duration.ofSeconds(1));
- reindex(applicationId, "?clusterId=foo,boo", "{\"message\":\"Reindexing clusters foo, boo of application default.default\"}");
- expected = expected.withReady("foo", clock.instant())
- .withReady("boo", clock.instant());
+ expected = expected.withReady("boo", "bar", clock.instant())
+ .withReady("foo", "bar", clock.instant());
+ reindex(applicationId, "?documentType=bar", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar] in 'foo' of application default.default\"}");
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
clock.advance(Duration.ofSeconds(1));
- reindex(applicationId, "?clusterId=foo,boo&documentType=bar,baz", "{\"message\":\"Reindexing document types bar, baz in clusters foo, boo of application default.default\"}");
- expected = expected.withReady("foo", "bar", clock.instant())
+ reindex(applicationId, "?clusterId=foo,boo", "{\"message\":\"Reindexing document types [bar] in 'boo', [bar, bax, baz] in 'foo' of application default.default\"}");
+ expected = expected.withReady("boo", "bar", clock.instant())
+ .withReady("foo", "bar", clock.instant())
.withReady("foo", "baz", clock.instant())
- .withReady("boo", "bar", clock.instant())
- .withReady("boo", "baz", clock.instant());
+ .withReady("foo", "bax", clock.instant());
+ assertEquals(expected,
+ database.readReindexingStatus(applicationId).orElseThrow());
+
+ clock.advance(Duration.ofSeconds(1));
+ reindex(applicationId, "?clusterId=foo&documentType=bar,baz", "{\"message\":\"Reindexing document types [bar, baz] in 'foo' of application default.default\"}");
+ expected = expected.withReady("foo", "bar", clock.instant())
+ .withReady("foo", "baz", clock.instant());
assertEquals(expected,
database.readReindexingStatus(applicationId).orElseThrow());
@@ -269,35 +283,26 @@ public class ApplicationHandlerTest {
long now = clock.instant().toEpochMilli();
reindexing(applicationId, GET, "{" +
" \"enabled\": true," +
- " \"status\": {" +
- " \"readyMillis\": " + (now - 2000) +
- " }," +
" \"clusters\": {" +
" \"boo\": {" +
- " \"status\": {" +
- " \"readyMillis\": " + (now - 1000) +
- " }," +
" \"pending\": {" +
" \"bar\": 123" +
" }," +
" \"ready\": {" +
" \"bar\": {" +
- " \"readyMillis\": " + now +
+ " \"readyMillis\": " + (now - 1000) +
" }," +
- " \"baz\": {" +
- " \"readyMillis\": " + now +
- " }" +
" }" +
" }," +
" \"foo\": {" +
- " \"status\": {" +
- " \"readyMillis\": " + (now - 1000) +
- " }," +
" \"pending\": {}," +
" \"ready\": {" +
" \"bar\": {" +
" \"readyMillis\": " + now +
" }," +
+ " \"bax\": {" +
+ " \"readyMillis\": " + (now - 1000) +
+ " }," +
" \"baz\": {" +
" \"readyMillis\": " + now +
" }" +