diff options
Diffstat (limited to 'controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java')
-rw-r--r-- | controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java index ce6f713a13d..8bda8ba0d59 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/configserver/ConfigServerApiHandlerTest.java @@ -10,15 +10,15 @@ import com.yahoo.vespa.hosted.controller.integration.ZoneApiMock; import com.yahoo.vespa.hosted.controller.proxy.ProxyRequest; import com.yahoo.vespa.hosted.controller.restapi.ContainerTester; import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.File; import java.net.URI; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; /** * @author freva @@ -35,7 +35,7 @@ public class ConfigServerApiHandlerTest extends ControllerContainerTest { private ContainerTester tester; private ConfigServerProxyMock proxy; - @Before + @BeforeEach public void before() { tester = new ContainerTester(container, responseFiles); tester.serviceRegistry().zoneRegistry() @@ -45,14 +45,14 @@ public class ConfigServerApiHandlerTest extends ControllerContainerTest { } @Test - public void test_requests() { + void test_requests() { // GET /configserver/v1 tester.assertResponse(operatorRequest("http://localhost:8080/configserver/v1"), new File("root.json")); // GET /configserver/v1/nodes/v2 tester.assertResponse(operatorRequest("http://localhost:8080/configserver/v1/prod/us-north-1/nodes/v2"), - "ok"); + "ok"); assertLastRequest("https://cfg.prod.us-north-1.test.vip:4443/", "GET"); // GET /configserver/v1/nodes/v2/node/?recursive=true @@ -82,11 +82,11 @@ public class ConfigServerApiHandlerTest extends ControllerContainerTest { assertLastRequest("https://cfg.dev.aws-us-north-2.test.vip:4443/", "PATCH"); assertEquals("{\"currentRestartGeneration\": 1}", proxy.lastRequestBody().get()); - assertFalse("Actions are logged to audit log", tester.controller().auditLogger().readLog().entries().isEmpty()); + assertFalse(tester.controller().auditLogger().readLog().entries().isEmpty(), "Actions are logged to audit log"); } @Test - public void test_allowed_apis() { + void test_allowed_apis() { // GET /configserver/v1/prod/us-north-1 tester.assertResponse(() -> operatorRequest("http://localhost:8080/configserver/v1/prod/us-north-1/"), "{\"error-code\":\"FORBIDDEN\",\"message\":\"Cannot access path '/' through /configserver/v1, following APIs are permitted: /flags/v1/, /nodes/v2/, /orchestrator/v1/\"}", @@ -98,33 +98,33 @@ public class ConfigServerApiHandlerTest extends ControllerContainerTest { } @Test - public void test_invalid_requests() { + void test_invalid_requests() { // POST /configserver/v1/prod/us-north-34/nodes/v2 tester.assertResponse(() -> operatorRequest("http://localhost:8080/configserver/v1/prod/us-north-42/nodes/v2", - "", Request.Method.POST), + "", Request.Method.POST), "{\"error-code\":\"BAD_REQUEST\",\"message\":\"No such zone: prod.us-north-42\"}", 400); assertFalse(proxy.lastReceived().isPresent()); } @Test - public void non_operators_are_forbidden() { + void non_operators_are_forbidden() { // Read request tester.assertResponse(() -> authenticatedRequest("http://localhost:8080/configserver/v1/prod/us-north-1/nodes/v2/node"), "{\n" + - " \"code\" : 403,\n" + - " \"message\" : \"Access denied\"\n" + - "}", 403); + " \"code\" : 403,\n" + + " \"message\" : \"Access denied\"\n" + + "}", 403); // Write request tester.assertResponse(() -> authenticatedRequest("http://localhost:8080/configserver/v1/prod/us-north-1/nodes/v2/node", "", Request.Method.POST), "{\n" + - " \"code\" : 403,\n" + - " \"message\" : \"Access denied\"\n" + - "}", 403); + " \"code\" : 403,\n" + + " \"message\" : \"Access denied\"\n" + + "}", 403); } @Test - public void unauthenticated_request_are_unauthorized() { + void unauthenticated_request_are_unauthorized() { { // Read request Request request = new Request("http://localhost:8080/configserver/v1/prod/us-north-1/nodes/v2/node", "", Request.Method.GET); |