From 9cd257584441951857be5536ff95aeb1ad29cc05 Mon Sep 17 00:00:00 2001 From: David Butenhof Date: Mon, 6 May 2024 17:47:46 -0400 Subject: [PATCH] Fixers --- .../resources/query_apis/datasets/__init__.py | 2 +- .../test/functional/server/test_datasets.py | 6 +++--- server/pbenchinacan/load_keycloak.sh | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/pbench/server/api/resources/query_apis/datasets/__init__.py b/lib/pbench/server/api/resources/query_apis/datasets/__init__.py index 97122ad418..c1b57f9a5a 100644 --- a/lib/pbench/server/api/resources/query_apis/datasets/__init__.py +++ b/lib/pbench/server/api/resources/query_apis/datasets/__init__.py @@ -96,7 +96,7 @@ def get_index( """Retrieve ES indices based on a given root_index_name. Datasets without an index can't be referenced in most APIs that rely on - Elasticsearch. Instead, we'll raise a CONFLICT error. However, the + Elasticsearch. Instead, we'll raise a NOT_FOUND error. However, the /api/v1/datasets API will specify ok_no_index as they need to operate on the dataset regardless of whether indexing is enabled. diff --git a/lib/pbench/test/functional/server/test_datasets.py b/lib/pbench/test/functional/server/test_datasets.py index 02dd90be3b..7112bce925 100644 --- a/lib/pbench/test/functional/server/test_datasets.py +++ b/lib/pbench/test/functional/server/test_datasets.py @@ -462,7 +462,7 @@ class TestIndexing: def test_details(self, server_client: PbenchServerClient, login_user): """Check access to indexed data - Perform a GET /datasets/details/{id} to be confirm whether indexed run + Perform a GET /datasets/details/{id} to confirm whether indexed run data is available. """ print(" ... checking dataset RUN index ...") @@ -477,7 +477,7 @@ def test_details(self, server_client: PbenchServerClient, login_user): indexed = bool(indices.json()) print( f"\t... checking run details for {d.name} " - f"({'' if indexed else 'not '} indexed)" + f"({'' if indexed else 'not '}indexed)" ) response = server_client.get( API.DATASETS_DETAIL, {"dataset": d.resource_id}, raise_error=False @@ -490,7 +490,7 @@ def test_details(self, server_client: PbenchServerClient, login_user): assert ( d.metadata["dataset.metalog.pbench"]["script"] == detail["runMetadata"]["script"] - ), f"Unexpected details {detail}" + ) else: assert ( response.status_code == HTTPStatus.NOT_FOUND diff --git a/server/pbenchinacan/load_keycloak.sh b/server/pbenchinacan/load_keycloak.sh index d2298316d5..81810c66a2 100755 --- a/server/pbenchinacan/load_keycloak.sh +++ b/server/pbenchinacan/load_keycloak.sh @@ -70,7 +70,7 @@ echo echo "Keycloak connection successful on : ${KEYCLOAK_HOST_PORT}" echo -status_code=$(curl -f -s -o /dev/null -w "%{http_code}" -X POST \ +status_code=$(curl -f -sS -o /dev/null -w "%{http_code}" -X POST \ "${KEYCLOAK_HOST_PORT}/admin/realms" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -H "Content-Type: application/json" \ @@ -88,7 +88,7 @@ fi # a token from Keycloak using a . # Having in the aud claim of the token is essential for the token # to be validated. -curl -si -f -X POST \ +curl -sSi -f -X POST \ "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/client-scopes" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -H "Content-Type: application/json" \ @@ -117,7 +117,7 @@ curl -si -f -X POST \ ] }' -CLIENT_CONF=$(curl -si -f -X POST \ +CLIENT_CONF=$(curl -sSi -f -X POST \ "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/clients" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -H "Content-Type: application/json" \ @@ -138,7 +138,7 @@ else echo "Created ${CLIENT} client" fi -status_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ +status_code=$(curl -sS -o /dev/null -w "%{http_code}" -X POST \ "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/clients/${CLIENT_ID}/roles" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -H "Content-Type: application/json" \ @@ -151,7 +151,7 @@ else echo "Created an 'ADMIN' role under ${CLIENT} client of the ${REALM} realm" fi -ROLE_ID=$(curl -s -f "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/clients/${CLIENT_ID}/roles" \ +ROLE_ID=$(curl -sS -f "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/clients/${CLIENT_ID}/roles" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" | jq -r '.[0].id') if [[ -z "${ROLE_ID}" ]]; then @@ -159,7 +159,7 @@ if [[ -z "${ROLE_ID}" ]]; then exit 1 fi -USER=$(curl -si -f -X POST \ +USER=$(curl -sSi -f -X POST \ "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/users" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -H "Content-Type: application/json" \ @@ -174,7 +174,7 @@ else echo "Created an 'admin' user inside ${REALM} realm" fi -status_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ +status_code=$(curl -sS -o /dev/null -w "%{http_code}" -X POST \ "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/users/${USER_ID}/role-mappings/clients/${CLIENT_ID}" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -H "Content-Type: application/json" \ @@ -188,7 +188,7 @@ else fi # Verify that the user id has an 'ADMIN' role assigned to it -USER_ROLES=$(curl -s "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/users/${USER_ID}/role-mappings/clients/${CLIENT_ID}" \ +USER_ROLES=$(curl -sS "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/users/${USER_ID}/role-mappings/clients/${CLIENT_ID}" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -H "Content-Type: application/json" | jq -r '.[].name')