diff options
author | Sindre Grøstad <30319420+sgrostad@users.noreply.github.com> | 2017-08-18 13:43:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-18 13:43:23 +0200 |
commit | f377595af0630a974d15fe479b894087bf0bdc39 (patch) | |
tree | 8d52d00d7e62664f0eabc1c77cf4157836644b51 /node-maintainer/src/test/java/com/yahoo | |
parent | 4d04ee41f08726d2a49b91e9b5c0fe0a54e4b3b3 (diff) |
Interns/late changes (#3152)
* Add tests for reporting when old HardwareDivergence is wrong and when not existing
* ReportSender renamed to Reporter and READMEs updated
* Added TODO file in verification
* Added copyright headers
* code cleanup
Diffstat (limited to 'node-maintainer/src/test/java/com/yahoo')
26 files changed, 207 insertions, 87 deletions
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/CommandExecutorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/CommandExecutorTest.java index ffdf5e0a124..5e6eda93f03 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/CommandExecutorTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/CommandExecutorTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.commons; import org.junit.Before; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/HostURLGeneratorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/HostURLGeneratorTest.java index 428f6c0b738..ee28c97c35c 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/HostURLGeneratorTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/HostURLGeneratorTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.commons; import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor; @@ -7,7 +8,6 @@ import org.junit.Test; import java.io.IOException; import java.net.URL; import java.util.ArrayList; -import java.util.stream.Collectors; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/IPAddressVerifierTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/IPAddressVerifierTest.java index 7878bbeac5d..bc4c5b517c0 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/IPAddressVerifierTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/IPAddressVerifierTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.commons.noderepo; import org.junit.Before; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/NodeJsonConverterTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/NodeJsonConverterTest.java index 24280e99cfa..a6c958446a3 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/NodeJsonConverterTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/NodeJsonConverterTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.commons.noderepo; import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/NodeRepoInfoRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/NodeRepoInfoRetrieverTest.java index 8d7cf4d06f0..b0a8580aeca 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/NodeRepoInfoRetrieverTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/NodeRepoInfoRetrieverTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.commons.noderepo; import org.junit.Before; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/parser/OutputParserTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/parser/OutputParserTest.java index 03c2bcb062f..f8feeab098a 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/parser/OutputParserTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/parser/OutputParserTest.java @@ -1,8 +1,6 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.commons.parser; -import com.yahoo.vespa.hosted.node.verification.commons.parser.OutputParser; -import com.yahoo.vespa.hosted.node.verification.commons.parser.ParseInstructions; -import com.yahoo.vespa.hosted.node.verification.commons.parser.ParseResult; import org.junit.Before; import org.junit.Test; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/BenchmarkReportTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/BenchmarkReportTest.java index ef642335db5..7cad1f2fb91 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/BenchmarkReportTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/BenchmarkReportTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.commons.report; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/ReportSenderTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/ReportSenderTest.java deleted file mode 100644 index 48a90082417..00000000000 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/ReportSenderTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.yahoo.vespa.hosted.node.verification.commons.report; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.net.URL; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; - -public class ReportSenderTest { - - private final ByteArrayOutputStream println = new ByteArrayOutputStream(); - 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/nodeInfoTest.json"; - private static final String URL_RESOURCE_PATH = "file://" + ABSOLUTE_PATH + "/" + RESOURCE_PATH; - private static ArrayList<URL> nodeInfoUrls; - - @Before - public void setup() throws IOException { - System.setOut(new PrintStream(println)); - URL nodeInfoUrlWithAlreadyExistingHardwareDivergence = new URL(URL_RESOURCE_PATH); - nodeInfoUrls = new ArrayList<>(Arrays.asList(nodeInfoUrlWithAlreadyExistingHardwareDivergence)); - } - - @After - public void cleanUpStream() { - System.setOut(System.out); - } - - @Test - public void reportBenchmarkResults_should_update_already_existing_hardwareDivergence_changing_existing_values() throws Exception { - BenchmarkReport benchmarkReport = new BenchmarkReport(); - double cpuCyclesPerSec = 0.3; - double memoryReadSpeedGBs = 0.1; - benchmarkReport.setCpuCyclesPerSec(cpuCyclesPerSec); - benchmarkReport.setMemoryReadSpeedGBs(memoryReadSpeedGBs); - String expectedReport = "{\"benchmarkReport\":{\"cpuCyclesPerSec\":0.3,\"memoryReadSpeedGBs\":0.1}}"; - ReportSender.reportBenchmarkResults(benchmarkReport,nodeInfoUrls); - assertEquals(expectedReport, println.toString()); - } - - @Test - public void reportBenchmarkResults_should_should_update_already_existing_hardwareDivergence_prints_null_when_empty_benchmarkReport() throws Exception { - BenchmarkReport benchmarkReport = new BenchmarkReport(); - String expectedReport = "null"; - ReportSender.reportBenchmarkResults(benchmarkReport, nodeInfoUrls); - assertEquals(expectedReport, println.toString()); - } - - @Test - public void reportSpecVerificationResults_should_update_already_existing_hardwareDivergence_adding_report_type() throws Exception { - SpecVerificationReport specVerificationReport = new SpecVerificationReport(); - double actualDiskSpaceAvailable = 150D; - boolean actualIpv6Connection = false; - specVerificationReport.setActualDiskSpaceAvailable(actualDiskSpaceAvailable); - specVerificationReport.setActualIpv6Connection(actualIpv6Connection); - String expectedReport = "{\"specVerificationReport\":{\"actualDiskSpaceAvailable\":150.0,\"actualIpv6Connection\":false},\"benchmarkReport\":{\"cpuCyclesPerSec\":0.5}}"; - ReportSender.reportSpecVerificationResults(specVerificationReport, nodeInfoUrls); - assertEquals(expectedReport, println.toString()); - } - -}
\ No newline at end of file diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/ReporterTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/ReporterTest.java new file mode 100644 index 00000000000..a9f3a7b3743 --- /dev/null +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/ReporterTest.java @@ -0,0 +1,98 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.node.verification.commons.report; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.net.URL; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; + +import static org.junit.Assert.assertEquals; + +public class ReporterTest { + + private final ByteArrayOutputStream println = new ByteArrayOutputStream(); + private static final String ABSOLUTE_PATH = Paths.get(".").toAbsolutePath().normalize().toString(); + private static final String RESOURCE_PATH_TO_VALID_HARDWARE_DIVERGENCE = "src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoTest.json"; + private static final String RESOURCE_PATH_TO_INVALID_HARDWARE_DIVERGENCE = "src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoNotInterpretableHardwareDivergence.json"; + private static final String RESOURCE_PATH_TO_EMPTY_HARDWARE_DIVERGENCE = "src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeRepo.json"; + private static final String URL_VALID_RESOURCE_PATH = "file://" + ABSOLUTE_PATH + "/" + RESOURCE_PATH_TO_VALID_HARDWARE_DIVERGENCE; + private static final String URL_INVALID_RESOURCE_PATH = "file://" + ABSOLUTE_PATH + "/" + RESOURCE_PATH_TO_INVALID_HARDWARE_DIVERGENCE; + private static final String URL_EMPTY_RESOURCE_PATH = "file://" + ABSOLUTE_PATH + "/" + RESOURCE_PATH_TO_EMPTY_HARDWARE_DIVERGENCE; + private static ArrayList<URL> nodeInfoUrlsToValidHardwareDivergence; + private static ArrayList<URL> nodeInfoUrlsToNOTValidHardwareDivergence; + private static ArrayList<URL> nodeInfoUrlsWithNoHardwareDivergence; + + @Before + public void setup() throws IOException { + System.setOut(new PrintStream(println)); + URL nodeInfoUrlWithAlreadyExistingHardwareDivergence = new URL(URL_VALID_RESOURCE_PATH); + nodeInfoUrlsToValidHardwareDivergence = new ArrayList<>(Arrays.asList(nodeInfoUrlWithAlreadyExistingHardwareDivergence)); + URL nodeInfoUrlWithExistingButWrongHardwareDivergence = new URL(URL_INVALID_RESOURCE_PATH); + nodeInfoUrlsToNOTValidHardwareDivergence = new ArrayList<>(Arrays.asList(nodeInfoUrlWithExistingButWrongHardwareDivergence)); + URL nodeInfoUrlWithNoHardwareDivergence = new URL(URL_EMPTY_RESOURCE_PATH); + nodeInfoUrlsWithNoHardwareDivergence = new ArrayList<>(Arrays.asList(nodeInfoUrlWithNoHardwareDivergence)); + } + + @After + public void cleanUpStream() { + System.setOut(System.out); + } + + @Test + public void reportBenchmarkResults_should_update_already_existing_hardwareDivergence_changing_existing_values() throws Exception { + BenchmarkReport benchmarkReport = new BenchmarkReport(); + double cpuCyclesPerSec = 0.3; + double memoryReadSpeedGBs = 0.1; + benchmarkReport.setCpuCyclesPerSec(cpuCyclesPerSec); + benchmarkReport.setMemoryReadSpeedGBs(memoryReadSpeedGBs); + String expectedReport = "{\"benchmarkReport\":{\"cpuCyclesPerSec\":0.3,\"memoryReadSpeedGBs\":0.1}}"; + Reporter.reportBenchmarkResults(benchmarkReport, nodeInfoUrlsToValidHardwareDivergence); + assertEquals(expectedReport, println.toString()); + } + + @Test + public void reportBenchmarkResults_should_should_update_already_existing_hardwareDivergence_prints_null_when_empty_benchmarkReport() throws Exception { + BenchmarkReport benchmarkReport = new BenchmarkReport(); + String expectedReport = "null"; + Reporter.reportBenchmarkResults(benchmarkReport, nodeInfoUrlsToValidHardwareDivergence); + assertEquals(expectedReport, println.toString()); + } + + @Test + public void reportSpecVerificationResults_should_update_already_existing_hardwareDivergence_adding_report_type() throws Exception { + SpecVerificationReport specVerificationReport = new SpecVerificationReport(); + double actualDiskSpaceAvailable = 150D; + boolean actualIpv6Connection = false; + specVerificationReport.setActualDiskSpaceAvailable(actualDiskSpaceAvailable); + specVerificationReport.setActualIpv6Connection(actualIpv6Connection); + String expectedReport = "{\"specVerificationReport\":{\"actualDiskSpaceAvailable\":150.0,\"actualIpv6Connection\":false},\"benchmarkReport\":{\"cpuCyclesPerSec\":0.5}}"; + Reporter.reportSpecVerificationResults(specVerificationReport, nodeInfoUrlsToValidHardwareDivergence); + assertEquals(expectedReport, println.toString()); + } + + @Test + public void reportSpecVerificationResults_make_new_correct_hardwareDivergence_because_old_is_wrong() throws Exception { + SpecVerificationReport specVerificationReport = new SpecVerificationReport(); + double actualDiskSpaceAvailable = 150D; + specVerificationReport.setActualDiskSpaceAvailable(actualDiskSpaceAvailable); + String expectedReport = "{\"specVerificationReport\":{\"actualDiskSpaceAvailable\":150.0}}"; + Reporter.reportSpecVerificationResults(specVerificationReport, nodeInfoUrlsToNOTValidHardwareDivergence); + assertEquals(expectedReport, println.toString()); + } + + @Test + public void reportSpecVerificationResults_make_new_empty_hardwareDivergence_because_there_is_no_old() throws Exception { + SpecVerificationReport specVerificationReport = new SpecVerificationReport(); + String expectedReport = "null"; + Reporter.reportSpecVerificationResults(specVerificationReport, nodeInfoUrlsWithNoHardwareDivergence); + assertEquals(expectedReport, println.toString()); + } + +}
\ No newline at end of file diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/SpecVerificationReportTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/SpecVerificationReportTest.java index 07d4bf4e5c1..0ee33683465 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/SpecVerificationReportTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/report/SpecVerificationReportTest.java @@ -1,13 +1,13 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.commons.report; import com.fasterxml.jackson.databind.ObjectMapper; -import com.yahoo.vespa.hosted.node.verification.commons.report.SpecVerificationReport; import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor; import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; public class SpecVerificationReportTest { diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspectorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspectorTest.java index 7314839c438..835f5c4167a 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspectorTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/BenchmarkResultInspectorTest.java @@ -1,15 +1,13 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.hardware; -import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.BenchmarkResults; import com.yahoo.vespa.hosted.node.verification.commons.report.BenchmarkReport; +import com.yahoo.vespa.hosted.node.verification.hardware.benchmarks.BenchmarkResults; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; public class BenchmarkResultInspectorTest { diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/HardwareBenchmarkerTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/HardwareBenchmarkerTest.java index 159cddb7640..8666d47b718 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/HardwareBenchmarkerTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/HardwareBenchmarkerTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.hardware; import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmarkTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmarkTest.java index 3620e29f87a..11aeb7cbe73 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmarkTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmarkTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.hardware.benchmarks; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/DiskBenchmarkTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/DiskBenchmarkTest.java index 04681357fc7..fc3c79b0e67 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/DiskBenchmarkTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/DiskBenchmarkTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.hardware.benchmarks; import com.yahoo.vespa.hosted.node.verification.commons.parser.ParseResult; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/MemoryBenchmarkTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/MemoryBenchmarkTest.java index 3f0d5ebdce1..945c53cdf2f 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/MemoryBenchmarkTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/MemoryBenchmarkTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.hardware.benchmarks; import com.yahoo.vespa.hosted.node.verification.commons.parser.ParseResult; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/mock/MockCommandExecutor.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/mock/MockCommandExecutor.java index 5b0da7d1948..83f542e7142 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/mock/MockCommandExecutor.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/mock/MockCommandExecutor.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.mock; import com.yahoo.vespa.hosted.node.verification.commons.CommandExecutor; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparatorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparatorTest.java index 30dff7c1c42..b997ad61c4a 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparatorTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/HardwareNodeComparatorTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.spec; import com.fasterxml.jackson.databind.ObjectMapper; @@ -7,8 +8,6 @@ import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; /** * Created by olaa on 07/07/2017. 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 9cf3cf7138e..6aa8955647d 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 @@ -1,11 +1,12 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.spec; import com.fasterxml.jackson.databind.ObjectMapper; -import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor; import com.yahoo.vespa.hosted.node.verification.commons.noderepo.NodeRepoInfoRetriever; import com.yahoo.vespa.hosted.node.verification.commons.noderepo.NodeRepoJsonModel; -import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo; import com.yahoo.vespa.hosted.node.verification.commons.report.SpecVerificationReport; +import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor; +import com.yahoo.vespa.hosted.node.verification.spec.retrievers.HardwareInfo; import org.junit.Before; import org.junit.Test; 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 index 4fcb5efed9e..a3bd4957467 100644 --- 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 @@ -77,6 +77,5 @@ "2001:db8:0:1234:0:567:8:1" ], "additionalIpAddresses": [ - ] }
\ No newline at end of file diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoNotInterpretableHardwareDivergence.json b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoNotInterpretableHardwareDivergence.json new file mode 100644 index 00000000000..0faf1873446 --- /dev/null +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/resources/nodeInfoNotInterpretableHardwareDivergence.json @@ -0,0 +1,82 @@ +{ + "url": "https://api.vespayahoo.com", + "id": "id.prod.yahoo.com", + "state": "failed", + "type": "host", + "hostname": "hostname", + "openStackId": "4a8689e1-3a8e-4f50-b99f-d33b245a9661", + "flavor": "C-2T/24/500", + "canonicalFlavor": "C-2B/24/500", + "minDiskAvailableGb": 500.0, + "minMainMemoryAvailableGb": 24.0, + "description": "BARE_METAL with 24.0 CPUs, 24.0 Gb memory and 500.0 Gb disk", + "minCpuCores": 24.0, + "cost": 70, + "fastDisk": false, + "environment": "BARE_METAL", + "owner": { + "tenant": "hosted-vespa", + "application": "routing", + "instance": "default" + }, + "membership": { + "clustertype": "container", + "clusterid": "node-admin", + "group": "0", + "index": 32, + "retired": false + }, + "restartGeneration": 0, + "currentRestartGeneration": 0, + "wantedDockerImage": "docker-registry.ops.yahoo.com:4443/vespa/ci:6.138.1", + "wantedVespaVersion": "6.138.1", + "rebootGeneration": 49, + "currentRebootGeneration": 49, + "vespaVersion": "6.138.18", + "currentDockerImage": "docker-registry.ops.yahoo.com:4443/vespa/ci:6.138.18", + "hostedVersion": "6.138.18", + "convergedStateVersion": "6.138.18", + "failCount": 44, + "hardwareFailure": true, + "hardwareFailureType": "disk_smart", + "hardwareFailureDescription": "disk_smart", + "wantToRetire": false, + "wantToDeprovision": false, + "history": [ + { + "event": "readied", + "at": 1501070910372, + "agent": "system" + }, + { + "event": "reserved", + "at": 1501070952692, + "agent": "application" + }, + { + "event": "activated", + "at": 1501070958698, + "agent": "application" + }, + { + "event": "rebooted", + "at": 1501656469859, + "agent": "system" + }, + { + "event": "down", + "at": 1502809344596, + "agent": "system" + }, + { + "event": "failed", + "at": 1502812976621, + "agent": "system" + } + ], + "ipAddresses": [ + ], + "additionalIpAddresses": [ + ], + "hardwareDivergence": "{\"hardwareDivergence\": null - it will not manage to parse this}" +}
\ 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 216991846b0..c557afb3256 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 @@ -45,6 +45,5 @@ "10.200.66.16" ], "additionalIpAddresses": [], - "hardwareDivergence": "{\"benchmarkReport\": {\"cpuCyclesPerSec\": 0.5}}" }
\ No newline at end of file diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/CPURetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/CPURetrieverTest.java index 7697f821220..cda8066734d 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/CPURetrieverTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/CPURetrieverTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.spec.retrievers; import com.yahoo.vespa.hosted.node.verification.commons.parser.ParseResult; 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 1a9e035ab7b..da10c8517a3 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 @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.spec.retrievers; import com.yahoo.vespa.hosted.node.verification.commons.parser.ParseResult; 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 c068ca83de9..1a46cb0863f 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 @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.spec.retrievers; @@ -5,10 +6,10 @@ import com.yahoo.vespa.hosted.node.verification.mock.MockCommandExecutor; import com.yahoo.vespa.hosted.node.verification.spec.VerifierSettings; import org.junit.Before; import org.junit.Test; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; public class HardwareInfoRetrieverTest { diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetrieverTest.java index f09ab76e79b..257f64af54e 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetrieverTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetrieverTest.java @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.spec.retrievers; import com.yahoo.vespa.hosted.node.verification.commons.parser.ParseResult; 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 64f32b22ca7..dedb2d3d659 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 @@ -1,3 +1,4 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.verification.spec.retrievers; import com.yahoo.vespa.hosted.node.verification.commons.parser.ParseResult; |