From fc227f1f66fd129b8363a003cc19d690cee9646e Mon Sep 17 00:00:00 2001 From: khys95 Date: Thu, 15 Aug 2024 17:44:23 +0200 Subject: [PATCH] pool: add more pool test and clean up --- .ci/poolEndpoint.http | 41 +++++++++++++++++++ .gitlab-ci.yml | 1 + http-client.private.env.json | 8 +++- .../pool/PoolGroupInfoResources.java | 7 ++-- 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/.ci/poolEndpoint.http b/.ci/poolEndpoint.http index 1c3fb0cd566..492475fbc03 100644 --- a/.ci/poolEndpoint.http +++ b/.ci/poolEndpoint.http @@ -9,6 +9,47 @@ Authorization: Basic {{user_name}} {{passwd}} }); %} +### Get the list of pools inside the disk-qos +GET {{frontend-door}}{{endpoint}}{{poolmanager}}{{qosDiskGroup}}{{pools}} +Authorization: Basic {{user_name}} {{passwd}} + +> {% + client.test("Successful response when calling /pool", function() { + client.assert(response.status === 200, "Response was not 200"); + client.assert(response.body[0] === "pool_res1", "index 0 is not pool_res1"); + client.assert(response.body[1] === "pool_res2", "index 1 is not pool_res2"); + client.assert(response.body[2] === "pool_res3", "index 2 is not pool_res3"); + client.assert(response.contentType !="application/json", "Content type is json"); + }); +%} + +### Get information about resgroup +GET {{frontend-door}}{{endpoint}}{{poolmanager}}{{resGroup}} +Content-Type: application/json +Authorization: Basic {{user_name}} {{passwd}} + +> {% + client.test("Successful response and information when calling /resGroup", function() { + client.assert(response.status === 200, "Response was not 200"); + client.assert(response.body["name"] === "resgroup", "incorrect group name"); + client.assert(response.body["links"][0] === "resilient-link", "incorrect link"); + client.assert(response.body["pools"][0] === "pool_res1", "index 0 is not pool_res1"); + client.assert(response.body["pools"][1] === "pool_res2", "index 1 is not pool_res2"); + client.assert(response.body["pools"][2] === "pool_res3", "index 2 is not pool_res3"); + }); +%} + +### Get information about non existent group +GET {{frontend-door}}{{endpoint}}{{poolmanager}}{{nonExistentGroup}}{{pools}} +Content-Type: application/json +Authorization: Basic {{user_name}} {{passwd}} + +> {% + client.test("Successful response when calling /pool", function() { + client.assert(response.status === 500, "Response was not 500"); + }); +%} + ### Upload frontend file PUT {{webdav-door}}/frontendReadMeFile Authorization: Basic {{user_name}} {{passwd}} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 407dc5dec6a..38d8809fa25 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -482,6 +482,7 @@ Frontend test suite: - kubectl -n $K8S_NAMESPACE cp .ci/qosEndpoint.http http-tester:/qosEndpoint.http - kubectl -n $K8S_NAMESPACE cp .ci/qos-policyEndpoint.http http-tester:/qos-policyEndpoint.http - kubectl -n $K8S_NAMESPACE cp README.md http-tester:/README.md + - kubectl -n $K8S_NAMESPACE cp BUILDING.md http-tester:/BUILDING.md - kubectl -n $K8S_NAMESPACE cp .ci/migrationEndpoint.http http-tester:/migrationEndpoint.http - kubectl -n $K8S_NAMESPACE cp http-client.private.env.json http-tester:/http-client.private.env.json - kubectl -n $K8S_NAMESPACE exec http-tester -- java --add-opens=java.base/java.util=ALL-UNNAMED $IJHTTP_JAVA_OPTS -cp /intellij-http-client/\* com.intellij.httpClient.cli.HttpClientMain -e Test -D /poolEndpoint.http -p /http-client.private.env.json --insecure --report=/httpTests diff --git a/http-client.private.env.json b/http-client.private.env.json index 63df4a41d86..ce73dcd5adf 100644 --- a/http-client.private.env.json +++ b/http-client.private.env.json @@ -8,13 +8,17 @@ "endpoint": "/api/v1", "qos-management": "/qos-management/qos", "migrations": "/migrations", + "poolmanager": "/poolgroups", + "resGroup": "/resgroup", + "qosDiskGroup": "/qos-disk", + "nonExistentGroup": "/nonExistentGroup", "pools": "/pools", "qos-policy": "/qos-policy", "namespace": "/namespace", "labels": "/labels", - "sourcePool" : "\"pool_write\"", + "sourcePool" : "\"pool_a\"", "target": "hsm", - "targetPools": "\"pool_res1\"", + "targetPools": "\"pool_b\"", "osm_targetPools": "\"osm\"", "wrong_src_pool_name" : "wrong_src_pool_name", "wrong_target_pool_name" : "wrong_target_pool_name", diff --git a/modules/dcache-frontend/src/main/java/org/dcache/restful/resources/pool/PoolGroupInfoResources.java b/modules/dcache-frontend/src/main/java/org/dcache/restful/resources/pool/PoolGroupInfoResources.java index 248f05fd650..ff4e141b0fb 100644 --- a/modules/dcache-frontend/src/main/java/org/dcache/restful/resources/pool/PoolGroupInfoResources.java +++ b/modules/dcache-frontend/src/main/java/org/dcache/restful/resources/pool/PoolGroupInfoResources.java @@ -128,11 +128,12 @@ public PoolGroup getPoolGroup(@ApiParam("The poolgroup to be described.") @GET @Path("/{group}/pools") - @ApiOperation("Get a list of pools that are a member of a poolgroup. If no " - + "poolgroup is specified then all pools are listed. " + @ApiOperation("Get a list of pools that are a member of a pool group. If no " + + "pool group is specified then all pools are listed. " + "Results sorted lexicographically by pool name.") @Produces(MediaType.APPLICATION_JSON) - public String[] getPoolsOfGroup(@ApiParam("The poolgroup to be described.") + //todo: add logic when no pool group is specified + public String[] getPoolsOfGroup(@ApiParam("The pool group to be described.") @PathParam("group") String group) { if (group == null) { return service.listPools();