aboutsummaryrefslogtreecommitdiffstats
path: root/node-maintainer/src/test/java/com/yahoo
diff options
context:
space:
mode:
Diffstat (limited to 'node-maintainer/src/test/java/com/yahoo')
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGeneratorTest.java2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifierTest.java12
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifierTest.java75
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoInfoRetrieverTest.java2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/IPAddressVerifierTest.json113
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/filesize3
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoTest.json2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepo.json2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepoVirtualMachine.json51
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetrieverTest.java32
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetrieverTest.java2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java13
13 files changed, 256 insertions, 55 deletions
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGeneratorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGeneratorTest.java
index c992759b694..4ea1b2525d3 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGeneratorTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HostURLGeneratorTest.java
@@ -46,7 +46,7 @@ public class HostURLGeneratorTest {
mockCommandExecutor.addCommand(CAT_CONFIG_SERVER_HOST_NAME_PATH);
mockCommandExecutor.addCommand(CAT_WRONG_HOSTNAME_PATH);
HostURLGenerator.generateNodeInfoUrl(mockCommandExecutor);
- fail("Expected an IOExeption to be thrown");
+ fail("Expected an IOException to be thrown");
} catch (IOException e) {
String expectedExceptionMessage = "Unexpected output from \"hostname\" command.";
assertEquals(expectedExceptionMessage, e.getMessage());
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifierTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifierTest.java
index a995c295ee2..c56bac698ad 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifierTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifierTest.java
@@ -57,6 +57,13 @@ public class SpecVerifierTest {
}
@Test
+ public void verifySpec_environment_is_virtual_machine_should_return_true() throws Exception {
+ mockCommandExecutor.addCommand("echo notUsed " + URL_RESOURCE_PATH);
+ mockCommandExecutor.addCommand("echo nodeRepoVirtualMachine.json");
+ assertTrue(SpecVerifier.verifySpec(mockCommandExecutor));
+ }
+
+ @Test
public void verifySpec_inequal_nodeRepoInfo_and_hardware_should_return_false() throws Exception {
mockCommandExecutor.addCommand("echo notUsed " + URL_RESOURCE_PATH);
mockCommandExecutor.addCommand("echo nodeRepo.json");
@@ -71,7 +78,7 @@ public class SpecVerifierTest {
}
@Test
- public void makeYamasSpecReport_should_return_false_interface_speed() throws Exception {
+ public void makeYamasSpecReport_should_return_false_interface_speed_and_ipv6_connection() throws Exception {
HardwareInfo actualHardware = new HardwareInfo();
actualHardware.setMinCpuCores(24);
actualHardware.setMinMainMemoryAvailableGb(24);
@@ -79,6 +86,7 @@ public class SpecVerifierTest {
actualHardware.setMinDiskAvailableGb(500);
actualHardware.setIpv4Interface(true);
actualHardware.setIpv6Interface(false);
+ actualHardware.setIpv6Connection(true);
actualHardware.setDiskType(HardwareInfo.DiskType.SLOW);
ArrayList<URL> url = new ArrayList<>(Arrays.asList(new File(NODE_REPO_PATH).toURI().toURL()));
NodeRepoJsonModel nodeRepoJsonModel = NodeRepoInfoRetriever.retrieve(url);
@@ -98,7 +106,7 @@ public class SpecVerifierTest {
NodeRepoJsonModel actualNodeRepoJsonModel = SpecVerifier.getNodeRepositoryJSON(mockCommandExecutor);
double expectedMinCpuCores = 4D;
double expectedMinMainMemoryAvailableGb = 4.04D;
- double expectedMinDiskAvailableGb = 63D;
+ double expectedMinDiskAvailableGb = 1759.84;
boolean expectedFastDisk = true;
String expectedIpv6Address = "2001:4998:c:2940::111c";
assertEquals(expectedIpv6Address, actualNodeRepoJsonModel.getIpv6Address());
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifierTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifierTest.java
index 49a0b15e8c3..f063b300ba9 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifierTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifierTest.java
@@ -3,6 +3,11 @@ package com.yahoo.vespa.hosted.node.verification.spec.noderepo;
import org.junit.Before;
import org.junit.Test;
+import java.net.URL;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
@@ -11,47 +16,61 @@ import static org.mockito.Mockito.spy;
public class IPAddressVerifierTest {
private IPAddressVerifier ipAddressVerifier = spy(new IPAddressVerifier());
- private String ipAddress;
- private String additionalIp1;
- private String additionalIp2;
- private String additionalIp3;
- private String[] additionalIpAddresses;
+ private String ipv4Address;
+ private String ipv6Address;
+ private NodeRepoJsonModel nodeRepoJsonModel;
+ private static final String ABSOLUTE_PATH = Paths.get(".").toAbsolutePath().normalize().toString();
+ private static final String RESOURCE_PATH = "src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/IPAddressVerifierTest.json";
+ private static final String URL_RESOURCE_PATH = "file://" + ABSOLUTE_PATH + "/" + RESOURCE_PATH;
+ private String ipv4LookupFormat;
+ private String ipv6LookupFormat;
@Before
- public void setup() {
- ipAddress = "2001:4998:c:2977::1060";
- additionalIp1 = "2001:4998:c:2977::106f";
- additionalIp2 = "2001:4998:c:2977::106a";
- additionalIp3 = "2001:4998:c:2977::106c";
- additionalIpAddresses = new String[]{additionalIp1, additionalIp2, additionalIp3};
+ public void setup() throws Exception{
+ ipv4Address = "10.213.181.113";
+ ipv6Address = "2001:4998:c:2940::111c";
+ ArrayList<URL> nodeRepoUrl = new ArrayList<>(Arrays.asList(new URL(URL_RESOURCE_PATH)));
+ nodeRepoJsonModel = NodeRepoInfoRetriever.retrieve(nodeRepoUrl);
+ ipv4LookupFormat = "113.181.213.10.in-addr.arpa";
+ ipv6LookupFormat = "c.1.1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.4.9.2.c.0.0.0.8.9.9.4.1.0.0.2.ip6.arpa";
+ }
+
+ @Test
+ public void getFaultyIpAddresses_should_return_IP_address_when_different_hostname() throws Exception {
+ String realHostName = "zt74722.ostk.bm2.prod.gq1.yahoo.com";
+ String wrongHostName = "www.yahoo.com";
+ doReturn(realHostName).when(ipAddressVerifier).reverseLookUp(ipv4LookupFormat);
+ doReturn(wrongHostName).when(ipAddressVerifier).reverseLookUp(ipv6LookupFormat);
+ String[] faultyIpAddresses = ipAddressVerifier.getFaultyIpAddresses(nodeRepoJsonModel);
+ String[] expectedFaultyIpAddresses = new String[]{ipv6Address};
+ assertArrayEquals(expectedFaultyIpAddresses, faultyIpAddresses);
}
@Test
- public void verifyAdditionalIpAddress_should_add_IP_address_when_different_hostname() throws Exception {
- String realHostName = "www.yahoo.com";
- String wrongHostName = "www.nrk.no";
- doReturn(realHostName).when(ipAddressVerifier).reverseLookUp(ipAddress);
- doReturn(realHostName).when(ipAddressVerifier).reverseLookUp(additionalIp1);
- doReturn(realHostName).when(ipAddressVerifier).reverseLookUp(additionalIp2);
- doReturn(wrongHostName).when(ipAddressVerifier).reverseLookUp(additionalIp3);
- String[] faultyIpAddresses = ipAddressVerifier.getFaultyIpAddresses(ipAddress, additionalIpAddresses);
- String[] expectedFaultyIpAddresses = new String[]{additionalIp3};
+ public void getFaultyIpAddresses_should_return_empty_array_when_all_addresses_point_to_correct_hostname() throws Exception {
+ String realHostName = "zt74722.ostk.bm2.prod.gq1.yahoo.com";
+ doReturn(realHostName).when(ipAddressVerifier).reverseLookUp(ipv4LookupFormat);
+ doReturn(realHostName).when(ipAddressVerifier).reverseLookUp(ipv6LookupFormat);
+ String[] faultyIpAddresses = ipAddressVerifier.getFaultyIpAddresses(nodeRepoJsonModel);
+ String[] expectedFaultyIpAddresses = new String[]{};
assertArrayEquals(expectedFaultyIpAddresses, faultyIpAddresses);
}
@Test
- public void convertToLookupFormat_should_return_properly_converted_ipv6_address() {
- String ipv6Address = "2001:db8::567:89ab";
- String actualConvertedAddress = ipAddressVerifier.convertToLookupFormat(ipv6Address);
- String expectedConvertedAddress = "b.a.9.8.7.6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa";
- assertEquals(expectedConvertedAddress, actualConvertedAddress);
+ public void convertIpv6ToLookupFormat_should_return_properly_converted_ipv6_address() {
+ String actualConvertedAddress = ipAddressVerifier.convertIpv6ToLookupFormat(ipv6Address);
+ assertEquals(ipv6LookupFormat, actualConvertedAddress);
+ }
+
+ @Test
+ public void convertIpv4ToLookupFormat_should_return_properly_converted_ipv6_address() {
+ String actualConvertedAddress = ipAddressVerifier.convertIpv4ToLookupFormat(ipv4Address);
+ assertEquals(ipv4LookupFormat, actualConvertedAddress);
}
@Test
public void getFaultyIpAddresses_should_return_empty_array_when_parameters_are_invalid () {
- assertEquals(0, ipAddressVerifier.getFaultyIpAddresses(null, null).length);
- String invalidIpAddress = "This is an invalid IP address";
- assertEquals(0, ipAddressVerifier.getFaultyIpAddresses(invalidIpAddress, additionalIpAddresses).length);
+ assertEquals(0, ipAddressVerifier.getFaultyIpAddresses(new NodeRepoJsonModel()).length);
}
} \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoInfoRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoInfoRetrieverTest.java
index 1eeb6423645..8d07c519e44 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoInfoRetrieverTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoInfoRetrieverTest.java
@@ -39,7 +39,7 @@ public class NodeRepoInfoRetrieverTest {
assertEquals(expectedMinCpuCores, nodeRepoJsonModel.getMinCpuCores(), DELTA);
}
@Test
- public void retrieve_should_throw_IOEqxception_when_no_valid_URLs() throws MalformedURLException {
+ public void retrieve_should_throw_IOException_when_no_valid_URLs() throws MalformedURLException {
urls = new ArrayList<>();
String exceptionMessage = "Failed to parse JSON from all possible config servers.";
try {
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/IPAddressVerifierTest.json b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/IPAddressVerifierTest.json
new file mode 100644
index 00000000000..377029da23c
--- /dev/null
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/IPAddressVerifierTest.json
@@ -0,0 +1,113 @@
+{
+ "url": "https://api.vespa.corp.yahoo.com:4443/zone/v2/prod/us-west-1/nodes/v2/node/zt74722.ostk.bm2.prod.gq1.yahoo.com",
+ "id": "zt74722.ostk.bm2.prod.gq1.yahoo.com",
+ "state": "active",
+ "type": "host",
+ "hostname": "zt74722.ostk.bm2.prod.gq1.yahoo.com",
+ "openStackId": "653c39c1-bda4-47ee-a277-d5319eb57af7",
+ "flavor": "C-77E/256/960",
+ "canonicalFlavor": "C-77E/256/960",
+ "minDiskAvailableGb": 1920.0,
+ "minMainMemoryAvailableGb": 256.0,
+ "description": "BARE_METAL with 48.0 CPUs, 256.0 Gb memory and 1920.0 Gb ssd",
+ "minCpuCores": 48.0,
+ "cost": 150,
+ "fastDisk": true,
+ "environment": "BARE_METAL",
+ "owner": {
+ "tenant": "hosted-vespa",
+ "application": "routing",
+ "instance": "default"
+ },
+ "membership": {
+ "clustertype": "container",
+ "clusterid": "node-admin",
+ "group": "0",
+ "index": 77,
+ "retired": false
+ },
+ "restartGeneration": 0,
+ "currentRestartGeneration": 0,
+ "wantedDockerImage": "docker-registry.ops.yahoo.com:4443/vespa/ci:6.132.102",
+ "wantedVespaVersion": "6.132.102",
+ "rebootGeneration": 3,
+ "currentRebootGeneration": 3,
+ "vespaVersion": "6.132.102",
+ "currentDockerImage": "docker-registry.ops.yahoo.com:4443/vespa/ci:6.132.102",
+ "hostedVersion": "6.132.102",
+ "convergedStateVersion": "6.132.102",
+ "failCount": 1,
+ "hardwareFailure": false,
+ "wantToRetire": false,
+ "wantToDeprovision": false,
+ "history": [
+ {
+ "event": "failed",
+ "at": 1499293603487,
+ "agent": "system"
+ },
+ {
+ "event": "rebooted",
+ "at": 1499351267086,
+ "agent": "system"
+ },
+ {
+ "event": "readied",
+ "at": 1499351270674,
+ "agent": "system"
+ },
+ {
+ "event": "requested",
+ "at": 1499350936347,
+ "agent": "system"
+ },
+ {
+ "event": "reserved",
+ "at": 1499353058227,
+ "agent": "application"
+ },
+ {
+ "event": "activated",
+ "at": 1499353080459,
+ "agent": "application"
+ }
+ ],
+ "ipAddresses": [
+ "10.213.181.113",
+ "2001:4998:c:2940::111c"
+ ],
+ "additionalIpAddresses": [
+ "2001:4998:c:2940::1138",
+ "2001:4998:c:2940::1139",
+ "2001:4998:c:2940::1136",
+ "2001:4998:c:2940::1137",
+ "2001:4998:c:2940::1130",
+ "2001:4998:c:2940::1131",
+ "2001:4998:c:2940::1134",
+ "2001:4998:c:2940::1135",
+ "2001:4998:c:2940::1132",
+ "2001:4998:c:2940::1133",
+ "2001:4998:c:2940::111f",
+ "2001:4998:c:2940::111d",
+ "2001:4998:c:2940::111e",
+ "2001:4998:c:2940::113a",
+ "2001:4998:c:2940::113b",
+ "2001:4998:c:2940::113c",
+ "2001:4998:c:2940::1127",
+ "2001:4998:c:2940::1128",
+ "2001:4998:c:2940::1125",
+ "2001:4998:c:2940::1126",
+ "2001:4998:c:2940::1129",
+ "2001:4998:c:2940::1120",
+ "2001:4998:c:2940::1123",
+ "2001:4998:c:2940::1124",
+ "2001:4998:c:2940::1121",
+ "2001:4998:c:2940::1122",
+ "2001:4998:c:2940::112e",
+ "2001:4998:c:2940::112f",
+ "2001:4998:c:2940::112c",
+ "2001:4998:c:2940::112d",
+ "2001:4998:c:2940::112a",
+ "2001:4998:c:2940::112b"
+ ]
+} \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport
index 8bfad7a32d1..39022f761cd 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/SpecVerifierReport
@@ -1 +1 @@
-{"timeStamp":1501504035,"dimensions":{"memoryMatch":true,"cpuCoresMatch":true,"diskTypeMatch":true,"netInterfaceSpeedMatch":false,"diskAvailableMatch":true,"ipv4Match":true,"ipv6Match":true},"metrics":{"match":false,"expectedInterfaceSpeed":1000.0,"actualInterfaceSpeed":10009.0,"actualIpv6Connection":false},"routing":{"yamas":{"namespace":["Vespa"]}}}
+{"timeStamp":1501504035,"dimensions":{"memoryMatch":true,"cpuCoresMatch":true,"diskTypeMatch":true,"netInterfaceSpeedMatch":false,"diskAvailableMatch":true,"ipv4Match":true,"ipv6Match":true},"metrics":{"match":false,"expectedInterfaceSpeed":1000.0,"actualInterfaceSpeed":10009.0,"actualIpv6Connection":true,"expectedIpv6Connection":false},"routing":{"yamas":{"namespace":["Vespa"]}}}
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/filesize b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/filesize
index 4e9e2884874..d8148474ced 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/filesize
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/filesize
@@ -1 +1,2 @@
-63 \ No newline at end of file
+ PV Size 799.65 GB / not usable 0.00 GB
+ PV Size 960.19 GB / not usable 0.01 GB \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoTest.json b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoTest.json
index d0779af5feb..7017a4e6453 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoTest.json
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoTest.json
@@ -3,7 +3,7 @@
"id": "20004731.ostk.bm1.prod.ir2.yahoo.com",
"state": "ready",
"type": "tenant",
- "hostname": "20004731.ostk.bm1.prod.ir2.yahoo.com",
+ "hostname": "",
"openStackId": "77df66c5-3cbc-4905-b0e9-f790bddd13bf",
"fastDisk": false,
"flavor": "C-2B/24/500",
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepo.json b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepo.json
index 8631c2a51aa..81c8494ca6b 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepo.json
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepo.json
@@ -7,7 +7,7 @@
"openStackId": "653c39c1-bda4-47ee-a277-d5319eb57af7",
"flavor": "C-77E/256/960",
"canonicalFlavor": "C-77E/256/960",
- "minDiskAvailableGb": 63.0,
+ "minDiskAvailableGb": 1759.84,
"minMainMemoryAvailableGb": 4.042128,
"description": "BARE_METAL with 48.0 CPUs, 256.0 Gb memory and 1920.0 Gb ssd",
"minCpuCores": 4.0,
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepoVirtualMachine.json b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepoVirtualMachine.json
new file mode 100644
index 00000000000..6a0223d325c
--- /dev/null
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodes/v2/node/nodeRepoVirtualMachine.json
@@ -0,0 +1,51 @@
+{
+ "url": "https://api.vespa.corp.yahoo.com:4443/zone/v2/prod/eu-west-1/nodes/v2/node/oxy-oxygen-0ac90d2e.ir2.yahoo.com",
+ "id": "oxy-oxygen-0ac90d2e.ir2.yahoo.com",
+ "state": "ready",
+ "type": "tenant",
+ "hostname": "oxy-oxygen-0ac90d2e.ir2.yahoo.com",
+ "parentHostname": "hv122.ostk.cl1.prod.ir2.yahoo.com",
+ "openStackId": "9171477a-35be-4a60-81b0-2b631a36c712",
+ "flavor": "v-4-8-100",
+ "canonicalFlavor": "v-4-8-100",
+ "minDiskAvailableGb": 100.0,
+ "minMainMemoryAvailableGb": 8.0,
+ "description": "VIRTUAL_MACHINE with 4.0 CPUs, 8.0 Gb memory and 100.0 Gb disk",
+ "minCpuCores": 4.0,
+ "cost": 15,
+ "fastDisk": false,
+ "environment": "VIRTUAL_MACHINE",
+ "rebootGeneration": 9,
+ "currentRebootGeneration": 9,
+ "vespaVersion": "6.132.102",
+ "currentDockerImage": "docker-registry.ops.yahoo.com:4443/vespa/ci:6.132.102",
+ "hostedVersion": "6.132.102",
+ "convergedStateVersion": "6.132.102",
+ "failCount": 2,
+ "hardwareFailure": false,
+ "wantToRetire": false,
+ "wantToDeprovision": false,
+ "history": [
+ {
+ "event": "readied",
+ "at": 1488621028325,
+ "agent": "system"
+ },
+ {
+ "event": "rebooted",
+ "at": 1500455903916,
+ "agent": "system"
+ },
+ {
+ "event": "requested",
+ "at": 1501598263220,
+ "agent": "system"
+ }
+ ],
+ "ipAddresses": [
+ "10.201.13.46"
+ ],
+ "additionalIpAddresses": [
+
+ ]
+} \ No newline at end of file
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetrieverTest.java
index f93791bb78d..cf9bc3e1b89 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetrieverTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetrieverTest.java
@@ -10,6 +10,7 @@ import java.io.IOException;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
/**
* Created by olaa on 06/07/2017.
@@ -35,7 +36,7 @@ public class DiskRetrieverTest {
commandExecutor.addCommand(CAT_RESOURCE_PATH + "filesize");
diskRetriever.updateInfo();
assertEquals(DiskType.FAST, hardwareInfo.getDiskType());
- double expectedSize = 63D;
+ double expectedSize = 1759.84;
assertEquals(expectedSize, hardwareInfo.getMinDiskAvailableGb(), DELTA);
}
@@ -50,7 +51,7 @@ public class DiskRetrieverTest {
public void updateDiskSize__should_store_diskSize_in_hardwareInfo() throws IOException {
commandExecutor.addCommand(CAT_RESOURCE_PATH + "filesize");
diskRetriever.updateDiskSize();
- double expectedSize = 63D;
+ double expectedSize = 1759.84;
assertEquals(expectedSize, hardwareInfo.getMinDiskAvailableGb(), DELTA);
}
@@ -72,24 +73,27 @@ public class DiskRetrieverTest {
}
@Test
- public void parseDiskType_with_invalid_output_stream_should_not_find_disk_type() throws Exception {
- ArrayList<String> mockOutput = commandExecutor.outputFromString("Name Rota \nsda x");
- ParseResult parseResult = diskRetriever.parseDiskType(mockOutput);
- ParseResult expectedParseResult = new ParseResult("sda", "x");
- assertEquals(expectedParseResult, parseResult);
- mockOutput = commandExecutor.outputFromString("Name Rota");
- parseResult = diskRetriever.parseDiskType(mockOutput);
- expectedParseResult = new ParseResult("invalid", "invalid");
- assertEquals(expectedParseResult, parseResult);
+ public void parseDiskType_with_invalid_outputstream_does_not_contain_searchword_should_throw_exception() throws Exception {
+ ArrayList<String> mockOutput = commandExecutor.outputFromString("Name Rota");
+ try{
+ ParseResult parseResult = diskRetriever.parseDiskType(mockOutput);
+ fail("Should have thrown IOException when outputstream doesn't contain search word");
+ } catch (IOException e) {
+ String expectedExceptionMessage = "Parsing for disk type failed";
+ assertEquals(expectedExceptionMessage, e.getMessage());
+ }
+
}
@Test
public void parseDiskSize_should_find_size_from_file_and_insert_into_parseResult() throws Exception {
String filepath = "src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/filesize";
ArrayList<String> mockOutput = MockCommandExecutor.readFromFile(filepath);
- ParseResult parseResult = diskRetriever.parseDiskSize(mockOutput);
- ParseResult expectedParseResult = new ParseResult("63", "63");
- assertEquals(expectedParseResult, parseResult);
+ ArrayList<ParseResult> parseResults = diskRetriever.parseDiskSize(mockOutput);
+ ParseResult expectedParseResult1 = new ParseResult("Size", "799.65");
+ assertEquals(expectedParseResult1, parseResults.get(0));
+ ParseResult expectedParseResult2 = new ParseResult("Size", "960.19");
+ assertEquals(expectedParseResult2, parseResults.get(1));
}
@Test
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetrieverTest.java
index f549753918a..ffa0a44feb3 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetrieverTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfoRetrieverTest.java
@@ -36,7 +36,7 @@ public class HardwareInfoRetrieverTest {
expectedHardwareInfo.setMinCpuCores(4);
expectedHardwareInfo.setMinMainMemoryAvailableGb(4.042128);
expectedHardwareInfo.setInterfaceSpeedMbs(1000);
- expectedHardwareInfo.setMinDiskAvailableGb(63);
+ expectedHardwareInfo.setMinDiskAvailableGb(1759.84);
expectedHardwareInfo.setIpv4Interface(true);
expectedHardwareInfo.setIpv6Interface(false);
expectedHardwareInfo.setIpv6Connection(false);
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java
index b3a273ddd39..73678d4a3b1 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java
@@ -12,6 +12,7 @@ import java.util.Arrays;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Created by sgrostad on 07/07/2017.
@@ -149,11 +150,15 @@ public class NetRetrieverTest {
}
@Test
- public void parsePingResponse_invalid_ping_response_should_return_invalid_ParseResult() throws IOException {
+ public void parsePingResponse_invalid_ping_response_should_throw_IOException() throws IOException {
ArrayList<String> mockCommandOutput = MockCommandExecutor.readFromFile(INVALID_PING_RESPONSE);
- ParseResult parseResult = net.parsePingResponse(mockCommandOutput);
- ParseResult expectedParseResult = new ParseResult(PING_SEARCH_WORD, "invalid");
- assertEquals(expectedParseResult, parseResult);
+ try {
+ ParseResult parseResult = net.parsePingResponse(mockCommandOutput);
+ fail("Expected an IOException to be thrown");
+ } catch (IOException e) {
+ String expectedExceptionMessage = "Failed to parse ping output.";
+ assertEquals(expectedExceptionMessage, e.getMessage());
+ }
}
@Test