aboutsummaryrefslogtreecommitdiffstats
path: root/orchestrator
diff options
context:
space:
mode:
authorvalerijf <valerijf@yahoo-inc.com>2016-07-25 12:02:26 +0200
committervalerijf <valerijf@yahoo-inc.com>2016-07-25 12:02:26 +0200
commit59531884948bf3c2643fabe76168755173fe07ac (patch)
tree6f969cae97d2133ca0963998f0760cdba49c75f6 /orchestrator
parent78c44bd6ef0d016622c46c4ad081c22612b7135b (diff)
Allow Orchestrator to suspend node admin with no active nodes
Diffstat (limited to 'orchestrator')
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionResource.java2
-rw-r--r--orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/HostResourceTest.java9
2 files changed, 10 insertions, 1 deletions
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionResource.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionResource.java
index ab12e08cb86..d20d450c723 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionResource.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionResource.java
@@ -41,7 +41,7 @@ public class HostSuspensionResource implements HostSuspensionApi {
throw createWebApplicationException(message, Response.Status.BAD_REQUEST);
}
final List<String> hostnamesAsStrings = request.getHostnames();
- if (hostnamesAsStrings == null || hostnamesAsStrings.isEmpty()) {
+ if (hostnamesAsStrings == null) {
String message = "hostnames missing in request: " + request;
log.log(LogLevel.DEBUG, message);
throw createWebApplicationException(message, Response.Status.BAD_REQUEST);
diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/HostResourceTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/HostResourceTest.java
index fb046f978c7..81393a28ec9 100644
--- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/HostResourceTest.java
+++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/HostResourceTest.java
@@ -136,6 +136,15 @@ public class HostResourceTest {
}
@Test
+ public void returns_200_empty_batch() throws Exception {
+ HostSuspensionResource hostSuspensionResource = new HostSuspensionResource(alwaysAllowOrchestrator);
+ BatchHostSuspendRequest request =
+ new BatchHostSuspendRequest("parentHostname", Collections.emptyList());
+ BatchOperationResult response = hostSuspensionResource.suspendAll(request);
+ assertThat(response.success());
+ }
+
+ @Test
public void throws_404_when_host_unknown() throws Exception {
try {
HostResource hostResource =