From c7560de0db8124086e8ddde337c31070854dbdc8 Mon Sep 17 00:00:00 2001 From: erik Date: Tue, 31 Jan 2023 10:25:04 +0100 Subject: [PATCH] Repair and test monitoring auth spec --- src/main/cljc/dda/c4k_keycloak/core.cljc | 2 +- src/test/cljc/dda/c4k_keycloak/core_test.cljc | 3 ++- src/test/resources/keycloak-test/invalid-auth.yaml | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/keycloak-test/invalid-auth.yaml diff --git a/src/main/cljc/dda/c4k_keycloak/core.cljc b/src/main/cljc/dda/c4k_keycloak/core.cljc index 49d7e69..2f1f181 100644 --- a/src/main/cljc/dda/c4k_keycloak/core.cljc +++ b/src/main/cljc/dda/c4k_keycloak/core.cljc @@ -20,7 +20,7 @@ (def auth? (s/keys :req-un [::kc/keycloak-admin-user ::kc/keycloak-admin-password ::postgres/postgres-db-user ::postgres/postgres-db-password] - :opt-un [::mon/auth])) + :opt-un [::mon/mon-auth])) (defn-spec k8s-objects cp/map-or-seq? [config config? diff --git a/src/test/cljc/dda/c4k_keycloak/core_test.cljc b/src/test/cljc/dda/c4k_keycloak/core_test.cljc index d872acf..5e59f93 100644 --- a/src/test/cljc/dda/c4k_keycloak/core_test.cljc +++ b/src/test/cljc/dda/c4k_keycloak/core_test.cljc @@ -17,4 +17,5 @@ (deftest validate-valid-resources (is (s/valid? cut/config? (yaml/load-as-edn "keycloak-test/valid-config.yaml"))) (is (s/valid? cut/auth? (yaml/load-as-edn "keycloak-test/valid-auth.yaml"))) - (is (not (s/valid? cut/config? (yaml/load-as-edn "keycloak-test/invalid-config.yaml"))))) \ No newline at end of file + (is (not (s/valid? cut/config? (yaml/load-as-edn "keycloak-test/invalid-config.yaml")))) + (is (not (s/valid? cut/config? (yaml/load-as-edn "keycloak-test/invalid-auth.yaml"))))) \ No newline at end of file diff --git a/src/test/resources/keycloak-test/invalid-auth.yaml b/src/test/resources/keycloak-test/invalid-auth.yaml new file mode 100644 index 0000000..612f746 --- /dev/null +++ b/src/test/resources/keycloak-test/invalid-auth.yaml @@ -0,0 +1,7 @@ +keyclok-admin-user: "testuser" +keycloak-admin-password: "testpassword" +postgres-db-user: "keycloakuser" +postgres-db-password: "testdbpassword" +mon-auth: + grafana-cloud-user: "user" + grafana-cloud-password: "password" \ No newline at end of file