aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository/src/test/java/com/yahoo/vespa
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-04-26 18:48:54 +0200
committerJon Bratseth <bratseth@gmail.com>2020-04-26 18:48:54 +0200
commit30ecdbb7ea88f17d24875e18ac45fe662610de77 (patch)
tree142c99db9f2da29cdf134d35453cb5cb6f8dfce8 /node-repository/src/test/java/com/yahoo/vespa
parent1ea6410fd642bb92a03b5798387fa977286af167 (diff)
Cleanup naming and locations
Diffstat (limited to 'node-repository/src/test/java/com/yahoo/vespa')
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/LoadBalancersV1ApiTest.java30
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodeSerializerTest.java (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodeSerializerTest.java)5
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/RestApiTest.java)470
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/RestApiTester.java96
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-config-server.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/acl-config-server.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-tenant-node.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/acl-tenant-node.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/active-nodes.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/active-nodes.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application1.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/application1.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application2-nodes.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/application2-nodes.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application2.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/application2.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/applications.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/applications.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/capacity-hostremoval-impossible.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/capacity-hostremoval-impossible.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/capacity-hostremoval-possible.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/capacity-hostremoval-possible.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/capacity-zone.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/capacity-zone.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg1.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/cfg1.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg2.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/cfg2.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/child-nodes.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/child-nodes.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/content-nodes.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/content-nodes.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/controller1.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/controller1.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-container1.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-container1.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node1-os-upgrade-complete.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node1-os-upgrade-complete.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node1-os-upgrade.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node1-os-upgrade.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node1.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node1.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node2.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node2.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node3.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node3.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node4.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node4.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node5.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node5.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/dockerhost1-with-firmware-data.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/dockerhost1-with-firmware-data.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/flags1.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/flags1.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/flags2.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/flags2.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/load-balancers-single.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/load-balancers-single.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/load-balancers.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/load-balancers.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/maintenance.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/maintenance.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node1.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node1.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node10.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node10.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node11.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node11.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node13.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node13.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node14.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node14.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node2.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node2.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node3.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node3.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node4-after-changes.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node4-after-changes.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node4.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node4.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5-after-changes.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node5-after-changes.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node5.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node55.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node55.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-after-changes.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-after-changes.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-reports-2.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports-2.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-reports-3.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports-3.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-reports.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node7.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node7.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node8.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node8.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node9.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node9.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/nodes-recursive.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/nodes-recursive.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/nodes.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/nodes.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/parent1.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/parent1.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/parent2.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/parent2.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/root.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/root.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/states-recursive.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/states-recursive.json)0
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/states.json (renamed from node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/states.json)0
60 files changed, 334 insertions, 267 deletions
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/LoadBalancersV1ApiTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/LoadBalancersV1ApiTest.java
new file mode 100644
index 00000000000..e9811985b7d
--- /dev/null
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/LoadBalancersV1ApiTest.java
@@ -0,0 +1,30 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.provision.restapi;
+
+import com.yahoo.application.container.handler.Request;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoadBalancersV1ApiTest {
+
+ private RestApiTester tester;
+
+ @Before
+ public void createTester() {
+ tester = new RestApiTester();
+ }
+
+ @After
+ public void closeTester() {
+ tester.close();
+ }
+
+ @Test
+ public void test_load_balancers() throws Exception {
+ tester.assertFile(new Request("http://localhost:8080/loadbalancers/v1/"), "load-balancers.json");
+ tester.assertFile(new Request("http://localhost:8080/loadbalancers/v1/?application=tenant4.application4.instance4"), "load-balancers-single.json");
+ tester.assertResponse(new Request("http://localhost:8080/loadbalancers/v1/?application=tenant.nonexistent.default"), "{\"loadBalancers\":[]}");
+ }
+
+}
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodeSerializerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodeSerializerTest.java
index ed2aae64b5f..9bc27c0cc04 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodeSerializerTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodeSerializerTest.java
@@ -1,9 +1,10 @@
-// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.hosted.provision.restapi.v2;
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.provision.restapi;
import com.yahoo.config.provision.NodeType;
import com.yahoo.vespa.hosted.provision.Node;
+import com.yahoo.vespa.hosted.provision.restapi.NodeSerializer;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/RestApiTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java
index 838a39ba01e..3e23b424675 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/RestApiTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/NodesV2ApiTest.java
@@ -1,5 +1,5 @@
-// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.hosted.provision.restapi.v2;
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.provision.restapi;
import com.yahoo.application.Networking;
import com.yahoo.application.container.JDisc;
@@ -40,20 +40,18 @@ import static org.junit.Assert.assertFalse;
*
* @author bratseth
*/
-public class RestApiTest {
+public class NodesV2ApiTest {
- private final static String responsesPath = "src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/";
-
- private JDisc container;
+ private RestApiTester tester;
@Before
- public void startContainer() {
- container = JDisc.fromServicesXml(ContainerConfig.servicesXmlV2(0), Networking.disable);
+ public void createTester() {
+ tester = new RestApiTester();
}
@After
- public void stopContainer() {
- if (container != null) container.close();
+ public void closeTester() {
+ tester.close();
}
/** This test gives examples of the node requests that can be made to nodes/v2 */
@@ -82,8 +80,8 @@ public class RestApiTest {
new byte[0], Request.Method.POST));
assertRestart(11, new Request("http://localhost:8080/nodes/v2/command/restart",
new byte[0], Request.Method.POST));
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/host2.yahoo.com"),
- "\"restartGeneration\":3");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/host2.yahoo.com"),
+ "\"restartGeneration\":3");
// POST reboot command
assertReboot(12, new Request("http://localhost:8080/nodes/v2/command/reboot?state=failed%20active",
@@ -92,28 +90,28 @@ public class RestApiTest {
new byte[0], Request.Method.POST));
assertReboot(19, new Request("http://localhost:8080/nodes/v2/command/reboot",
new byte[0], Request.Method.POST));
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/host2.yahoo.com"),
- "\"rebootGeneration\":4");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/host2.yahoo.com"),
+ "\"rebootGeneration\":4");
// POST new nodes
assertResponse(new Request("http://localhost:8080/nodes/v2/node",
("[" + asNodeJson("host8.yahoo.com", "default", "127.0.8.1") + "," + // test with only 1 ip address
- asNodeJson("host9.yahoo.com", "large-variant", "127.0.9.1", "::9:1") + "," +
- asHostJson("parent2.yahoo.com", "large-variant", Optional.of(TenantName.from("myTenant")), "127.0.127.1", "::127:1") + "," +
- asDockerNodeJson("host11.yahoo.com", "parent.host.yahoo.com", "::11") + "]").
+ asNodeJson("host9.yahoo.com", "large-variant", "127.0.9.1", "::9:1") + "," +
+ asHostJson("parent2.yahoo.com", "large-variant", Optional.of(TenantName.from("myTenant")), "127.0.127.1", "::127:1") + "," +
+ asDockerNodeJson("host11.yahoo.com", "parent.host.yahoo.com", "::11") + "]").
getBytes(StandardCharsets.UTF_8),
Request.Method.POST),
- "{\"message\":\"Added 4 nodes to the provisioned state\"}");
+ "{\"message\":\"Added 4 nodes to the provisioned state\"}");
assertFile(new Request("http://localhost:8080/nodes/v2/node/host8.yahoo.com"), "node8.json");
assertFile(new Request("http://localhost:8080/nodes/v2/node/host9.yahoo.com"), "node9.json");
assertFile(new Request("http://localhost:8080/nodes/v2/node/host11.yahoo.com"), "node11.json");
assertFile(new Request("http://localhost:8080/nodes/v2/node/parent2.yahoo.com"), "parent2.json");
// POST duplicate node
- assertResponse(new Request("http://localhost:8080/nodes/v2/node",
- ("[" + asNodeJson("host8.yahoo.com", "default", "127.0.254.8") + "]").getBytes(StandardCharsets.UTF_8),
- Request.Method.POST), 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot add provisioned host host8.yahoo.com: A node with this name already exists\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node",
+ ("[" + asNodeJson("host8.yahoo.com", "default", "127.0.254.8") + "]").getBytes(StandardCharsets.UTF_8),
+ Request.Method.POST), 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot add provisioned host host8.yahoo.com: A node with this name already exists\"}");
// DELETE a provisioned node
assertResponse(new Request("http://localhost:8080/nodes/v2/node/host9.yahoo.com",
@@ -127,8 +125,8 @@ public class RestApiTest {
assertResponse(new Request("http://localhost:8080/nodes/v2/state/ready/host8.yahoo.com",
new byte[0], Request.Method.PUT),
"{\"message\":\"Moved host8.yahoo.com to ready\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/host8.yahoo.com"),
- "\"state\":\"ready\"");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/host8.yahoo.com"),
+ "\"state\":\"ready\"");
// calling ready again is a noop:
assertResponse(new Request("http://localhost:8080/nodes/v2/state/ready/host8.yahoo.com",
new byte[0], Request.Method.PUT),
@@ -138,8 +136,8 @@ public class RestApiTest {
assertResponse(new Request("http://localhost:8080/nodes/v2/state/failed/host2.yahoo.com",
new byte[0], Request.Method.PUT),
"{\"message\":\"Moved host2.yahoo.com to failed\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/host2.yahoo.com"),
- "\"state\":\"failed\"");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/host2.yahoo.com"),
+ "\"state\":\"failed\"");
// ... and put it back in active (after fixing). This is useful to restore data when multiple nodes fail.
assertResponse(new Request("http://localhost:8080/nodes/v2/state/active/host2.yahoo.com",
new byte[0], Request.Method.PUT),
@@ -149,8 +147,8 @@ public class RestApiTest {
assertResponse(new Request("http://localhost:8080/nodes/v2/state/parked/host8.yahoo.com",
new byte[0], Request.Method.PUT),
"{\"message\":\"Moved host8.yahoo.com to parked\"}");
- assertResponseContains(new Request("http://localhost:8080()/nodes/v2/node/host8.yahoo.com"),
- "\"state\":\"parked\"");
+ tester.assertResponseContains(new Request("http://localhost:8080()/nodes/v2/node/host8.yahoo.com"),
+ "\"state\":\"parked\"");
// ... and delete it
assertResponse(new Request("http://localhost:8080/nodes/v2/node/host8.yahoo.com",
new byte[0], Request.Method.DELETE),
@@ -160,8 +158,8 @@ public class RestApiTest {
assertResponse(new Request("http://localhost:8080/nodes/v2/state/failed/test-node-pool-102-2",
new byte[0], Request.Method.PUT),
"{\"message\":\"Moved test-node-pool-102-2 to failed\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/test-node-pool-102-2"),
- "\"state\":\"failed\"");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/test-node-pool-102-2"),
+ "\"state\":\"failed\"");
// ... and deallocate it such that it moves to dirty and is recycled
assertResponse(new Request("http://localhost:8080/nodes/v2/state/dirty/test-node-pool-102-2",
new byte[0], Request.Method.PUT),
@@ -172,8 +170,8 @@ public class RestApiTest {
new byte[0], Request.Method.PUT),
"{\"message\":\"Moved test-node-pool-102-2 to ready\"}");
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/test-node-pool-102-2", new byte[0], Request.Method.GET),
- 404, "{\"error-code\":\"NOT_FOUND\",\"message\":\"No node with hostname 'test-node-pool-102-2'\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/test-node-pool-102-2", new byte[0], Request.Method.GET),
+ 404, "{\"error-code\":\"NOT_FOUND\",\"message\":\"No node with hostname 'test-node-pool-102-2'\"}");
// Put a host in failed and make sure it's children are also failed
assertResponse(new Request("http://localhost:8080/nodes/v2/state/failed/dockerhost1.yahoo.com", new byte[0], Request.Method.PUT),
@@ -218,14 +216,14 @@ public class RestApiTest {
assertResponse(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com",
Utf8.toBytes("{\"wantToDeprovision\": true}"), Request.Method.PATCH),
"{\"message\":\"Updated dockerhost1.yahoo.com\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com"), "\"modelName\":\"foo\"");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com"), "\"modelName\":\"foo\"");
assertResponse(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com",
Utf8.toBytes("{\"modelName\": null}"), Request.Method.PATCH),
"{\"message\":\"Updated dockerhost1.yahoo.com\"}");
- assertPartialResponse(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com"), "modelName", false);
- container.handleRequest((new Request("http://localhost:8080/nodes/v2/upgrade/tenant", Utf8.toBytes("{\"dockerImage\": \"docker.domain.tld/my/image\"}"), Request.Method.PATCH)));
+ tester.assertPartialResponse(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com"), "modelName", false);
+ tester.container().handleRequest((new Request("http://localhost:8080/nodes/v2/upgrade/tenant", Utf8.toBytes("{\"dockerImage\": \"docker.domain.tld/my/image\"}"), Request.Method.PATCH)));
- ((OrchestratorMock) container.components().getComponent(OrchestratorMock.class.getName()))
+ ((OrchestratorMock) tester.container().components().getComponent(OrchestratorMock.class.getName()))
.suspend(new HostName("host4.yahoo.com"));
assertFile(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com"), "node4-after-changes.json");
@@ -260,10 +258,10 @@ public class RestApiTest {
"{\"message\":\"Executed job 'PeriodicApplicationMaintainer'\"}");
// POST run of unknown maintenance job
- assertResponse(new Request("http://localhost:8080/nodes/v2/maintenance/run/foo",
- new byte[0], Request.Method.POST),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"No such job 'foo'\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/maintenance/run/foo",
+ new byte[0], Request.Method.POST),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"No such job 'foo'\"}");
}
@Test
@@ -279,7 +277,8 @@ public class RestApiTest {
Request req = new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com",
Utf8.toBytes("{\"currentRestartGeneration\": 1}"), Request.Method.POST);
req.getHeaders().add("X-HTTP-Method-Override", "GET");
- assertResponse(req, 400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Illegal X-HTTP-Method-Override header for POST request. Accepts 'PATCH' but got 'GET'\"}");
+ tester.assertResponse(req, 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Illegal X-HTTP-Method-Override header for POST request. Accepts 'PATCH' but got 'GET'\"}");
}
@Test
@@ -307,56 +306,56 @@ public class RestApiTest {
("[" + asNodeJson("host-with-ip.yahoo.com", "default", "foo") + "]").
getBytes(StandardCharsets.UTF_8),
Request.Method.POST);
- assertResponse(req, 400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Found one or more invalid addresses in [foo]: 'foo' is not an IP string literal.\"}");
+ tester.assertResponse(req, 400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Found one or more invalid addresses in [foo]: 'foo' is not an IP string literal.\"}");
// Attempt to POST tenant node with already assigned IP
- assertResponse(new Request("http://localhost:8080/nodes/v2/node",
- "[" + asNodeJson("tenant-node-foo.yahoo.com", "default", "127.0.1.1") + "]",
- Request.Method.POST), 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot assign [127.0.1.1] to tenant-node-foo.yahoo.com: [127.0.1.1] already assigned to host1.yahoo.com\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node",
+ "[" + asNodeJson("tenant-node-foo.yahoo.com", "default", "127.0.1.1") + "]",
+ Request.Method.POST), 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot assign [127.0.1.1] to tenant-node-foo.yahoo.com: [127.0.1.1] already assigned to host1.yahoo.com\"}");
// Attempt to PATCH existing tenant node with already assigned IP
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/test-node-pool-102-2",
- "{\"ipAddresses\": [\"127.0.2.1\"]}",
- Request.Method.PATCH), 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'ipAddresses': Cannot assign [127.0.2.1] to test-node-pool-102-2: [127.0.2.1] already assigned to host2.yahoo.com\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/test-node-pool-102-2",
+ "{\"ipAddresses\": [\"127.0.2.1\"]}",
+ Request.Method.PATCH), 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'ipAddresses': Cannot assign [127.0.2.1] to test-node-pool-102-2: [127.0.2.1] already assigned to host2.yahoo.com\"}");
// Attempt to POST host node with already assigned IP
- assertResponse(new Request("http://localhost:8080/nodes/v2/node",
- "[" + asHostJson("host200.yahoo.com", "default", Optional.empty(), "127.0.2.1") + "]",
- Request.Method.POST), 400,
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node",
+ "[" + asHostJson("host200.yahoo.com", "default", Optional.empty(), "127.0.2.1") + "]",
+ Request.Method.POST), 400,
"{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot assign [127.0.2.1] to host200.yahoo.com: [127.0.2.1] already assigned to host2.yahoo.com\"}");
// Attempt to PATCH host node with IP in the pool of another node
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com",
- "{\"ipAddresses\": [\"::104:3\"]}",
- Request.Method.PATCH), 400,
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com",
+ "{\"ipAddresses\": [\"::104:3\"]}",
+ Request.Method.PATCH), 400,
"{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'ipAddresses': Cannot assign [::100:4, ::100:3, ::100:2, ::104:3] to dockerhost1.yahoo.com: [::104:3] already assigned to dockerhost5.yahoo.com\"}");
// Node types running a single container can share their IP address with child node
- assertResponse(new Request("http://localhost:8080/nodes/v2/node",
- "[" + asNodeJson("cfghost42.yahoo.com", NodeType.confighost, "default", Optional.empty(), "127.0.42.1") + "]",
- Request.Method.POST), 200,
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node",
+ "[" + asNodeJson("cfghost42.yahoo.com", NodeType.confighost, "default", Optional.empty(), "127.0.42.1") + "]",
+ Request.Method.POST), 200,
"{\"message\":\"Added 1 nodes to the provisioned state\"}");
- assertResponse(new Request("http://localhost:8080/nodes/v2/node",
- "[" + asDockerNodeJson("cfg42.yahoo.com", NodeType.config, "cfghost42.yahoo.com", "127.0.42.1") + "]",
- Request.Method.POST), 200,
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node",
+ "[" + asDockerNodeJson("cfg42.yahoo.com", NodeType.config, "cfghost42.yahoo.com", "127.0.42.1") + "]",
+ Request.Method.POST), 200,
"{\"message\":\"Added 1 nodes to the provisioned state\"}");
// ... but cannot share with child node of wrong type
- assertResponse(new Request("http://localhost:8080/nodes/v2/node",
- "[" + asDockerNodeJson("proxy42.yahoo.com", NodeType.proxy, "cfghost42.yahoo.com", "127.0.42.1") + "]",
- Request.Method.POST), 400,
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node",
+ "[" + asDockerNodeJson("proxy42.yahoo.com", NodeType.proxy, "cfghost42.yahoo.com", "127.0.42.1") + "]",
+ Request.Method.POST), 400,
"{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot assign [127.0.42.1] to proxy42.yahoo.com: [127.0.42.1] already assigned to cfg42.yahoo.com\"}");
// ... nor with child node on different host
- assertResponse(new Request("http://localhost:8080/nodes/v2/node",
- "[" + asNodeJson("cfghost43.yahoo.com", NodeType.confighost, "default", Optional.empty(), "127.0.43.1") + "]",
- Request.Method.POST), 200,
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node",
+ "[" + asNodeJson("cfghost43.yahoo.com", NodeType.confighost, "default", Optional.empty(), "127.0.43.1") + "]",
+ Request.Method.POST), 200,
"{\"message\":\"Added 1 nodes to the provisioned state\"}");
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/cfg42.yahoo.com",
- "{\"ipAddresses\": [\"127.0.43.1\"]}",
- Request.Method.PATCH), 400,
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/cfg42.yahoo.com",
+ "{\"ipAddresses\": [\"127.0.43.1\"]}",
+ Request.Method.PATCH), 400,
"{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'ipAddresses': Cannot assign [127.0.43.1] to cfg42.yahoo.com: [127.0.43.1] already assigned to cfghost43.yahoo.com\"}");
}
@@ -385,10 +384,10 @@ public class RestApiTest {
Utf8.toBytes("{\"reports\":{\"diskSpace\":{\"createdMillis\":2,\"description\":\"" + msg + "\",\"type\": \"HARD_FAIL\"}}}"),
Request.Method.PATCH),
"{\"message\":\"Updated host12.yahoo.com\"}");
- assertResponse(new Request("http://localhost:8080/nodes/v2/state/ready/host12.yahoo.com", new byte[0], Request.Method.PUT),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"provisioned host host12.yahoo.com cannot be readied because it has " +
- "hard failures: [diskSpace reported 1970-01-01T00:00:00.002Z: " + msg + "]\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/state/ready/host12.yahoo.com", new byte[0], Request.Method.PUT),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"provisioned host host12.yahoo.com cannot be readied because it has " +
+ "hard failures: [diskSpace reported 1970-01-01T00:00:00.002Z: " + msg + "]\"}");
}
@Test
@@ -404,13 +403,13 @@ public class RestApiTest {
assertResponse(new Request("http://localhost:8080/nodes/v2/state/dirty/foo.yahoo.com",
new byte[0], Request.Method.PUT),
"{\"message\":\"Moved foo.yahoo.com to dirty\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/foo.yahoo.com"),
- "\"rebootGeneration\":1");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/foo.yahoo.com"),
+ "\"rebootGeneration\":1");
assertResponse(new Request("http://localhost:8080/nodes/v2/node/foo.yahoo.com",
Utf8.toBytes("{\"currentRebootGeneration\": 42}"), Request.Method.PATCH),
"{\"message\":\"Updated foo.yahoo.com\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/foo.yahoo.com"),
- "\"rebootGeneration\":1");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/foo.yahoo.com"),
+ "\"rebootGeneration\":1");
}
@Test
@@ -436,21 +435,21 @@ public class RestApiTest {
@Test
public void test_invalid_requests() throws Exception {
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/node-does-not-exist",
- new byte[0], Request.Method.GET),
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/node-does-not-exist",
+ new byte[0], Request.Method.GET),
404, "{\"error-code\":\"NOT_FOUND\",\"message\":\"No node with hostname 'node-does-not-exist'\"}");
// Attempt to fail and ready an allocated node without going through dirty
- assertResponse(new Request("http://localhost:8080/nodes/v2/state/failed/node-does-not-exist",
- new byte[0], Request.Method.PUT),
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/state/failed/node-does-not-exist",
+ new byte[0], Request.Method.PUT),
404, "{\"error-code\":\"NOT_FOUND\",\"message\":\"Could not move node-does-not-exist to failed: Node not found\"}");
// Attempt to fail and ready an allocated node without going through dirty
assertResponse(new Request("http://localhost:8080/nodes/v2/state/failed/host1.yahoo.com",
new byte[0], Request.Method.PUT),
"{\"message\":\"Moved host1.yahoo.com to failed\"}");
- assertResponse(new Request("http://localhost:8080/nodes/v2/state/ready/host1.yahoo.com",
- new byte[0], Request.Method.PUT),
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/state/ready/host1.yahoo.com",
+ new byte[0], Request.Method.PUT),
400,
"{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot make failed host host1.yahoo.com allocated to tenant1.application1.instance1 as 'container/id1/0/0' available for new allocation as it is not in state [dirty]\"}");
@@ -466,8 +465,8 @@ public class RestApiTest {
assertResponse(new Request("http://localhost:8080/nodes/v2/state/parked/host2.yahoo.com",
new byte[0], Request.Method.PUT),
"{\"message\":\"Moved host2.yahoo.com to parked\"}");
- assertResponse(new Request("http://localhost:8080/nodes/v2/state/ready/host2.yahoo.com",
- new byte[0], Request.Method.PUT),
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/state/ready/host2.yahoo.com",
+ new byte[0], Request.Method.PUT),
400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot make parked host host2.yahoo.com allocated to tenant2.application2.instance2 as 'content/id2/0/0' available for new allocation as it is not in state [dirty]\"}");
// (... while dirty then ready works (the ready move will be initiated by node maintenance))
assertResponse(new Request("http://localhost:8080/nodes/v2/state/dirty/host2.yahoo.com",
@@ -478,42 +477,42 @@ public class RestApiTest {
"{\"message\":\"Moved host2.yahoo.com to ready\"}");
// Attempt to DELETE a node which has been removed
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/host2.yahoo.com",
- new byte[0], Request.Method.DELETE),
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/host2.yahoo.com",
+ new byte[0], Request.Method.DELETE),
404, "{\"error-code\":\"NOT_FOUND\",\"message\":\"No node with hostname 'host2.yahoo.com'\"}");
// Attempt to DELETE allocated node
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com",
- new byte[0], Request.Method.DELETE),
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com",
+ new byte[0], Request.Method.DELETE),
400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"active child node host4.yahoo.com allocated to tenant3.application3.instance3 as 'content/id3/0/0' is currently allocated and cannot be removed\"}");
// PUT current restart generation with string instead of long
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com",
- Utf8.toBytes("{\"currentRestartGeneration\": \"1\"}"), Request.Method.PATCH),
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com",
+ Utf8.toBytes("{\"currentRestartGeneration\": \"1\"}"), Request.Method.PATCH),
400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'currentRestartGeneration': Expected a LONG value, got a STRING\"}");
// PUT flavor with long instead of string
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com",
- Utf8.toBytes("{\"flavor\": 1}"), Request.Method.PATCH),
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com",
+ Utf8.toBytes("{\"flavor\": 1}"), Request.Method.PATCH),
400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'flavor': Expected a STRING value, got a LONG\"}");
// Attempt to set nonexisting node to active
- assertResponse(new Request("http://localhost:8080/nodes/v2/state/active/host2.yahoo.com",
- new byte[0], Request.Method.PUT), 404,
- "{\"error-code\":\"NOT_FOUND\",\"message\":\"Could not move host2.yahoo.com to active: Node not found\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/state/active/host2.yahoo.com",
+ new byte[0], Request.Method.PUT), 404,
+ "{\"error-code\":\"NOT_FOUND\",\"message\":\"Could not move host2.yahoo.com to active: Node not found\"}");
// Attempt to POST duplicate nodes
- assertResponse(new Request("http://localhost:8080/nodes/v2/node",
- ("[" + asNodeJson("host8.yahoo.com", "default", "127.0.254.1", "::254:1") + "," +
- asNodeJson("host8.yahoo.com", "large-variant", "127.0.253.1", "::253:1") + "]").getBytes(StandardCharsets.UTF_8),
- Request.Method.POST), 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot add nodes: provisioned host host8.yahoo.com is duplicated in the argument list\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node",
+ ("[" + asNodeJson("host8.yahoo.com", "default", "127.0.254.1", "::254:1") + "," +
+ asNodeJson("host8.yahoo.com", "large-variant", "127.0.253.1", "::253:1") + "]").getBytes(StandardCharsets.UTF_8),
+ Request.Method.POST), 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot add nodes: provisioned host host8.yahoo.com is duplicated in the argument list\"}");
// Attempt to PATCH field not relevant for child node
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/test-node-pool-102-2",
- Utf8.toBytes("{\"modelName\": \"foo\"}"), Request.Method.PATCH),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'modelName': A child node cannot have model name set\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/test-node-pool-102-2",
+ Utf8.toBytes("{\"modelName\": \"foo\"}"), Request.Method.PATCH),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'modelName': A child node cannot have model name set\"}");
}
@Test
@@ -531,15 +530,16 @@ public class RestApiTest {
Request.Method.PATCH),
"{\"message\":\"Updated host4.yahoo.com\"}");
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/doesnotexist.yahoo.com",
- Utf8.toBytes("{\"currentRestartGeneration\": 1}"),
- Request.Method.PATCH),
- 404, "{\"error-code\":\"NOT_FOUND\",\"message\":\"No node found with hostname doesnotexist.yahoo.com\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/doesnotexist.yahoo.com",
+ Utf8.toBytes("{\"currentRestartGeneration\": 1}"),
+ Request.Method.PATCH),
+ 404, "{\"error-code\":\"NOT_FOUND\",\"message\":\"No node found with hostname doesnotexist.yahoo.com\"}");
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/host5.yahoo.com",
- Utf8.toBytes("{\"currentRestartGeneration\": 1}"),
- Request.Method.PATCH),
- 400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'currentRestartGeneration': Node is not allocated\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/host5.yahoo.com",
+ Utf8.toBytes("{\"currentRestartGeneration\": 1}"),
+ Request.Method.PATCH),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'currentRestartGeneration': Node is not allocated\"}");
}
@Test
@@ -584,25 +584,25 @@ public class RestApiTest {
assertFile(new Request("http://localhost:8080/nodes/v2/node/host6.yahoo.com"), "node6-reports.json");
// Patching with an empty reports is no-op
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/host6.yahoo.com",
- Utf8.toBytes("{\"reports\": {}}"),
- Request.Method.PATCH),
- 200,
- "{\"message\":\"Updated host6.yahoo.com\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/host6.yahoo.com",
+ Utf8.toBytes("{\"reports\": {}}"),
+ Request.Method.PATCH),
+ 200,
+ "{\"message\":\"Updated host6.yahoo.com\"}");
assertFile(new Request("http://localhost:8080/nodes/v2/node/host6.yahoo.com"), "node6-reports.json");
// Patching existing report overwrites
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/host6.yahoo.com",
- Utf8.toBytes("{" +
- " \"reports\": {" +
- " \"actualCpuCores\": {" +
- " \"createdMillis\": 3 " +
- " }" +
- " }" +
- "}"),
- Request.Method.PATCH),
- 200,
- "{\"message\":\"Updated host6.yahoo.com\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/host6.yahoo.com",
+ Utf8.toBytes("{" +
+ " \"reports\": {" +
+ " \"actualCpuCores\": {" +
+ " \"createdMillis\": 3 " +
+ " }" +
+ " }" +
+ "}"),
+ Request.Method.PATCH),
+ 200,
+ "{\"message\":\"Updated host6.yahoo.com\"}");
assertFile(new Request("http://localhost:8080/nodes/v2/node/host6.yahoo.com"), "node6-reports-2.json");
// Clearing one report
@@ -645,26 +645,26 @@ public class RestApiTest {
"{\"versions\":{\"config\":\"6.123.456\",\"confighost\":\"6.123.456\",\"controller\":\"6.123.456\"},\"osVersions\":{},\"dockerImages\":{}}");
// Setting version for unsupported node type fails
- assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/tenant",
- Utf8.toBytes("{\"version\": \"6.123.456\"}"),
- Request.Method.PATCH),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Target version for type tenant is not allowed\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/tenant",
+ Utf8.toBytes("{\"version\": \"6.123.456\"}"),
+ Request.Method.PATCH),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Target version for type tenant is not allowed\"}");
// Omitting version field fails
- assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
- Utf8.toBytes("{}"),
- Request.Method.PATCH),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"At least one of 'version', 'osVersion' or 'dockerImage' must be set\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
+ Utf8.toBytes("{}"),
+ Request.Method.PATCH),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"At least one of 'version', 'osVersion' or 'dockerImage' must be set\"}");
// Downgrade without force fails
- assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
- Utf8.toBytes("{\"version\": \"6.123.1\"}"),
- Request.Method.PATCH),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot downgrade version without setting 'force'. " +
- "Current target version: 6.123.456, attempted to set target version: 6.123.1\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
+ Utf8.toBytes("{\"version\": \"6.123.1\"}"),
+ Request.Method.PATCH),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot downgrade version without setting 'force'. " +
+ "Current target version: 6.123.456, attempted to set target version: 6.123.1\"}");
// Downgrade with force is OK
assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
@@ -677,11 +677,11 @@ public class RestApiTest {
"{\"versions\":{\"config\":\"6.123.456\",\"confighost\":\"6.123.1\",\"controller\":\"6.123.456\"},\"osVersions\":{},\"dockerImages\":{}}");
// Setting empty version without force fails
- assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
- Utf8.toBytes("{\"version\": null}"),
- Request.Method.PATCH),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot downgrade version without setting 'force'. Current target version: 6.123.1, attempted to set target version: 0.0.0\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
+ Utf8.toBytes("{\"version\": null}"),
+ Request.Method.PATCH),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot downgrade version without setting 'force'. Current target version: 6.123.1, attempted to set target version: 0.0.0\"}");
assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
Utf8.toBytes("{\"version\": null, \"force\": true}"),
@@ -713,18 +713,18 @@ public class RestApiTest {
"{\"message\":\"Set version to 6.124.42, osVersion to 7.5.2 for nodes of type confighost\"}");
// Attempt to upgrade unsupported node type
- assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/config",
- Utf8.toBytes("{\"osVersion\": \"7.5.2\"}"),
- Request.Method.PATCH),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Node type 'config' does not support OS upgrades\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/config",
+ Utf8.toBytes("{\"osVersion\": \"7.5.2\"}"),
+ Request.Method.PATCH),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Node type 'config' does not support OS upgrades\"}");
// Attempt to downgrade OS
- assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
- Utf8.toBytes("{\"osVersion\": \"7.4.2\"}"),
- Request.Method.PATCH),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot set target OS version to 7.4.2 without setting 'force', as it's lower than the current version: 7.5.2\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
+ Utf8.toBytes("{\"osVersion\": \"7.4.2\"}"),
+ Request.Method.PATCH),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Cannot set target OS version to 7.4.2 without setting 'force', as it's lower than the current version: 7.5.2\"}");
// Downgrading OS with force succeeds
assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
@@ -733,11 +733,11 @@ public class RestApiTest {
"{\"message\":\"Set osVersion to 7.4.2 for nodes of type confighost\"}");
// Current target is considered bad, remove it
- assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
- Utf8.toBytes("{\"osVersion\": null}"),
- Request.Method.PATCH),
- 200,
- "{\"message\":\"Set osVersion to null for nodes of type confighost\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
+ Utf8.toBytes("{\"osVersion\": null}"),
+ Request.Method.PATCH),
+ 200,
+ "{\"message\":\"Set osVersion to null for nodes of type confighost\"}");
// Set docker image for config and tenant
assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/tenant",
@@ -753,11 +753,11 @@ public class RestApiTest {
"{\"versions\":{\"config\":\"6.123.456\",\"confighost\":\"6.124.42\",\"controller\":\"6.123.456\"},\"osVersions\":{\"host\":\"7.5.2\"},\"dockerImages\":{\"tenant\":\"my-repo.my-domain.example:1234/repo/tenant\",\"config\":\"my-repo.my-domain.example:1234/repo/image\"}}");
// Cannot set docker image for non docker node type
- assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
- Utf8.toBytes("{\"dockerImage\": \"my-repo.my-domain.example:1234/repo/image\"}"),
- Request.Method.PATCH),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Setting docker image for confighost nodes is unsupported\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/upgrade/confighost",
+ Utf8.toBytes("{\"dockerImage\": \"my-repo.my-domain.example:1234/repo/image\"}"),
+ Request.Method.PATCH),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Setting docker image for confighost nodes is unsupported\"}");
}
@Test
@@ -769,12 +769,12 @@ public class RestApiTest {
"{\"message\":\"Set osVersion to 7.5.2 for nodes of type host\"}");
// Activate target
- var nodeRepository = (NodeRepository) container.components().getComponent(MockNodeRepository.class.getName());
+ var nodeRepository = (NodeRepository)tester.container().components().getComponent(MockNodeRepository.class.getName());
var osUpgradeActivator = new OsUpgradeActivator(nodeRepository, Duration.ofDays(1));
osUpgradeActivator.run();
// Other node type does not return wanted OS version
- Response r = container.handleRequest(new Request("http://localhost:8080/nodes/v2/node/host1.yahoo.com"));
+ Response r = tester.container().handleRequest(new Request("http://localhost:8080/nodes/v2/node/host1.yahoo.com"));
assertFalse("Response omits wantedOsVersions field", r.getBodyAsString().contains("wantedOsVersion"));
// Node updates its node object after upgrading OS
@@ -854,21 +854,13 @@ public class RestApiTest {
}
@Test
- public void test_load_balancers() throws Exception {
- assertFile(new Request("http://localhost:8080/loadbalancers/v1/"), "load-balancers.json");
- assertFile(new Request("http://localhost:8080/loadbalancers/v1/?application=tenant4.application4.instance4"), "load-balancers-single.json");
- assertResponse(new Request("http://localhost:8080/loadbalancers/v1/?application=tenant.nonexistent.default"), "{\"loadBalancers\":[]}");
- }
-
- @Test
public void test_flavor_overrides() throws Exception {
String host = "parent2.yahoo.com";
// Test adding with overrides
- assertResponse(new Request("http://localhost:8080/nodes/v2/node",
- ("[{\"hostname\":\"" + host + "\"," + createIpAddresses("::1") + "\"openStackId\":\"osid-123\"," +
- "\"flavor\":\"large-variant\",\"resources\":{\"diskGb\":1234,\"memoryGb\":4321}}]").
- getBytes(StandardCharsets.UTF_8),
- Request.Method.POST),
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node",
+ ("[{\"hostname\":\"" + host + "\"," + createIpAddresses("::1") + "\"openStackId\":\"osid-123\"," +
+ "\"flavor\":\"large-variant\",\"resources\":{\"diskGb\":1234,\"memoryGb\":4321}}]").getBytes(StandardCharsets.UTF_8),
+ Request.Method.POST),
400,
"{\"error-code\":\"BAD_REQUEST\",\"message\":\"Can only override disk GB for configured flavor\"}");
@@ -878,8 +870,8 @@ public class RestApiTest {
getBytes(StandardCharsets.UTF_8),
Request.Method.POST),
"{\"message\":\"Added 1 nodes to the provisioned state\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/" + host),
- "\"resources\":{\"vcpu\":64.0,\"memoryGb\":128.0,\"diskGb\":1234.0,\"bandwidthGbps\":15.0,\"diskSpeed\":\"fast\",\"storageType\":\"remote\"}");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/" + host),
+ "\"resources\":{\"vcpu\":64.0,\"memoryGb\":128.0,\"diskGb\":1234.0,\"bandwidthGbps\":15.0,\"diskSpeed\":\"fast\",\"storageType\":\"remote\"}");
// Test adding tenant node
String tenant = "node-1-3.yahoo.com";
@@ -890,21 +882,21 @@ public class RestApiTest {
getBytes(StandardCharsets.UTF_8),
Request.Method.POST),
"{\"message\":\"Added 1 nodes to the provisioned state\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/" + tenant), resources);
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/" + tenant), resources);
// Test patching with overrides
- assertResponse(new Request("http://localhost:8080/nodes/v2/node/" + host,
- "{\"minDiskAvailableGb\":5432,\"minMainMemoryAvailableGb\":2345}".getBytes(StandardCharsets.UTF_8),
- Request.Method.PATCH),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'minMainMemoryAvailableGb': Can only override disk GB for configured flavor\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node/" + host,
+ "{\"minDiskAvailableGb\":5432,\"minMainMemoryAvailableGb\":2345}".getBytes(StandardCharsets.UTF_8),
+ Request.Method.PATCH),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'minMainMemoryAvailableGb': Can only override disk GB for configured flavor\"}");
assertResponse(new Request("http://localhost:8080/nodes/v2/node/" + host,
"{\"minDiskAvailableGb\":5432}".getBytes(StandardCharsets.UTF_8),
Request.Method.PATCH),
"{\"message\":\"Updated " + host + "\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/" + host),
- "\"resources\":{\"vcpu\":64.0,\"memoryGb\":128.0,\"diskGb\":5432.0,\"bandwidthGbps\":15.0,\"diskSpeed\":\"fast\",\"storageType\":\"remote\"}");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/" + host),
+ "\"resources\":{\"vcpu\":64.0,\"memoryGb\":128.0,\"diskGb\":5432.0,\"bandwidthGbps\":15.0,\"diskSpeed\":\"fast\",\"storageType\":\"remote\"}");
}
@Test
@@ -912,28 +904,27 @@ public class RestApiTest {
String hostname = "node123.yahoo.com";
String resources = "\"resources\":{\"vcpu\":5.0,\"memoryGb\":4321.0,\"diskGb\":1234.0,\"bandwidthGbps\":0.3,\"diskSpeed\":\"slow\",\"storageType\":\"local\"}";
// Test adding new node with resources
- assertResponse(new Request("http://localhost:8080/nodes/v2/node",
- ("[{\"hostname\":\"" + hostname + "\"," + createIpAddresses("::1") + "\"openStackId\":\"osid-123\"," +
- resources.replace("\"memoryGb\":4321.0,", "") + "}]").
- getBytes(StandardCharsets.UTF_8),
- Request.Method.POST),
- 400,
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Required field 'memoryGb' is missing\"}");
+ tester.assertResponse(new Request("http://localhost:8080/nodes/v2/node",
+ ("[{\"hostname\":\"" + hostname + "\"," + createIpAddresses("::1") + "\"openStackId\":\"osid-123\"," +
+ resources.replace("\"memoryGb\":4321.0,", "") + "}]").getBytes(StandardCharsets.UTF_8),
+ Request.Method.POST),
+ 400,
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Required field 'memoryGb' is missing\"}");
assertResponse(new Request("http://localhost:8080/nodes/v2/node",
("[{\"hostname\":\"" + hostname + "\"," + createIpAddresses("::1") + "\"openStackId\":\"osid-123\"," + resources + "}]")
.getBytes(StandardCharsets.UTF_8),
Request.Method.POST),
"{\"message\":\"Added 1 nodes to the provisioned state\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/" + hostname), resources);
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/" + hostname), resources);
// Test patching with overrides
assertResponse(new Request("http://localhost:8080/nodes/v2/node/" + hostname,
"{\"diskGb\":12,\"memoryGb\":34,\"vcpu\":56,\"fastDisk\":true,\"remoteStorage\":true,\"bandwidthGbps\":78.0}".getBytes(StandardCharsets.UTF_8),
Request.Method.PATCH),
"{\"message\":\"Updated " + hostname + "\"}");
- assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/" + hostname),
- "\"resources\":{\"vcpu\":56.0,\"memoryGb\":34.0,\"diskGb\":12.0,\"bandwidthGbps\":78.0,\"diskSpeed\":\"fast\",\"storageType\":\"remote\"}");
+ tester.assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/" + hostname),
+ "\"resources\":{\"vcpu\":56.0,\"memoryGb\":34.0,\"diskGb\":12.0,\"bandwidthGbps\":78.0,\"diskSpeed\":\"fast\",\"storageType\":\"remote\"}");
}
private static String asDockerNodeJson(String hostname, String parentHostname, String... ipAddress) {
@@ -974,71 +965,20 @@ public class RestApiTest {
"],";
}
- /** Asserts a particular response and 200 as response status */
- private void assertResponse(Request request, String responseMessage) throws IOException {
- assertResponse(request, 200, responseMessage);
- }
-
- private void assertResponse(Request request, int responseStatus, String responseMessage) throws IOException {
- Response response = container.handleRequest(request);
- // Compare both status and message at once for easier diagnosis
- assertEquals("status: " + responseStatus + "\nmessage: " + responseMessage,
- "status: " + response.getStatus() + "\nmessage: " + response.getBodyAsString());
- }
-
- private void assertResponseContains(Request request, String responseSnippet) throws IOException {
- assertPartialResponse(request, responseSnippet, true);
- }
-
- private void assertPartialResponse(Request request, String responseSnippet, boolean match) throws IOException {
- String response = container.handleRequest(request).getBodyAsString();
- assertEquals(String.format("Expected response to " + (match ? " " : "not ") + "contain: %s\nResponse: %s",
- responseSnippet, response), match, response.contains(responseSnippet));
- }
-
- private void assertFile(Request request, String responseFile) throws IOException {
- String expectedResponse = IOUtils.readFile(new File(responsesPath + responseFile));
- expectedResponse = include(expectedResponse);
- expectedResponse = expectedResponse.replaceAll("(\"[^\"]*\")|\\s*", "$1"); // Remove whitespace
- String responseString = container.handleRequest(request).getBodyAsString();
- if (expectedResponse.contains("(ignore)")) {
- // Convert expected response to a literal pattern and replace any ignored field with a pattern that matches
- // until the first stop character
- String stopCharacters = "[^,:\\\\[\\\\]{}]";
- String expectedResponsePattern = Pattern.quote(expectedResponse)
- .replaceAll("\"?\\(ignore\\)\"?", "\\\\E" +
- stopCharacters + "*\\\\Q");
- if (!Pattern.matches(expectedResponsePattern, responseString)) {
- throw new ComparisonFailure(responseFile + " (with ignored fields)", expectedResponsePattern,
- responseString);
- }
- } else {
- assertEquals(responseFile, expectedResponse, responseString);
- }
- }
-
private void assertRestart(int restartCount, Request request) throws IOException {
- assertResponse(request, 200, "{\"message\":\"Scheduled restart of " + restartCount + " matching nodes\"}");
+ tester.assertResponse(request, 200, "{\"message\":\"Scheduled restart of " + restartCount + " matching nodes\"}");
}
private void assertReboot(int rebootCount, Request request) throws IOException {
- assertResponse(request, 200, "{\"message\":\"Scheduled reboot of " + rebootCount + " matching nodes\"}");
+ tester.assertResponse(request, 200, "{\"message\":\"Scheduled reboot of " + rebootCount + " matching nodes\"}");
+ }
+
+ private void assertFile(Request request, String file) throws IOException {
+ tester.assertFile(request, file);
}
- /** Replaces @include(localFile) with the content of the file */
- private String include(String response) throws IOException {
- // Please don't look at this code
- int includeIndex = response.indexOf("@include(");
- if (includeIndex < 0) return response;
- String prefix = response.substring(0, includeIndex);
- String rest = response.substring(includeIndex + "@include(".length());
- int filenameEnd = rest.indexOf(")");
- String includeFileName = rest.substring(0, filenameEnd);
- String includedContent = IOUtils.readFile(new File(responsesPath + includeFileName));
- includedContent = include(includedContent);
- String postFix = rest.substring(filenameEnd + 1);
- postFix = include(postFix);
- return prefix + includedContent + postFix;
+ private void assertResponse(Request request, String file) throws IOException {
+ tester.assertResponse(request, file);
}
}
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/RestApiTester.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/RestApiTester.java
new file mode 100644
index 00000000000..847a4e2500b
--- /dev/null
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/RestApiTester.java
@@ -0,0 +1,96 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.provision.restapi;
+
+import com.yahoo.application.Networking;
+import com.yahoo.application.container.JDisc;
+import com.yahoo.application.container.handler.Request;
+import com.yahoo.application.container.handler.Response;
+import com.yahoo.io.IOUtils;
+import com.yahoo.vespa.hosted.provision.testutils.ContainerConfig;
+import org.junit.ComparisonFailure;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author bratseth
+ */
+public class RestApiTester {
+
+ private final static String responsesPath = "src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/";
+
+ private final JDisc container;
+
+ public RestApiTester() {
+ container = JDisc.fromServicesXml(ContainerConfig.servicesXmlV2(0), Networking.disable);
+ }
+
+ public void close() {
+ if (container != null) container.close();
+ }
+
+ public JDisc container() { return container; }
+
+ /** Asserts a particular response and 200 as response status */
+ public void assertResponse(Request request, String responseMessage) throws IOException {
+ assertResponse(request, 200, responseMessage);
+ }
+
+ public void assertResponse(Request request, int responseStatus, String responseMessage) throws IOException {
+ Response response = container.handleRequest(request);
+ // Compare both status and message at once for easier diagnosis
+ assertEquals("status: " + responseStatus + "\nmessage: " + responseMessage,
+ "status: " + response.getStatus() + "\nmessage: " + response.getBodyAsString());
+ }
+
+ public void assertResponseContains(Request request, String responseSnippet) throws IOException {
+ assertPartialResponse(request, responseSnippet, true);
+ }
+
+ public void assertPartialResponse(Request request, String responseSnippet, boolean match) throws IOException {
+ String response = container.handleRequest(request).getBodyAsString();
+ assertEquals(String.format("Expected response to " + (match ? " " : "not ") + "contain: %s\nResponse: %s",
+ responseSnippet, response), match, response.contains(responseSnippet));
+ }
+
+ public void assertFile(Request request, String responseFile) throws IOException {
+ String expectedResponse = IOUtils.readFile(new File(responsesPath + responseFile));
+ expectedResponse = include(expectedResponse);
+ expectedResponse = expectedResponse.replaceAll("(\"[^\"]*\")|\\s*", "$1"); // Remove whitespace
+ String responseString = container.handleRequest(request).getBodyAsString();
+ if (expectedResponse.contains("(ignore)")) {
+ // Convert expected response to a literal pattern and replace any ignored field with a pattern that matches
+ // until the first stop character
+ String stopCharacters = "[^,:\\\\[\\\\]{}]";
+ String expectedResponsePattern = Pattern.quote(expectedResponse)
+ .replaceAll("\"?\\(ignore\\)\"?", "\\\\E" +
+ stopCharacters + "*\\\\Q");
+ if (!Pattern.matches(expectedResponsePattern, responseString)) {
+ throw new ComparisonFailure(responseFile + " (with ignored fields)", expectedResponsePattern,
+ responseString);
+ }
+ } else {
+ assertEquals(responseFile, expectedResponse, responseString);
+ }
+ }
+
+ /** Replaces @include(localFile) with the content of the file */
+ public String include(String response) throws IOException {
+ // Please don't look at this code
+ int includeIndex = response.indexOf("@include(");
+ if (includeIndex < 0) return response;
+ String prefix = response.substring(0, includeIndex);
+ String rest = response.substring(includeIndex + "@include(".length());
+ int filenameEnd = rest.indexOf(")");
+ String includeFileName = rest.substring(0, filenameEnd);
+ String includedContent = IOUtils.readFile(new File(responsesPath + includeFileName));
+ includedContent = include(includedContent);
+ String postFix = rest.substring(filenameEnd + 1);
+ postFix = include(postFix);
+ return prefix + includedContent + postFix;
+ }
+
+}
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/acl-config-server.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-config-server.json
index 55891309856..55891309856 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/acl-config-server.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-config-server.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/acl-tenant-node.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-tenant-node.json
index 16cf5c36dcc..16cf5c36dcc 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/acl-tenant-node.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/acl-tenant-node.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/active-nodes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/active-nodes.json
index c61a755d989..c61a755d989 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/active-nodes.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/active-nodes.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/application1.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application1.json
index ce2309e4d6c..ce2309e4d6c 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/application1.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application1.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/application2-nodes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application2-nodes.json
index 4581ecba73d..4581ecba73d 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/application2-nodes.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application2-nodes.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/application2.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application2.json
index 75af5d4a328..75af5d4a328 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/application2.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/application2.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/applications.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/applications.json
index 6d25b3e59f5..6d25b3e59f5 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/applications.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/applications.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/capacity-hostremoval-impossible.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/capacity-hostremoval-impossible.json
index f85e0dcc270..f85e0dcc270 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/capacity-hostremoval-impossible.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/capacity-hostremoval-impossible.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/capacity-hostremoval-possible.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/capacity-hostremoval-possible.json
index 177e1f317f7..177e1f317f7 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/capacity-hostremoval-possible.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/capacity-hostremoval-possible.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/capacity-zone.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/capacity-zone.json
index f6b2f96023a..f6b2f96023a 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/capacity-zone.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/capacity-zone.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/cfg1.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg1.json
index d2d39b06161..d2d39b06161 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/cfg1.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg1.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/cfg2.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg2.json
index 969c9a1b9c2..969c9a1b9c2 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/cfg2.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/cfg2.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/child-nodes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/child-nodes.json
index dae92aae091..dae92aae091 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/child-nodes.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/child-nodes.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/content-nodes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/content-nodes.json
index e84f17dc40d..e84f17dc40d 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/content-nodes.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/content-nodes.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/controller1.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/controller1.json
index 035e15ead49..035e15ead49 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/controller1.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/controller1.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-container1.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-container1.json
index c97509b3b3d..c97509b3b3d 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-container1.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-container1.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node1-os-upgrade-complete.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node1-os-upgrade-complete.json
index 77622933866..77622933866 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node1-os-upgrade-complete.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node1-os-upgrade-complete.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node1-os-upgrade.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node1-os-upgrade.json
index a1775dc794e..a1775dc794e 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node1-os-upgrade.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node1-os-upgrade.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node1.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node1.json
index b6b93c8d108..b6b93c8d108 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node1.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node1.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node2.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node2.json
index 88e4d132ed5..88e4d132ed5 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node2.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node2.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node3.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node3.json
index c890f1e72be..c890f1e72be 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node3.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node3.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node4.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node4.json
index 197a8c248e9..197a8c248e9 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node4.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node4.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node5.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node5.json
index 2638b6b74f5..2638b6b74f5 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/docker-node5.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/docker-node5.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/dockerhost1-with-firmware-data.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/dockerhost1-with-firmware-data.json
index ea5c3623303..ea5c3623303 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/dockerhost1-with-firmware-data.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/dockerhost1-with-firmware-data.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/flags1.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/flags1.json
index a606777e9fd..a606777e9fd 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/flags1.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/flags1.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/flags2.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/flags2.json
index 4baf75f2169..4baf75f2169 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/flags2.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/flags2.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/load-balancers-single.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/load-balancers-single.json
index a9a728bab15..a9a728bab15 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/load-balancers-single.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/load-balancers-single.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/load-balancers.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/load-balancers.json
index 515081bcb8e..515081bcb8e 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/load-balancers.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/load-balancers.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/maintenance.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/maintenance.json
index e041a7b8b54..e041a7b8b54 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/maintenance.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/maintenance.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node1.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node1.json
index 7f6a6e17fa1..7f6a6e17fa1 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node1.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node1.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node10.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node10.json
index da0e7b28f3e..da0e7b28f3e 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node10.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node10.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node11.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node11.json
index 17f8210fa4d..17f8210fa4d 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node11.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node11.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node13.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node13.json
index 2e96c4c9bbc..2e96c4c9bbc 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node13.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node13.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node14.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node14.json
index bfbecc09c60..bfbecc09c60 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node14.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node14.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node2.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node2.json
index b8ce5c86c4d..b8ce5c86c4d 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node2.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node2.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node3.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node3.json
index 70ae2a030bd..70ae2a030bd 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node3.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node3.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node4-after-changes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node4-after-changes.json
index af3552945d9..af3552945d9 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node4-after-changes.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node4-after-changes.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node4.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node4.json
index c8680e1b420..c8680e1b420 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node4.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node4.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node5-after-changes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5-after-changes.json
index beb42ec6907..beb42ec6907 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node5-after-changes.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5-after-changes.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node5.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5.json
index 3fb5ffa4708..3fb5ffa4708 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node5.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node5.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node55.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node55.json
index 3107311b792..3107311b792 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node55.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node55.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-after-changes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-after-changes.json
index 65c7e9db6cd..65c7e9db6cd 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-after-changes.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-after-changes.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports-2.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-reports-2.json
index a3d53798d7c..a3d53798d7c 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports-2.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-reports-2.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports-3.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-reports-3.json
index 7f0c3a5f706..7f0c3a5f706 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports-3.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-reports-3.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-reports.json
index 67b8d67c7f1..67b8d67c7f1 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6-reports.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6.json
index 5a665a5a223..5a665a5a223 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node6.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node7.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node7.json
index 38757b81156..38757b81156 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node7.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node7.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node8.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node8.json
index aa2b2acdb9f..aa2b2acdb9f 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node8.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node8.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node9.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node9.json
index 5f388c13f28..5f388c13f28 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node9.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/node9.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/nodes-recursive.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/nodes-recursive.json
index cf3e3c1b457..cf3e3c1b457 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/nodes-recursive.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/nodes-recursive.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/nodes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/nodes.json
index cdbd2cac9b9..cdbd2cac9b9 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/nodes.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/nodes.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/parent1.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/parent1.json
index 40f4a3b5160..40f4a3b5160 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/parent1.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/parent1.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/parent2.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/parent2.json
index ecc497172c7..ecc497172c7 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/parent2.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/parent2.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/root.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/root.json
index cc91314df84..cc91314df84 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/root.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/root.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/states-recursive.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/states-recursive.json
index f8343756559..f8343756559 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/states-recursive.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/states-recursive.json
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/states.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/states.json
index 69579148df3..69579148df3 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/states.json
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/responses/states.json