diff options
author | HÃ¥kon Hallingstad <hakon.hallingstad@gmail.com> | 2019-11-18 09:45:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-18 09:45:44 +0100 |
commit | 9e419119abc9eaac1d0fd922a736d0dd47aa18c2 (patch) | |
tree | f312893255081a6c6101cd6e6bc9e3ac2d1c41de /node-admin/src/test | |
parent | 927de6064fa5e15f106fe21c2b6ab33195d857a8 (diff) |
Revert "Reduce timeouts for non-suspend ConfigServer REST API calls from node admin"
Diffstat (limited to 'node-admin/src/test')
-rw-r--r-- | node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImplTest.java | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImplTest.java index 936a7bb224d..e4c46c504be 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImplTest.java @@ -12,7 +12,6 @@ import java.util.Arrays; import java.util.List; import java.util.Optional; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -30,10 +29,9 @@ public class OrchestratorImplTest { @Test public void testSuspendCall() { when(configServerApi.put( - eq(OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName+ "/suspended"), - eq(Optional.empty()), - eq(UpdateHostResponse.class), - any() + OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName+ "/suspended", + Optional.empty(), + UpdateHostResponse.class )).thenReturn(new UpdateHostResponse(hostName, null)); orchestrator.suspend(hostName); @@ -42,10 +40,9 @@ public class OrchestratorImplTest { @Test(expected=OrchestratorException.class) public void testSuspendCallWithFailureReason() { when(configServerApi.put( - eq(OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName+ "/suspended"), - eq(Optional.empty()), - eq(UpdateHostResponse.class), - any() + OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName+ "/suspended", + Optional.empty(), + UpdateHostResponse.class )).thenReturn(new UpdateHostResponse(hostName, new HostStateChangeDenialReason("hostname", "fail"))); orchestrator.suspend(hostName); @@ -53,16 +50,22 @@ public class OrchestratorImplTest { @Test(expected=OrchestratorNotFoundException.class) public void testSuspendCallWithNotFound() { - when(configServerApi.put(any(String.class), any(), any(), any())) - .thenThrow(new HttpException.NotFoundException("Not Found")); + when(configServerApi.put( + any(String.class), + any(), + any() + )).thenThrow(new HttpException.NotFoundException("Not Found")); orchestrator.suspend(hostName); } @Test(expected=RuntimeException.class) public void testSuspendCallWithSomeOtherException() { - when(configServerApi.put(any(String.class), any(), any(), any())) - .thenThrow(new RuntimeException("Some parameter was wrong")); + when(configServerApi.put( + any(String.class), + any(), + any() + )).thenThrow(new RuntimeException("Some parameter was wrong")); orchestrator.suspend(hostName); } @@ -100,8 +103,11 @@ public class OrchestratorImplTest { @Test(expected=RuntimeException.class) public void testResumeCallWithSomeOtherException() { - when(configServerApi.put(any(String.class), any(), any(), any())) - .thenThrow(new RuntimeException("Some parameter was wrong")); + when(configServerApi.put( + any(String.class), + any(), + any() + )).thenThrow(new RuntimeException("Some parameter was wrong")); orchestrator.suspend(hostName); } @@ -112,10 +118,9 @@ public class OrchestratorImplTest { List<String> hostNames = Arrays.asList("a1.host1.test.yahoo.com", "a2.host1.test.yahoo.com"); when(configServerApi.put( - eq("/orchestrator/v1/suspensions/hosts/host1.test.yahoo.com?hostname=a1.host1.test.yahoo.com&hostname=a2.host1.test.yahoo.com"), - eq(Optional.empty()), - eq(BatchOperationResult.class), - any() + "/orchestrator/v1/suspensions/hosts/host1.test.yahoo.com?hostname=a1.host1.test.yahoo.com&hostname=a2.host1.test.yahoo.com", + Optional.empty(), + BatchOperationResult.class )).thenReturn(BatchOperationResult.successResult()); orchestrator.suspend(parentHostName, hostNames); @@ -128,10 +133,9 @@ public class OrchestratorImplTest { String failureReason = "Failed to suspend"; when(configServerApi.put( - eq("/orchestrator/v1/suspensions/hosts/host1.test.yahoo.com?hostname=a1.host1.test.yahoo.com&hostname=a2.host1.test.yahoo.com"), - eq(Optional.empty()), - eq(BatchOperationResult.class), - any() + "/orchestrator/v1/suspensions/hosts/host1.test.yahoo.com?hostname=a1.host1.test.yahoo.com&hostname=a2.host1.test.yahoo.com", + Optional.empty(), + BatchOperationResult.class )).thenReturn(new BatchOperationResult(failureReason)); orchestrator.suspend(parentHostName, hostNames); @@ -144,10 +148,9 @@ public class OrchestratorImplTest { String exceptionMessage = "Exception: Something crashed!"; when(configServerApi.put( - eq("/orchestrator/v1/suspensions/hosts/host1.test.yahoo.com?hostname=a1.host1.test.yahoo.com&hostname=a2.host1.test.yahoo.com"), - eq(Optional.empty()), - eq(BatchOperationResult.class), - any() + "/orchestrator/v1/suspensions/hosts/host1.test.yahoo.com?hostname=a1.host1.test.yahoo.com&hostname=a2.host1.test.yahoo.com", + Optional.empty(), + BatchOperationResult.class )).thenThrow(new RuntimeException(exceptionMessage)); orchestrator.suspend(parentHostName, hostNames); |