aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHÃ¥kon Hallingstad <hakon@oath.com>2018-05-08 09:19:32 +0200
committerGitHub <noreply@github.com>2018-05-08 09:19:32 +0200
commit85b184770c045c81d247b9a389381083b6b7a92c (patch)
tree6d01ccd33390e2b9dc234da3888207150d2f2def
parentda574277c6c821dcc0e5fd6b2dbdd076d22cf843 (diff)
parent8c6dbe05b04b71b2bc12bcc947f6ec8f5048c935 (diff)
Merge pull request #5812 from vespa-engine/freva/cleanup
Cleanup
-rw-r--r--docker-api/pom.xml6
-rw-r--r--docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/DockerImageGarbageCollector.java11
-rw-r--r--docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/DockerImageGarbageCollectionTest.java20
-rw-r--r--docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/DockerImplTest.java2
-rw-r--r--docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/ProcessResultTest.java4
-rw-r--r--docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/metrics/MetricReceiverWrapperTest.java7
-rw-r--r--node-admin/pom.xml42
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/RealConfigServerClients.java2
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/SslConnectionSocketFactoryUpdater.java5
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java2
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelper.java2
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPath.java2
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPVersion.java2
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/CommandLine.java6
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ProcessStarterImpl.java2
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/PrefixLogger.java4
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepositoryTest.java2
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImplTest.java2
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/NodeStateTest.java6
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RebootTest.java3
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RestartTest.java4
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImplTest.java4
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelperTest.java8
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileAttributesCacheTest.java2
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCacheTest.java4
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/TemplateTest.java4
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPathTest.java8
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPAddressesMock.java2
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/systemd/SystemCtlTest.java18
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/AddYumRepoTest.java2
-rw-r--r--node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/YumTest.java4
-rw-r--r--node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java10
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java20
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java6
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/FileHelperTest.java2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/IPAddressVerifierTest.java2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmarkTest.java2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/CPURetrieverTest.java2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetrieverTest.java6
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetrieverTest.java2
-rw-r--r--node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java2
41 files changed, 106 insertions, 140 deletions
diff --git a/docker-api/pom.xml b/docker-api/pom.xml
index df77b9c04db..6118865a6e0 100644
--- a/docker-api/pom.xml
+++ b/docker-api/pom.xml
@@ -110,12 +110,6 @@
<version>4.5</version>
</dependency>
<dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>jaxrs_client_utils</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
diff --git a/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/DockerImageGarbageCollector.java b/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/DockerImageGarbageCollector.java
index ab36ace8904..6e728972da9 100644
--- a/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/DockerImageGarbageCollector.java
+++ b/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/DockerImageGarbageCollector.java
@@ -9,6 +9,7 @@ import java.time.Instant;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -16,11 +17,11 @@ import java.util.stream.Stream;
* @author freva
*/
public class DockerImageGarbageCollector {
- private final Duration MIN_AGE_IMAGE_GC;
- private Map<String, Instant> lastTimeUsedByImageId = new HashMap<>();
+ private final Duration minAgeImageGc;
+ private final Map<String, Instant> lastTimeUsedByImageId = new ConcurrentHashMap<>();
public DockerImageGarbageCollector(Duration minAgeImageToDelete) {
- MIN_AGE_IMAGE_GC = minAgeImageToDelete;
+ minAgeImageGc = minAgeImageToDelete;
}
public void updateLastUsedTimeFor(String imageId) {
@@ -55,7 +56,7 @@ public class DockerImageGarbageCollector {
else return o1.compareTo(o2);
})
.flatMap(imageId -> {
- // Deleting an image by image ID with multiple tags will fail -> map IDs to all the tags refering to the ID
+ // Deleting an image by image ID with multiple tags will fail -> map IDs to all the tags referring to the ID
String[] repoTags = unusedImagesByRecent.get(imageId).getRepoTags();
return (repoTags == null) ? Stream.of(imageId) : Stream.of(repoTags);
})
@@ -89,7 +90,7 @@ public class DockerImageGarbageCollector {
});
lastTimeUsedByImageId.entrySet().stream()
- .filter(entry -> Duration.between(entry.getValue(), now).minus(MIN_AGE_IMAGE_GC).isNegative())
+ .filter(entry -> Duration.between(entry.getValue(), now).minus(minAgeImageGc).isNegative())
.map(Map.Entry::getKey)
.forEach(image -> {
String imageToSpare = image;
diff --git a/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/DockerImageGarbageCollectionTest.java b/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/DockerImageGarbageCollectionTest.java
index 9072f5c0d15..a78c9280e4e 100644
--- a/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/DockerImageGarbageCollectionTest.java
+++ b/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/DockerImageGarbageCollectionTest.java
@@ -23,21 +23,21 @@ import static org.junit.Assert.assertThat;
*/
public class DockerImageGarbageCollectionTest {
@Test
- public void noImagesMeansNoUnusedImages() throws Exception {
+ public void noImagesMeansNoUnusedImages() {
new ImageGcTester(0)
.withExistingImages()
.expectUnusedImages();
}
@Test
- public void singleImageWithoutContainersIsUnused() throws Exception {
+ public void singleImageWithoutContainersIsUnused() {
new ImageGcTester(0)
.withExistingImages(new ImageBuilder("image-1"))
.expectUnusedImages("image-1");
}
@Test
- public void singleImageWithContainerIsUsed() throws Exception {
+ public void singleImageWithContainerIsUsed() {
new ImageGcTester(0)
.withExistingImages(ImageBuilder.forId("image-1"))
.andExistingContainers(ContainerBuilder.forId("container-1").withImageId("image-1"))
@@ -45,7 +45,7 @@ public class DockerImageGarbageCollectionTest {
}
@Test
- public void multipleUnusedImagesAreIdentified() throws Exception {
+ public void multipleUnusedImagesAreIdentified() {
new ImageGcTester(0)
.withExistingImages(
ImageBuilder.forId("image-1"),
@@ -54,7 +54,7 @@ public class DockerImageGarbageCollectionTest {
}
@Test
- public void multipleUnusedLeavesAreIdentified() throws Exception {
+ public void multipleUnusedLeavesAreIdentified() {
new ImageGcTester(0)
.withExistingImages(
ImageBuilder.forId("parent-image"),
@@ -64,7 +64,7 @@ public class DockerImageGarbageCollectionTest {
}
@Test
- public void unusedLeafWithUsedSiblingIsIdentified() throws Exception {
+ public void unusedLeafWithUsedSiblingIsIdentified() {
new ImageGcTester(0)
.withExistingImages(
ImageBuilder.forId("parent-image"),
@@ -75,7 +75,7 @@ public class DockerImageGarbageCollectionTest {
}
@Test
- public void unusedImagesWithMultipleTags() throws Exception {
+ public void unusedImagesWithMultipleTags() {
new ImageGcTester(0)
.withExistingImages(
ImageBuilder.forId("parent-image"),
@@ -85,14 +85,14 @@ public class DockerImageGarbageCollectionTest {
}
@Test
- public void taggedImageWithNoContainersIsUnused() throws Exception {
+ public void taggedImageWithNoContainersIsUnused() {
new ImageGcTester(0)
.withExistingImages(ImageBuilder.forId("image-1").withTags("vespa-6"))
.expectUnusedImages("vespa-6");
}
@Test
- public void unusedImagesWithSimpleImageGc() throws Exception {
+ public void unusedImagesWithSimpleImageGc() {
new ImageGcTester(20)
.withExistingImages(
ImageBuilder.forId("parent-image").withLastUsedMinutesAgo(25),
@@ -101,7 +101,7 @@ public class DockerImageGarbageCollectionTest {
}
@Test
- public void unusedImagesWithImageGc() throws Exception {
+ public void unusedImagesWithImageGc() {
new ImageGcTester(20)
.withExistingImages(
ImageBuilder.forId("parent-1").withLastUsedMinutesAgo(40),
diff --git a/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/DockerImplTest.java b/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/DockerImplTest.java
index 654b5df3f3b..82c7d2285e9 100644
--- a/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/DockerImplTest.java
+++ b/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/DockerImplTest.java
@@ -34,7 +34,7 @@ import static org.mockito.Mockito.when;
public class DockerImplTest {
@Test
- public void testExecuteCompletes() throws Exception {
+ public void testExecuteCompletes() {
final String containerId = "container-id";
final String[] command = new String[] {"/bin/ls", "-l"};
final String execId = "exec-id";
diff --git a/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/ProcessResultTest.java b/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/ProcessResultTest.java
index 4e5d32046ae..0f1ad8a3466 100644
--- a/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/ProcessResultTest.java
+++ b/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/ProcessResultTest.java
@@ -8,7 +8,7 @@ import static org.junit.Assert.assertThat;
public class ProcessResultTest {
@Test
- public void testBasicProperties() throws Exception {
+ public void testBasicProperties() {
ProcessResult processResult = new ProcessResult(0, "foo", "bar");
assertThat(processResult.getExitStatus(), is(0));
assertThat(processResult.getOutput(), is("foo"));
@@ -16,7 +16,7 @@ public class ProcessResultTest {
}
@Test
- public void testSuccessFails() throws Exception {
+ public void testSuccessFails() {
ProcessResult processResult = new ProcessResult(1, "foo", "bar");
assertThat(processResult.isSuccess(), is(false));
}
diff --git a/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/metrics/MetricReceiverWrapperTest.java b/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/metrics/MetricReceiverWrapperTest.java
index 61da788685d..08b3489fbea 100644
--- a/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/metrics/MetricReceiverWrapperTest.java
+++ b/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/metrics/MetricReceiverWrapperTest.java
@@ -7,10 +7,9 @@ import org.junit.Test;
import java.util.Map;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
/**
- * @author valerijf
+ * @author freva
*/
public class MetricReceiverWrapperTest {
private static final Dimensions hostDimension = new Dimensions.Builder().add("host", "abc.yahoo.com").build();
@@ -34,7 +33,7 @@ public class MetricReceiverWrapperTest {
counter.add(8);
Map<String, Number> latestMetrics = metricReceiver.getMetricsForDimension(applicationDocker, hostDimension);
- assertTrue("Expected only 1 metric value to be set", latestMetrics.size() == 1);
+ assertEquals("Expected only 1 metric value to be set", 1, latestMetrics.size());
assertEquals(latestMetrics.get("a_counter.value"), 13L); // 5 + 8
}
@@ -47,7 +46,7 @@ public class MetricReceiverWrapperTest {
gauge.sample(-342.23);
Map<String, Number> latestMetrics = metricReceiver.getMetricsForDimension(applicationDocker, hostDimension);
- assertTrue("Expected only 1 metric value to be set", latestMetrics.size() == 1);
+ assertEquals("Expected only 1 metric value to be set", 1, latestMetrics.size());
assertEquals(latestMetrics.get("test.gauge"), -342.23);
}
diff --git a/node-admin/pom.xml b/node-admin/pom.xml
index ea708407365..2f7b3109d38 100644
--- a/node-admin/pom.xml
+++ b/node-admin/pom.xml
@@ -43,24 +43,6 @@
</dependency>
<dependency>
<groupId>com.yahoo.vespa</groupId>
- <artifactId>orchestrator</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>service-monitor</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>application-model</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
<artifactId>container-dev</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
@@ -88,12 +70,6 @@
</dependency>
<dependency>
<groupId>com.yahoo.vespa</groupId>
- <artifactId>jaxrs_client_utils</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
<artifactId>vespa-athenz</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
@@ -118,6 +94,24 @@
</dependency>
<dependency>
<groupId>com.yahoo.vespa</groupId>
+ <artifactId>orchestrator</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>service-monitor</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>application-model</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
<artifactId>testutil</artifactId>
<version>${project.version}</version>
<scope>test</scope>
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/RealConfigServerClients.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/RealConfigServerClients.java
index a2da5de32df..07dbc8aef9c 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/RealConfigServerClients.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/RealConfigServerClients.java
@@ -2,10 +2,8 @@
package com.yahoo.vespa.hosted.node.admin.configserver;
import com.yahoo.config.provision.HostName;
-import com.yahoo.vespa.athenz.identity.ServiceIdentityProvider;
import com.yahoo.vespa.athenz.identity.SiaIdentityProvider;
import com.yahoo.vespa.hosted.node.admin.component.ConfigServerInfo;
-import com.yahoo.vespa.hosted.node.admin.component.Environment;
import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.NodeRepository;
import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.RealNodeRepository;
import com.yahoo.vespa.hosted.node.admin.configserver.orchestrator.Orchestrator;
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/SslConnectionSocketFactoryUpdater.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/SslConnectionSocketFactoryUpdater.java
index b07ee37209c..1888749b998 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/SslConnectionSocketFactoryUpdater.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/SslConnectionSocketFactoryUpdater.java
@@ -3,18 +3,13 @@ package com.yahoo.vespa.hosted.node.admin.configserver;
import com.yahoo.vespa.athenz.api.AthenzIdentity;
import com.yahoo.vespa.athenz.api.AthenzService;
-import com.yahoo.vespa.athenz.identity.ServiceIdentityProvider;
import com.yahoo.vespa.athenz.identity.SiaIdentityProvider;
import com.yahoo.vespa.athenz.tls.AthenzIdentityVerifier;
import com.yahoo.vespa.athenz.tls.SslContextBuilder;
-import com.yahoo.vespa.athenz.utils.AthenzIdentities;
-import com.yahoo.vespa.hosted.node.admin.component.ConfigServerInfo;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
-import java.io.File;
-import java.nio.file.Paths;
import java.util.HashSet;
import java.util.Set;
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java
index d150fc03662..e3920d71d19 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java
@@ -52,7 +52,7 @@ public class StorageMaintainer {
private final Environment environment;
private final Clock clock;
- private Map<ContainerName, MaintenanceThrottler> maintenanceThrottlerByContainerName = new ConcurrentHashMap<>();
+ private final Map<ContainerName, MaintenanceThrottler> maintenanceThrottlerByContainerName = new ConcurrentHashMap<>();
public StorageMaintainer(DockerOperations dockerOperations, ProcessExecuter processExecuter, MetricReceiverWrapper metricReceiver, Environment environment, Clock clock) {
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelper.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelper.java
index dfcaba7c4bb..cc31374669c 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelper.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelper.java
@@ -30,7 +30,7 @@ public class DebugHandlerHelper implements NodeAdminDebugHandler {
}
public void addHandler(String name, NodeAdminDebugHandler handler) {
- addThreadSafeSupplier(name, () -> handler.getDebugPage());
+ addThreadSafeSupplier(name, handler::getDebugPage);
}
public void addConstant(String name, String value) {
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPath.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPath.java
index 45d5432a4c8..90404bb596e 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPath.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPath.java
@@ -109,7 +109,7 @@ public class UnixPath {
}
public Optional<FileAttributes> getAttributesIfExists() {
- return IOExceptionUtil.ifExists(() -> getAttributes());
+ return IOExceptionUtil.ifExists(this::getAttributes);
}
public void createDirectory(String permissions) {
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPVersion.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPVersion.java
index e614da020b2..04c7edac74e 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPVersion.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPVersion.java
@@ -1,7 +1,5 @@
package com.yahoo.vespa.hosted.node.admin.task.util.network;
-import com.google.common.net.InetAddresses;
-
import java.net.Inet4Address;
import java.net.InetAddress;
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/CommandLine.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/CommandLine.java
index 9eaa2395d21..8e66c6e5a48 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/CommandLine.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/CommandLine.java
@@ -24,8 +24,8 @@ import java.util.stream.Collectors;
* @author hakonhall
*/
public class CommandLine {
- private static Logger logger = Logger.getLogger(CommandLine.class.getName());
- private static Pattern UNESCAPED_ARGUMENT_PATTERN = Pattern.compile("^[a-zA-Z0-9=!@%/+:.,_-]+$");
+ private static final Logger logger = Logger.getLogger(CommandLine.class.getName());
+ private static final Pattern UNESCAPED_ARGUMENT_PATTERN = Pattern.compile("^[a-zA-Z0-9=!@%/+:.,_-]+$");
/** The default timeout. See setTimeout() for details. */
public static final Duration DEFAULT_TIMEOUT = Duration.ofMinutes(10);
@@ -217,7 +217,7 @@ public class CommandLine {
}
public CommandLine setSigKillGracePeriod(Duration period) {
- this.sigTermGracePeriod = period;
+ this.sigKillGracePeriod = period;
return this;
}
// Accessor fields necessary for classes in this package. Could be public if necessary.
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ProcessStarterImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ProcessStarterImpl.java
index 478f13ecce3..43105f43dc0 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ProcessStarterImpl.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ProcessStarterImpl.java
@@ -20,7 +20,7 @@ public class ProcessStarterImpl implements ProcessStarter {
logger.log(LogLevel.DEBUG, "Spawning process: " + processBuilder.command());
}
- Process process = uncheck(() -> processBuilder.start());
+ Process process = uncheck(processBuilder::start);
return new ProcessApi2Impl(process);
}
}
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/PrefixLogger.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/PrefixLogger.java
index f5e49bc9f44..3bcfde2bbb4 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/PrefixLogger.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/PrefixLogger.java
@@ -11,8 +11,8 @@ import java.util.logging.Logger;
* @author valerijf
*/
public class PrefixLogger {
- private String prefix;
- private Logger logger;
+ private final String prefix;
+ private final Logger logger;
private <T> PrefixLogger(Class<T> clazz, String prefix) {
this.logger = Logger.getLogger(clazz.getName());
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepositoryTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepositoryTest.java
index 7f9f0027546..ae5ba9681e6 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepositoryTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepositoryTest.java
@@ -101,7 +101,7 @@ public class RealNodeRepositoryTest {
}
@Test
- public void testGetContainersToRunApi() throws InterruptedException {
+ public void testGetContainersToRunApi() {
String dockerHostHostname = "dockerhost1.yahoo.com";
final List<NodeSpec> containersToRun = nodeRepositoryApi.getNodes(dockerHostHostname);
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImplTest.java
index e5f35f17aed..4526891d24a 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImplTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImplTest.java
@@ -43,7 +43,7 @@ public class DockerOperationsImplTest {
= new DockerOperationsImpl(docker, environment, processExecuter, addressesMock);
@Test
- public void processResultFromNodeProgramWhenSuccess() throws Exception {
+ public void processResultFromNodeProgramWhenSuccess() {
final ContainerName containerName = new ContainerName("container-name");
final ProcessResult actualResult = new ProcessResult(0, "output", "errors");
final String programPath = "/bin/command";
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/NodeStateTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/NodeStateTest.java
index 063e478ffb4..875978a8726 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/NodeStateTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/NodeStateTest.java
@@ -7,8 +7,6 @@ import com.yahoo.vespa.hosted.dockerapi.DockerImage;
import com.yahoo.vespa.hosted.provision.Node;
import org.junit.Test;
-import java.io.IOException;
-
/**
* Test NodeState transitions in NodeRepository
*
@@ -43,7 +41,7 @@ public class NodeStateTest {
@Test
- public void activeToDirty() throws InterruptedException, IOException {
+ public void activeToDirty() throws InterruptedException {
try (DockerTester dockerTester = new DockerTester()) {
setup(dockerTester);
// Change node state to dirty
@@ -68,7 +66,7 @@ public class NodeStateTest {
}
@Test
- public void activeToInactiveToActive() throws InterruptedException, IOException {
+ public void activeToInactiveToActive() throws InterruptedException {
try (DockerTester dockerTester = new DockerTester()) {
setup(dockerTester);
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RebootTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RebootTest.java
index f8746bcc22a..a83efc03fbe 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RebootTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RebootTest.java
@@ -11,7 +11,6 @@ import com.yahoo.vespa.hosted.provision.Node;
import org.junit.Ignore;
import org.junit.Test;
-import java.net.UnknownHostException;
import java.util.Optional;
import static org.hamcrest.core.Is.is;
@@ -27,7 +26,7 @@ public class RebootTest {
@Test
@Ignore
- public void test() throws InterruptedException, UnknownHostException {
+ public void test() throws InterruptedException {
try (DockerTester dockerTester = new DockerTester()) {
dockerTester.addNodeRepositoryNode(createNodeRepositoryNode());
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RestartTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RestartTest.java
index d029d356d77..651da7caec5 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RestartTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RestartTest.java
@@ -7,8 +7,6 @@ import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.NodeSpec;
import com.yahoo.vespa.hosted.provision.Node;
import org.junit.Test;
-import java.net.UnknownHostException;
-
/**
* Tests that different wanted and current restart generation leads to execution of restart command
*
@@ -17,7 +15,7 @@ import java.net.UnknownHostException;
public class RestartTest {
@Test
- public void test() throws InterruptedException, UnknownHostException {
+ public void test() throws InterruptedException {
try (DockerTester dockerTester = new DockerTester()) {
long wantedRestartGeneration = 1;
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImplTest.java
index 22aa7a5d229..91c61623ee7 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImplTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImplTest.java
@@ -54,7 +54,7 @@ public class NodeAdminImplTest {
new MetricReceiverWrapper(MetricReceiver.nullImplementation), clock);
@Test
- public void nodeAgentsAreProperlyLifeCycleManaged() throws Exception {
+ public void nodeAgentsAreProperlyLifeCycleManaged() {
final String hostName1 = "host1.test.yahoo.com";
final String hostName2 = "host2.test.yahoo.com";
final ContainerName containerName1 = ContainerName.fromHostname(hostName1);
@@ -98,7 +98,7 @@ public class NodeAdminImplTest {
}
@Test
- public void testSetFrozen() throws Exception {
+ public void testSetFrozen() {
List<NodeAgent> nodeAgents = new ArrayList<>();
List<String> existingContainerHostnames = new ArrayList<>();
for (int i = 0; i < 3; i++) {
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelperTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelperTest.java
index 723b9f0df8a..a930e2babff 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelperTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/provider/DebugHandlerHelperTest.java
@@ -5,7 +5,6 @@ package com.yahoo.vespa.hosted.node.admin.provider;
import org.junit.Test;
import java.util.Collections;
-import java.util.Map;
import static org.junit.Assert.assertEquals;
@@ -15,12 +14,7 @@ public class DebugHandlerHelperTest {
DebugHandlerHelper helper = new DebugHandlerHelper();
helper.addConstant("constant-key", "constant-value");
- NodeAdminDebugHandler handler = new NodeAdminDebugHandler() {
- @Override
- public Map<String, Object> getDebugPage() {
- return Collections.singletonMap("handler-value-key", "handler-value-value");
- }
- };
+ NodeAdminDebugHandler handler = () -> Collections.singletonMap("handler-value-key", "handler-value-value");
helper.addHandler("handler-key", handler);
helper.addThreadSafeSupplier("supplier-key", () -> "supplier-value");
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileAttributesCacheTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileAttributesCacheTest.java
index 9224faf1c6f..06192c9f308 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileAttributesCacheTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileAttributesCacheTest.java
@@ -17,7 +17,7 @@ import static org.mockito.Mockito.when;
public class FileAttributesCacheTest {
@Test
- public void exists() throws Exception {
+ public void exists() {
UnixPath unixPath = mock(UnixPath.class);
FileAttributesCache cache = new FileAttributesCache(unixPath);
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCacheTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCacheTest.java
index 677dd048445..83ab5462fb6 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCacheTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/FileContentCacheTest.java
@@ -18,7 +18,7 @@ public class FileContentCacheTest {
private final FileContentCache cache = new FileContentCache(unixPath);
@Test
- public void get() throws Exception {
+ public void get() {
when(unixPath.readUtf8File()).thenReturn("content");
assertEquals("content", cache.get(Instant.ofEpochMilli(0)));
verify(unixPath, times(1)).readUtf8File();
@@ -45,7 +45,7 @@ public class FileContentCacheTest {
}
@Test
- public void updateWith() throws Exception {
+ public void updateWith() {
cache.updateWith("content", Instant.ofEpochMilli(2));
assertEquals("content", cache.get(Instant.ofEpochMilli(2)));
verifyNoMoreInteractions(unixPath);
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/TemplateTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/TemplateTest.java
index 7aa672e9e80..20f406463a8 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/TemplateTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/TemplateTest.java
@@ -2,12 +2,10 @@
package com.yahoo.vespa.hosted.node.admin.task.util.file;
-import com.google.common.jimfs.Jimfs;
import com.yahoo.vespa.hosted.node.admin.component.TaskContext;
import com.yahoo.vespa.test.file.TestFileSystem;
import org.junit.Test;
-import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.Path;
@@ -18,7 +16,7 @@ import static org.mockito.Mockito.mock;
public class TemplateTest {
@Test
- public void basic() throws IOException {
+ public void basic() {
FileSystem fileSystem = TestFileSystem.create();
Path templatePath = fileSystem.getPath("/example.vm");
String templateContent = "a $x, $y b";
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPathTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPathTest.java
index 6f1991ec3d4..8d3d336a4ac 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPathTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPathTest.java
@@ -20,7 +20,7 @@ public class UnixPathTest {
final FileSystem fileSystem = TestFileSystem.create();
@Test
- public void createParents() throws Exception {
+ public void createParents() {
Path parentDirectory = fileSystem.getPath("/a/b/c");
Path filePath = parentDirectory.resolve("bar");
UnixPath path = new UnixPath(filePath);
@@ -31,7 +31,7 @@ public class UnixPathTest {
}
@Test
- public void utf8File() throws Exception {
+ public void utf8File() {
String original = "foo\nbar\n";
UnixPath path = new UnixPath(fileSystem.getPath("example.txt"));
path.writeUtf8File(original);
@@ -40,7 +40,7 @@ public class UnixPathTest {
}
@Test
- public void permissions() throws Exception {
+ public void permissions() {
String expectedPermissions = "rwxr-x---";
UnixPath path = new UnixPath(fileSystem.getPath("file.txt"));
path.writeUtf8File("foo");
@@ -54,7 +54,7 @@ public class UnixPathTest {
}
@Test
- public void owner() throws Exception {
+ public void owner() {
FileSystem fs = TestFileSystem.create();
Path path = fs.getPath("file.txt");
UnixPath unixPath = new UnixPath(path);
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPAddressesMock.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPAddressesMock.java
index 4a103c89446..4dec4ece27e 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPAddressesMock.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPAddressesMock.java
@@ -12,7 +12,7 @@ import java.util.Map;
*/
public class IPAddressesMock implements IPAddresses {
- Map<String, List<InetAddress>> otherAddresses = new HashMap<>();
+ private final Map<String, List<InetAddress>> otherAddresses = new HashMap<>();
public IPAddressesMock addAddress(String hostname, String ip) {
List<InetAddress> addresses = otherAddresses.getOrDefault(hostname, new ArrayList<>());
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/systemd/SystemCtlTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/systemd/SystemCtlTest.java
index 085402410b3..315138e897f 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/systemd/SystemCtlTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/systemd/SystemCtlTest.java
@@ -19,7 +19,7 @@ public class SystemCtlTest {
private final TestTerminal terminal = new TestTerminal();
@Test
- public void enable() throws Exception {
+ public void enable() {
terminal.expectCommand(
"systemctl show docker 2>&1",
0,
@@ -33,7 +33,7 @@ public class SystemCtlTest {
}
@Test
- public void enableIsNoop() throws Exception {
+ public void enableIsNoop() {
terminal.expectCommand(
"systemctl show docker 2>&1",
0,
@@ -48,7 +48,7 @@ public class SystemCtlTest {
@Test
- public void enableCommandFailre() throws Exception {
+ public void enableCommandFailre() {
terminal.expectCommand("systemctl show docker 2>&1", 1, "error");
SystemCtl.SystemCtlEnable enableDockerService = new SystemCtl(terminal).enable("docker");
try {
@@ -61,7 +61,7 @@ public class SystemCtlTest {
@Test
- public void start() throws Exception {
+ public void start() {
terminal.expectCommand(
"systemctl show docker 2>&1",
0,
@@ -75,7 +75,7 @@ public class SystemCtlTest {
}
@Test
- public void startIsNoop() throws Exception {
+ public void startIsNoop() {
terminal.expectCommand(
"systemctl show docker 2>&1",
0,
@@ -90,7 +90,7 @@ public class SystemCtlTest {
@Test
- public void startCommandFailre() throws Exception {
+ public void startCommandFailre() {
terminal.expectCommand("systemctl show docker 2>&1", 1, "error");
SystemCtl.SystemCtlStart startDockerService = new SystemCtl(terminal).start("docker");
try {
@@ -103,7 +103,7 @@ public class SystemCtlTest {
@Test
- public void disable() throws Exception {
+ public void disable() {
terminal.expectCommand(
"systemctl show docker 2>&1",
0,
@@ -116,7 +116,7 @@ public class SystemCtlTest {
}
@Test
- public void stop() throws Exception {
+ public void stop() {
terminal.expectCommand(
"systemctl show docker 2>&1",
0,
@@ -129,7 +129,7 @@ public class SystemCtlTest {
}
@Test
- public void restart() throws Exception {
+ public void restart() {
terminal.expectCommand("systemctl restart docker 2>&1", 0, "");
assertTrue(new SystemCtl(terminal).restart("docker").converge(taskContext));
}
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/AddYumRepoTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/AddYumRepoTest.java
index 399759c7c0a..c6314439003 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/AddYumRepoTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/AddYumRepoTest.java
@@ -17,7 +17,7 @@ import static org.mockito.Mockito.mock;
public class AddYumRepoTest {
@Test
- public void converge() throws Exception {
+ public void converge() {
String repositoryId = "repoid";
String name = "name";
String baseurl = "http://foo.com/bar";
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/YumTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/YumTest.java
index e5bec3c912d..d29d8741438 100644
--- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/YumTest.java
+++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/YumTest.java
@@ -14,8 +14,8 @@ import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
public class YumTest {
- private TaskContext taskContext = mock(TaskContext.class);
- private TestTerminal terminal = new TestTerminal();
+ private final TaskContext taskContext = mock(TaskContext.class);
+ private final TestTerminal terminal = new TestTerminal();
@Before
public void tearDown() {
diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java
index c82f4406015..fe09f23d282 100644
--- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java
+++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java
@@ -58,7 +58,7 @@ public class CoreCollector {
return Arrays.asList(result.getSecond().split("\n"));
}
- Path readBinPathFallback(Path coredumpPath) throws IOException, InterruptedException {
+ Path readBinPathFallback(Path coredumpPath) throws IOException {
String command = GDB_PATH + " -n -batch -core " + coredumpPath + " | grep \'^Core was generated by\'";
String[] wrappedCommand = new String[] {"/bin/sh", "-c", command};
Pair<Integer, String> result = processExecuter.exec(wrappedCommand);
@@ -71,7 +71,7 @@ public class CoreCollector {
return Paths.get(matcher.group("path").split(" ")[0]);
}
- Path readBinPath(Path coredumpPath) throws IOException, InterruptedException {
+ Path readBinPath(Path coredumpPath) throws IOException {
String[] command = new String[] {"file", coredumpPath.toString()};
try {
Pair<Integer, String> result = processExecuter.exec(command);
@@ -97,7 +97,7 @@ public class CoreCollector {
return readBinPathFallback(coredumpPath);
}
- List<String> readBacktrace(Path coredumpPath, Path binPath, boolean allThreads) throws IOException, InterruptedException {
+ List<String> readBacktrace(Path coredumpPath, Path binPath, boolean allThreads) throws IOException {
String threads = allThreads ? "thread apply all bt" : "bt";
String[] command = new String[]{GDB_PATH, "-n", "-ex", threads, "-batch", binPath.toString(), coredumpPath.toString()};
Pair<Integer, String> result = processExecuter.exec(command);
@@ -111,7 +111,7 @@ public class CoreCollector {
Map<String, Object> data = new LinkedHashMap<>();
try {
coredumpPath = compressCoredump(coredumpPath);
- } catch (IOException | InterruptedException e) {
+ } catch (IOException e) {
logger.log(Level.WARNING, "Failed compressing/decompressing core dump", e);
}
@@ -154,7 +154,7 @@ public class CoreCollector {
*
* @return Path to the decompressed core dump
*/
- private Path compressCoredump(Path coredumpPath) throws IOException, InterruptedException {
+ private Path compressCoredump(Path coredumpPath) throws IOException {
if (! coredumpPath.toString().endsWith(".lz4")) {
processExecuter.exec(
new String[]{LZ4_PATH, coredumpPath.toString(), coredumpPath.toString() + ".lz4"});
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java
index 4b58c16bdc3..b32f6d076a7 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java
@@ -53,18 +53,18 @@ public class CoreCollectorTest {
@Rule
public TemporaryFolder folder= new TemporaryFolder();
- private void mockExec(String[] cmd, String output) throws IOException, InterruptedException {
+ private void mockExec(String[] cmd, String output) throws IOException {
mockExec(cmd, output, "");
}
- private void mockExec(String[] cmd, String output, String error) throws IOException, InterruptedException {
+ private void mockExec(String[] cmd, String output, String error) throws IOException {
when(processExecuter.exec(cmd)).thenReturn(new Pair<>(error.isEmpty() ? 0 : 1, output + error));
}
static final String GDB_PATH = getDefaults().underVespaHome("bin64/gdb");
@Test
- public void extractsBinaryPathTest() throws IOException, InterruptedException {
+ public void extractsBinaryPathTest() throws IOException {
final String[] cmd = {"file", TEST_CORE_PATH.toString()};
mockExec(cmd,
@@ -101,7 +101,7 @@ public class CoreCollectorTest {
}
@Test
- public void extractsBinaryPathUsingGdbTest() throws IOException, InterruptedException {
+ public void extractsBinaryPathUsingGdbTest() throws IOException {
final String[] cmd = new String[]{"/bin/sh", "-c",
GDB_PATH + " -n -batch -core /tmp/core.1234 | grep '^Core was generated by'"};
@@ -119,7 +119,7 @@ public class CoreCollectorTest {
}
@Test
- public void extractsBacktraceUsingGdb() throws IOException, InterruptedException {
+ public void extractsBacktraceUsingGdb() throws IOException {
mockExec(new String[]{GDB_PATH, "-n", "-ex", "bt", "-batch", "/usr/bin/program", "/tmp/core.1234"},
String.join("\n", GDB_BACKTRACE));
assertEquals(GDB_BACKTRACE, coreCollector.readBacktrace(TEST_CORE_PATH, TEST_BIN_PATH, false));
@@ -136,7 +136,7 @@ public class CoreCollectorTest {
}
@Test
- public void extractsBacktraceFromAllThreadsUsingGdb() throws IOException, InterruptedException {
+ public void extractsBacktraceFromAllThreadsUsingGdb() throws IOException {
mockExec(new String[]{GDB_PATH, "-n", "-ex", "thread apply all bt", "-batch",
"/usr/bin/program", "/tmp/core.1234"},
String.join("\n", GDB_BACKTRACE));
@@ -144,7 +144,7 @@ public class CoreCollectorTest {
}
@Test
- public void collectsDataTest() throws IOException, InterruptedException {
+ public void collectsDataTest() throws IOException {
mockExec(new String[]{"file", TEST_CORE_PATH.toString()},
"/tmp/core.1234: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from " +
"'/usr/bin/program'");
@@ -166,7 +166,7 @@ public class CoreCollectorTest {
}
@Test
- public void collectsPartialIfUnableToDetermineDumpingProgramTest() throws IOException, InterruptedException {
+ public void collectsPartialIfUnableToDetermineDumpingProgramTest() throws IOException {
// We fail to get backtrace and RPM packages, but install state works, make sure it is returned
mockExec(new String[]{"cat", INSTALL_STATE_PATH.toString()}, String.join("\n", INSTALL_STATE));
@@ -176,7 +176,7 @@ public class CoreCollectorTest {
}
@Test
- public void collectsPartialIfBacktraceFailsTest() throws IOException, InterruptedException {
+ public void collectsPartialIfBacktraceFailsTest() throws IOException {
mockExec(new String[]{"file", TEST_CORE_PATH.toString()},
"/tmp/core.1234: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from " +
"'/usr/bin/program'");
@@ -189,7 +189,7 @@ public class CoreCollectorTest {
}
@Test
- public void parseTotalMemoryTestTest() throws IOException {
+ public void parseTotalMemoryTestTest() {
String memInfo = "MemTotal: 100000000 kB\nMemUsed: 1000000 kB\n";
assertEquals(100000000, coreCollector.parseTotalMemorySize(memInfo));
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java
index 2cc96567e20..4a5fddf984e 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java
@@ -141,7 +141,7 @@ public class CoredumpHandlerTest {
}
@Test
- public void coredumpMetadataCollectAndWriteTest() throws IOException, InterruptedException {
+ public void coredumpMetadataCollectAndWriteTest() throws IOException {
createCoredump("core.dump", Instant.now());
Path processingPath = coredumpHandler.enqueueCoredumps();
Path processingCoredumpPath = Files.list(processingPath).findFirst().orElseThrow(() ->
@@ -157,7 +157,7 @@ public class CoredumpHandlerTest {
}
@Test
- public void coredumpMetadataReadIfExistsTest() throws IOException, InterruptedException {
+ public void coredumpMetadataReadIfExistsTest() throws IOException {
final String documentId = "UIDD-ABCD-EFGH";
Path metadataPath = createProcessedCoredump(documentId);
@@ -167,7 +167,7 @@ public class CoredumpHandlerTest {
}
@Test
- public void reportSuccessCoredumpTest() throws IOException, URISyntaxException, InterruptedException {
+ public void reportSuccessCoredumpTest() throws IOException, URISyntaxException {
final String documentId = "UIDD-ABCD-EFGH";
Path coredumpPath = createProcessedCoredump(documentId);
diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/FileHelperTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/FileHelperTest.java
index 4bbfe3e5b25..eefdcf4adad 100644
--- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/FileHelperTest.java
+++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/FileHelperTest.java
@@ -125,7 +125,7 @@ public class FileHelperTest {
}
@Test
- public void testGetContentsOfNonExistingDirectory() throws IOException {
+ public void testGetContentsOfNonExistingDirectory() {
Path fakePath = Paths.get("/some/made/up/dir/");
assertEquals(Collections.emptyList(), FileHelper.listContentsOfDirectory(fakePath));
}
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 fc846e3eba6..5762975ec9b 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
@@ -25,7 +25,7 @@ public class IPAddressVerifierTest {
private String ipv6LookupFormat;
@Before
- public void setup() throws Exception {
+ public void setup() {
ipv4LookupFormat = "8.4.2.10.in-addr.arpa";
ipv6LookupFormat = "4.3.2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.b.a.d.f.ip6.arpa";
}
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 04e9057b44e..70fab6eecb1 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
@@ -68,7 +68,7 @@ public class CPUBenchmarkTest {
}
@Test
- public void test_if_setCpuCyclesPerSec_reads_output_correctly() throws IOException {
+ public void test_if_setCpuCyclesPerSec_reads_output_correctly() {
List<ParseResult> parseResults = new ArrayList<>();
parseResults.add(new ParseResult("cycles", "2.066.201.729"));
parseResults.add(new ParseResult("seconds", "0,957617512"));
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 d878d6614f7..0cf6bb0907b 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
@@ -33,7 +33,7 @@ public class CPURetrieverTest {
}
@Test
- public void updateInfo_should_write_numOfCpuCores_to_hardware_info() throws Exception {
+ public void updateInfo_should_write_numOfCpuCores_to_hardware_info() {
commandExecutor.addCommand("cat " + FILENAME);
cpu.updateInfo();
double expectedAmountOfCores = 4;
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 220d89f3be9..a72cca1c72a 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
@@ -44,14 +44,14 @@ public class DiskRetrieverTest {
}
@Test
- public void updateDiskType__should_store_diskType_in_hardwareInfo() throws IOException {
+ public void updateDiskType__should_store_diskType_in_hardwareInfo() {
commandExecutor.addCommand(CAT_RESOURCE_PATH + "DiskTypeFastDisk");
diskRetriever.updateDiskType();
assertEquals(DiskType.FAST, hardwareInfo.getDiskType());
}
@Test
- public void updateDiskSize__should_store_diskSize_in_hardwareInfo() throws IOException {
+ public void updateDiskSize__should_store_diskSize_in_hardwareInfo() {
commandExecutor.addCommand(CAT_RESOURCE_PATH + "filesize");
diskRetriever.updateDiskSize();
double expectedSize = 1760.0;
@@ -76,7 +76,7 @@ public class DiskRetrieverTest {
}
@Test
- public void parseDiskType_with_invalid_outputstream_does_not_contain_searchword_should_throw_exception() throws Exception {
+ public void parseDiskType_with_invalid_outputstream_does_not_contain_searchword_should_throw_exception() {
List<String> mockOutput = commandExecutor.outputFromString("Name Rota");
try {
diskRetriever.parseDiskType(mockOutput);
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 6b0b5f6d24a..1722abdc7b8 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
@@ -32,7 +32,7 @@ public class MemoryRetrieverTest {
}
@Test
- public void updateInfo_should_set_memory_available_in_hardwareInfo() throws IOException {
+ public void updateInfo_should_set_memory_available_in_hardwareInfo() {
commandExecutor.addCommand("cat " + FILENAME);
memory.updateInfo();
double expectedMemory = 4.042128;
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 eb9f122b726..dad73a9bb90 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
@@ -62,7 +62,7 @@ public class NetRetrieverTest {
}
@Test
- public void findInterfaceSpeed_valid_input() throws IOException {
+ public void findInterfaceSpeed_valid_input() {
commandExecutor.addCommand("cat " + NET_FIND_INTERFACE);
commandExecutor.addCommand("cat " + NET_CHECK_INTERFACE_SPEED);
parseResults = net.findInterface();