diff options
14 files changed, 71 insertions, 71 deletions
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparator.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparator.java index 8a635e2e3ec..b201e5c803d 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparator.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparator.java @@ -12,6 +12,8 @@ import com.yahoo.vespa.hosted.node.verification.spec.yamasreport.YamasSpecReport */ public class HardwareNodeComparator { + private static final double PERCENTAGE_THRESHOLD = 0.05; + public static YamasSpecReport compare(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware) { Boolean equalHardware = true; YamasSpecReport yamasSpecReport = new YamasSpecReport(); @@ -36,25 +38,25 @@ public class HardwareNodeComparator { return yamasSpecReport; } - private static void setReportMetrics(HardwareInfo node, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { - setMemoryMetrics(node, actualHardware, specReportMetrics); - setCpuMetrics(node, actualHardware, specReportMetrics); - setDiskTypeMetrics(node, actualHardware, specReportMetrics); - setDiskSpaceMetrics(node, actualHardware, specReportMetrics); - setNetMetrics(node, actualHardware, specReportMetrics); + private static void setReportMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { + setMemoryMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics); + setCpuMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics); + setDiskTypeMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics); + setDiskSpaceMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics); + setNetMetrics(nodeRepoHardwareInfo, actualHardware, specReportMetrics); } - private static void setMemoryMetrics(HardwareInfo node, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { - double expectedMemory = node.getMinMainMemoryAvailableGb(); + private static void setMemoryMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { + double expectedMemory = nodeRepoHardwareInfo.getMinMainMemoryAvailableGb(); double actualMemory = actualHardware.getMinMainMemoryAvailableGb(); - if (!insideThreshold(expectedMemory, actualMemory)) { + if (!insideThreshold(expectedMemory, actualMemory, PERCENTAGE_THRESHOLD)) { specReportMetrics.setExpectedMemoryAvailable(expectedMemory); specReportMetrics.setActualMemoryAvailable(actualMemory); } } - private static void setCpuMetrics(HardwareInfo node, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { - int expectedCpuCores = node.getMinCpuCores(); + private static void setCpuMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { + int expectedCpuCores = nodeRepoHardwareInfo.getMinCpuCores(); int actualCpuCores = actualHardware.getMinCpuCores(); if (expectedCpuCores != actualCpuCores) { specReportMetrics.setExpectedcpuCores(expectedCpuCores); @@ -62,8 +64,8 @@ public class HardwareNodeComparator { } } - private static void setDiskTypeMetrics(HardwareInfo node, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { - DiskType expectedFastDisk = node.getDiskType(); + private static void setDiskTypeMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { + DiskType expectedFastDisk = nodeRepoHardwareInfo.getDiskType(); DiskType actualFastDisk = actualHardware.getDiskType(); if (expectedFastDisk != null && actualFastDisk != null && expectedFastDisk != actualFastDisk) { specReportMetrics.setExpectedDiskType(expectedFastDisk); @@ -71,63 +73,63 @@ public class HardwareNodeComparator { } } - private static void setDiskSpaceMetrics(HardwareInfo node, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { - double expectedDiskSpace = node.getMinDiskAvailableGb(); + private static void setDiskSpaceMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { + double expectedDiskSpace = nodeRepoHardwareInfo.getMinDiskAvailableGb(); double actualDiskSpace = actualHardware.getMinDiskAvailableGb(); - if (!insideThreshold(expectedDiskSpace, actualDiskSpace)) { + if (!insideThreshold(expectedDiskSpace, actualDiskSpace, PERCENTAGE_THRESHOLD)) { specReportMetrics.setExpectedDiskSpaceAvailable(expectedDiskSpace); specReportMetrics.setActualDiskSpaceAvailable(actualDiskSpace); } } - private static void setNetMetrics(HardwareInfo node, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { - double expectedInterfaceSpeed = node.getInterfaceSpeedMbs(); + private static void setNetMetrics(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportMetrics specReportMetrics) { + double expectedInterfaceSpeed = nodeRepoHardwareInfo.getInterfaceSpeedMbs(); double actualInterfaceSpeed = actualHardware.getInterfaceSpeedMbs(); - if (!insideThreshold(expectedInterfaceSpeed, actualInterfaceSpeed)) { + //if (!insideThreshold(expectedInterfaceSpeed, actualInterfaceSpeed, PERCENTAGE_THRESHOLD)) { specReportMetrics.setExpectedInterfaceSpeed(expectedInterfaceSpeed); specReportMetrics.setActualInterfaceSpeed(actualInterfaceSpeed); - } + //} TODO uncomment this if wanted - if (node.isIpv6Connection() != actualHardware.isIpv6Connection()) { + if (nodeRepoHardwareInfo.isIpv6Connection() != actualHardware.isIpv6Connection()) { specReportMetrics.setActualIpv6Connection(actualHardware.isIpv6Connection()); - specReportMetrics.setExpectedIpv6Connection(node.isIpv6Connection()); + specReportMetrics.setExpectedIpv6Connection(nodeRepoHardwareInfo.isIpv6Connection()); } } - private static boolean compareCPU(HardwareInfo node, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) { - boolean equalCPU = node.getMinCpuCores() == actualHardware.getMinCpuCores(); + private static boolean compareCPU(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) { + boolean equalCPU = nodeRepoHardwareInfo.getMinCpuCores() == actualHardware.getMinCpuCores(); specReportDimensions.setCpuCoresMatch(equalCPU); return equalCPU; } - private static boolean compareMemory(HardwareInfo node, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) { - boolean equalMemory = insideThreshold(node.getMinMainMemoryAvailableGb(), actualHardware.getMinMainMemoryAvailableGb()); + private static boolean compareMemory(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) { + boolean equalMemory = insideThreshold(nodeRepoHardwareInfo.getMinMainMemoryAvailableGb(), actualHardware.getMinMainMemoryAvailableGb(), PERCENTAGE_THRESHOLD); specReportDimensions.setMemoryMatch(equalMemory); return equalMemory; } - private static boolean compareNetInterface(HardwareInfo node, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) { - boolean equalNetInterfaceSpeed = insideThreshold(node.getInterfaceSpeedMbs(), actualHardware.getInterfaceSpeedMbs()); - boolean equalIpv6Interface = node.getIpv6Interface() == actualHardware.getIpv6Interface(); - boolean equalIpv4Interface = node.getIpv4Interface() == actualHardware.getIpv4Interface(); - boolean equalIpv6Connection = node.isIpv6Connection() == actualHardware.isIpv6Connection(); + private static boolean compareNetInterface(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) { + boolean equalNetInterfaceSpeed = insideThreshold(nodeRepoHardwareInfo.getInterfaceSpeedMbs(), actualHardware.getInterfaceSpeedMbs(), PERCENTAGE_THRESHOLD); + boolean equalIpv6Interface = nodeRepoHardwareInfo.getIpv6Interface() == actualHardware.getIpv6Interface(); + boolean equalIpv4Interface = nodeRepoHardwareInfo.getIpv4Interface() == actualHardware.getIpv4Interface(); + boolean equalIpv6Connection = nodeRepoHardwareInfo.isIpv6Connection() == actualHardware.isIpv6Connection(); specReportDimensions.setNetInterfaceSpeedMatch(equalNetInterfaceSpeed); specReportDimensions.setIpv6Match(equalIpv6Interface); specReportDimensions.setIpv4Match(equalIpv4Interface); - return equalNetInterfaceSpeed && equalIpv6Interface && equalIpv4Interface && equalIpv6Connection; + return equalIpv4Interface && equalIpv6Connection; // && equalNetInterfaceSpeed && equalIpv6Interface; TODO include these if wanted. } - private static boolean compareDisk(HardwareInfo node, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) { - boolean equalDiskType = node.getDiskType() == actualHardware.getDiskType(); - boolean equalDiskSize = insideThreshold(node.getMinDiskAvailableGb(), actualHardware.getMinDiskAvailableGb()); + private static boolean compareDisk(HardwareInfo nodeRepoHardwareInfo, HardwareInfo actualHardware, SpecReportDimensions specReportDimensions) { + boolean equalDiskType = nodeRepoHardwareInfo.getDiskType() == actualHardware.getDiskType(); + boolean equalDiskSize = insideThreshold(nodeRepoHardwareInfo.getMinDiskAvailableGb(), actualHardware.getMinDiskAvailableGb(), PERCENTAGE_THRESHOLD); specReportDimensions.setDiskTypeMatch(equalDiskType); specReportDimensions.setDiskAvailableMatch(equalDiskSize); return equalDiskType && equalDiskSize; } - private static boolean insideThreshold(double value1, double value2) { - double lowerThresholdPercentage = 0.8; - double upperThresholdPercentage = 1.2; + private static boolean insideThreshold(double value1, double value2 , double thresholdPercentage) { + double lowerThresholdPercentage = 1 - thresholdPercentage; + double upperThresholdPercentage = 1 + thresholdPercentage; return value1 > lowerThresholdPercentage * value2 && value1 < upperThresholdPercentage * value2; } diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifier.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifier.java index c2b295684a8..ea263abb723 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifier.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/SpecVerifier.java @@ -25,7 +25,7 @@ import java.util.logging.Logger; public class SpecVerifier { private static final Logger logger = Logger.getLogger(SpecVerifier.class.getName()); - private static final String VIRTUAL_ENVIRONMENT= "VIRTUAL_MACHINE"; + private static final String VIRTUAL_ENVIRONMENT = "VIRTUAL_MACHINE"; public static boolean verifySpec(CommandExecutor commandExecutor) throws IOException { NodeRepoJsonModel nodeRepoJsonModel = getNodeRepositoryJSON(commandExecutor); @@ -64,7 +64,7 @@ public class SpecVerifier { public static void main(String[] args) throws IOException { CommandExecutor commandExecutor = new CommandExecutor(); - if (!SpecVerifier.verifySpec(commandExecutor)){ + if (!SpecVerifier.verifySpec(commandExecutor)) { System.exit(2); } } diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifier.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifier.java index 9333a1e979a..bdbfae33651 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifier.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/IPAddressVerifier.java @@ -115,7 +115,7 @@ public class IPAddressVerifier { String[] octets = ipAddress.split("\\."); StringBuilder convertedIpAddress = new StringBuilder(); for (int i = octets.length - 1; i >= 0; i--) { - convertedIpAddress.append(octets[i] + "."); + convertedIpAddress.append(octets[i]).append("."); } convertedIpAddress.append(domain); return convertedIpAddress.toString(); diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoJsonModel.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoJsonModel.java index 2367d255987..3b7f2058ca3 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoJsonModel.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/noderepo/NodeRepoJsonModel.java @@ -54,7 +54,7 @@ public class NodeRepoJsonModel { } public String getIpv4Address() { - String ipv4Regex = "((1?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}(1?\\d\\d?|2[0-4]\\d|2\u200C\u200B5[0-5])"; + String ipv4Regex = "^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$"; for (String ipAddress : ipAddresses) { if (ipAddress.matches(ipv4Regex)) { return ipAddress; diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetriever.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetriever.java index 42d459217a0..2a0dafd8cd4 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetriever.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetriever.java @@ -37,8 +37,8 @@ public class DiskRetriever implements HardwareRetriever { } public void updateInfo() { - updateDiskType(); - updateDiskSize(); + updateDiskType(); + updateDiskSize(); } protected void updateDiskType() { @@ -88,19 +88,18 @@ public class DiskRetriever implements HardwareRetriever { return OutputParser.parseOutput(parseInstructions, commandOutput); } - protected void setDiskSize(ArrayList<ParseResult> parseResults) { - double diskSize = 0; - try { - for (ParseResult parseResult : parseResults) { - String sizeValue = parseResult.getValue().replaceAll("[^\\d.]", ""); - diskSize += Double.parseDouble(sizeValue); - } - } catch (NumberFormatException | NullPointerException e) { - logger.log(Level.WARNING, "Parse results contained an invalid PV size - ", parseResults); - } - finally { - hardwareInfo.setMinDiskAvailableGb(diskSize); - } + protected void setDiskSize(ArrayList<ParseResult> parseResults) { + double diskSize = 0; + try { + for (ParseResult parseResult : parseResults) { + String sizeValue = parseResult.getValue().replaceAll("[^\\d.]", ""); + diskSize += Double.parseDouble(sizeValue); + } + } catch (NumberFormatException | NullPointerException e) { + logger.log(Level.WARNING, "Parse results contained an invalid PV size - ", parseResults); + } finally { + hardwareInfo.setMinDiskAvailableGb(diskSize); + } } }
\ No newline at end of file diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfo.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfo.java index 5f534ad63af..b2a91924d50 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfo.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/HardwareInfo.java @@ -83,6 +83,4 @@ public class HardwareInfo { public enum DiskType {SLOW, FAST, UNKNOWN} - ; - } diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetriever.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetriever.java index da7e82aefb7..f82bafb5a97 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetriever.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetriever.java @@ -45,7 +45,7 @@ public class MemoryRetriever implements HardwareRetriever { ArrayList<String> searchWords = new ArrayList<>(Arrays.asList(SEARCH_WORD)); ParseInstructions parseInstructions = new ParseInstructions(SEARCH_ELEMENT_INDEX, RETURN_ELEMENT_INDEX, REGEX_SPLIT, searchWords); ParseResult parseResult = OutputParser.parseSingleOutput(parseInstructions, commandOutput); - if (!parseResult.getSearchWord().matches(SEARCH_WORD)){ + if (!parseResult.getSearchWord().matches(SEARCH_WORD)) { throw new IOException("Failed to parse memory info file."); } return parseResult; diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetriever.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetriever.java index c3ffd9adb6f..6bf5d7b300d 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetriever.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetriever.java @@ -73,7 +73,7 @@ public class NetRetriever implements HardwareRetriever { return parseResults; } - protected void findInterfaceSpeed(ArrayList<ParseResult> parseResults){ + protected void findInterfaceSpeed(ArrayList<ParseResult> parseResults) { try { String interfaceName = findInterfaceName(parseResults); String command = NET_CHECK_INTERFACE_SPEED + " " + interfaceName; @@ -107,8 +107,7 @@ public class NetRetriever implements HardwareRetriever { try { ArrayList<String> commandOutput = commandExecutor.executeCommand(PING_NET_COMMAND); parseResults.add(parsePingResponse(commandOutput)); - } - catch (ExecuteException e) { + } catch (ExecuteException e) { logger.log(Level.WARNING, "Failed to execute ping6"); } catch (IOException e) { logger.log(Level.WARNING, e.getMessage()); diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReport.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReport.java index 20cca45a7ad..7286c2d6d95 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReport.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/verification/spec/yamasreport/YamasSpecReport.java @@ -40,6 +40,7 @@ public class YamasSpecReport { public void setFaultyIpAddresses(String[] faultyIpAddresses) { this.metrics.setFaultyIpAddresses(faultyIpAddresses); + metrics.setMatch(false); } public SpecReportMetrics getMetrics() { 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 c56bac698ad..f8b960749c6 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 @@ -34,6 +34,7 @@ public class SpecVerifierTest { private static final String NET_INTERFACE_INFO_PATH = RESOURCE_PATH + "/ifconfig"; private static final String NET_INTERFACE_SPEED_INFO_PATH = RESOURCE_PATH + "/eth0"; private static final String PING_RESPONSE = RESOURCE_PATH + "/validpingresponse"; + private static final String INVALID_PING_RESPONSE = RESOURCE_PATH + "/pingresponse-all-packets-lost"; private static final double DELTA = 0.1; @Before @@ -64,7 +65,7 @@ public class SpecVerifierTest { } @Test - public void verifySpec_inequal_nodeRepoInfo_and_hardware_should_return_false() throws Exception { + public void verifySpec_unequal_nodeRepoInfo_and_hardware_should_return_false() throws Exception { mockCommandExecutor.addCommand("echo notUsed " + URL_RESOURCE_PATH); mockCommandExecutor.addCommand("echo nodeRepo.json"); mockCommandExecutor.addCommand("cat " + CPU_INFO_PATH); @@ -73,7 +74,7 @@ public class SpecVerifierTest { mockCommandExecutor.addCommand("cat " + DISK_SIZE_INFO_PATH); mockCommandExecutor.addCommand("cat " + NET_INTERFACE_INFO_PATH + "NoIpv6"); mockCommandExecutor.addCommand("cat " + NET_INTERFACE_SPEED_INFO_PATH); - mockCommandExecutor.addCommand("cat " + PING_RESPONSE); + mockCommandExecutor.addCommand("cat " + INVALID_PING_RESPONSE); assertFalse(SpecVerifier.verifySpec(mockCommandExecutor)); } 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 f063b300ba9..aa2b2104e38 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 @@ -26,7 +26,7 @@ public class IPAddressVerifierTest { private String ipv6LookupFormat; @Before - public void setup() throws Exception{ + 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))); @@ -69,7 +69,7 @@ public class IPAddressVerifierTest { } @Test - public void getFaultyIpAddresses_should_return_empty_array_when_parameters_are_invalid () { + public void getFaultyIpAddresses_should_return_empty_array_when_parameters_are_invalid() { assertEquals(0, ipAddressVerifier.getFaultyIpAddresses(new NodeRepoJsonModel()).length); } 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 8d07c519e44..729506fcab0 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 @@ -28,8 +28,8 @@ public class NodeRepoInfoRetrieverTest { } @Test - public void retrieve_should_return_nodeJSONModel_when_parameter_contains_valid_url () throws IOException{ - urls.add(new URL(URL_RESOURCE_PATH + "/nodeInfoTest.json")); + public void retrieve_should_return_nodeJSONModel_when_parameter_contains_valid_url() throws IOException { + urls.add(new URL(URL_RESOURCE_PATH + "/nodeInfoTest.json")); NodeRepoJsonModel nodeRepoJsonModel = NodeRepoInfoRetriever.retrieve(urls); double expectedMinDiskAvailable = 500.0; double expectedMinMainMemoryAvailable = 24.0; @@ -38,6 +38,7 @@ public class NodeRepoInfoRetrieverTest { assertEquals(expectedMinMainMemoryAvailable, nodeRepoJsonModel.getMinMainMemoryAvailableGb(), DELTA); assertEquals(expectedMinCpuCores, nodeRepoJsonModel.getMinCpuCores(), DELTA); } + @Test public void retrieve_should_throw_IOException_when_no_valid_URLs() throws MalformedURLException { urls = new ArrayList<>(); 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 index 6a0223d325c..08874998e0f 100644 --- 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 @@ -46,6 +46,5 @@ "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 cf9bc3e1b89..91646ba1cbe 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 @@ -75,7 +75,7 @@ public class DiskRetrieverTest { @Test public void parseDiskType_with_invalid_outputstream_does_not_contain_searchword_should_throw_exception() throws Exception { ArrayList<String> mockOutput = commandExecutor.outputFromString("Name Rota"); - try{ + try { ParseResult parseResult = diskRetriever.parseDiskType(mockOutput); fail("Should have thrown IOException when outputstream doesn't contain search word"); } catch (IOException e) { |