[Skip-CI] [WIP] Update tests for config and auth

Currently specs opt-un seems to validate invalid specs.
This results in invalid configs not failing our tests.
This commit is contained in:
erik 2023-01-27 13:03:09 +01:00
parent d362d440dd
commit 938ba80275
3 changed files with 7 additions and 10 deletions

View file

@ -14,19 +14,16 @@
(def config-defaults {:issuer "staging"}) (def config-defaults {:issuer "staging"})
(s/def ::mon-cfg mon/config?) (s/def ::config (s/keys :req-un [::kc/fqdn]
(s/def ::mon-auth mon/auth?) :opt-un [::kc/issuer
::mon/config]))
(def config? (s/keys :req-un [::kc/fqdn]
:opt-un [::kc/issuer
::mon-cfg]))
(def auth? (s/keys :req-un [::kc/keycloak-admin-user ::kc/keycloak-admin-password (def auth? (s/keys :req-un [::kc/keycloak-admin-user ::kc/keycloak-admin-password
::postgres/postgres-db-user ::postgres/postgres-db-password] ::postgres/postgres-db-user ::postgres/postgres-db-password]
:opt-un [::mon-auth])) :opt-un [::mon/auth]))
(defn-spec k8s-objects cp/map-or-seq? (defn-spec k8s-objects cp/map-or-seq?
[config config? [config ::config
auth auth?] auth auth?]
(map yaml/to-string (map yaml/to-string
(filter (filter

View file

@ -16,5 +16,5 @@
;; TODO: 2023.01.27 - jem: may not validate k3s-cluster-name entries ... find out what's wrong. ;; TODO: 2023.01.27 - jem: may not validate k3s-cluster-name entries ... find out what's wrong.
(deftest validate-valid-resources (deftest validate-valid-resources
(is (s/valid? cut/config? (yaml/load-as-edn "keycloak-test/valid-config.yaml"))) (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 (s/valid? cut/auth? (yaml/load-as-edn "keycloak-test/valid-auth.yaml"))))

View file

@ -3,4 +3,4 @@ issuer: "staging"
mon-cfg: mon-cfg:
grafana-cloud-url: "url-for-your-prom-remote-write-endpoint" grafana-cloud-url: "url-for-your-prom-remote-write-endpoint"
cluster-name: "keycloak" cluster-name: "keycloak"
cluster-stage: "test" cluster-stage: :test