From 778cc7d180a198fe2a2047c4e6a9ec08fd0658bf Mon Sep 17 00:00:00 2001 From: Bastian Hofmann Date: Mon, 18 Mar 2024 10:19:33 +0100 Subject: [PATCH] Fix integration tests --- test/integration/api_key.bats | 11 ++++++++--- test/integration/read_only_api_key.bats | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/test/integration/api_key.bats b/test/integration/api_key.bats index 84290eb..305c7f5 100644 --- a/test/integration/api_key.bats +++ b/test/integration/api_key.bats @@ -9,7 +9,12 @@ setup_file() { [[ "${output}" =~ .*\"status\":\"ok\".* ]] } -@test "api key authentication fails with key" { - run kubectl exec -n default curl -- curl -s http://qdrant.qdrant-helm-integration:6333/collections - [ "${output}" = "Write access denied" ] +@test "api key authentication fails with no key" { + run kubectl exec -n default curl -- curl -s -w " - %{response_code}" http://qdrant.qdrant-helm-integration:6333/collections + [ "${output}" = "Must provide an API key or an Authorization bearer token - 403" ] +} + +@test "api key authentication fails with wrong key" { + run kubectl exec -n default curl -- curl -s -w " - %{response_code}" http://qdrant.qdrant-helm-integration:6333/collections -H 'api-key: invalid' + [ "${output}" = "Invalid API key or JWT token - 403" ] } diff --git a/test/integration/read_only_api_key.bats b/test/integration/read_only_api_key.bats index 74f1330..63f719e 100644 --- a/test/integration/read_only_api_key.bats +++ b/test/integration/read_only_api_key.bats @@ -9,7 +9,12 @@ setup_file() { [[ "${output}" =~ .*\"status\":\"ok\".* ]] } -@test "read-only api key authentication fails with key" { - run kubectl exec -n default curl -- curl -s http://qdrant.qdrant-helm-integration:6333/collections - [ "${output}" = "Write access denied" ] +@test "read-only api key authentication fails with no key" { + run kubectl exec -n default curl -- curl -s -w " - %{response_code}" http://qdrant.qdrant-helm-integration:6333/collections + [ "${output}" = "Must provide an API key or an Authorization bearer token - 403" ] +} + +@test "read-only api key authentication fails with wrong key" { + run kubectl exec -n default curl -- curl -s -w " - %{response_code}" http://qdrant.qdrant-helm-integration:6333/collections -H 'api-key: invalid' + [ "${output}" = "Invalid API key or JWT token - 403" ] }