diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7af57b9..6815ca1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,7 +48,7 @@ test-schema: stage: build_and_test script: - lein uberjar - - java -jar target/uberjar/c4k-forgejo-standalone.jar valid-config.edn valid-auth.edn | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate - + - java -jar target/uberjar/c4k-forgejo-standalone.jar src/test/resources/forgejo_test/valid-config.yaml src/test/resources/forgejo_test/valid-auth.yaml | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate - artifacts: paths: - target/uberjar diff --git a/src/test/cljc/dda/c4k_forgejo/core_test.cljc b/src/test/cljc/dda/c4k_forgejo/core_test.cljc new file mode 100644 index 0000000..5386019 --- /dev/null +++ b/src/test/cljc/dda/c4k_forgejo/core_test.cljc @@ -0,0 +1,19 @@ +(ns dda.c4k-forgejo.core-test + (:require + #?(:cljs [shadow.resource :as rc]) + #?(:clj [clojure.test :refer [deftest is are testing run-tests]] + :cljs [cljs.test :refer-macros [deftest is are testing run-tests]]) + [clojure.spec.alpha :as s] + [dda.c4k-common.yaml :as yaml] + [dda.c4k-forgejo.core :as cut])) + +#?(:cljs + (defmethod yaml/load-resource :forgejo-test [resource-name] + (case resource-name + "forgejo-test/valid-auth.yaml" (rc/inline "forgejo-test/valid-auth.yaml") + "forgejo-test/valid-config.yaml" (rc/inline "forgejo-test/valid-config.yaml") + (throw (js/Error. "Undefined Resource!"))))) + +(deftest validate-valid-resources + (is (s/valid? cut/config? (yaml/load-as-edn "forgejo-test/valid-config.yaml"))) + (is (s/valid? cut/auth? (yaml/load-as-edn "forgejo-test/valid-auth.yaml")))) \ No newline at end of file diff --git a/valid-auth.yaml b/src/test/resources/forgejo-test/valid-auth.yaml similarity index 100% rename from valid-auth.yaml rename to src/test/resources/forgejo-test/valid-auth.yaml diff --git a/valid-config.yaml b/src/test/resources/forgejo-test/valid-config.yaml similarity index 86% rename from valid-config.yaml rename to src/test/resources/forgejo-test/valid-config.yaml index 10b63e6..2bcf05b 100644 --- a/valid-config.yaml +++ b/src/test/resources/forgejo-test/valid-config.yaml @@ -9,5 +9,5 @@ volume-total-storage-size: 6 restic-repository: "repo-path" mon-cfg: grafana-cloud-url: "url-for-your-prom-remote-write-endpoint" - k3s-cluster-name: "jitsi" - k3s-cluster-stage: "test" \ No newline at end of file + cluster-name: "jitsi" + cluster-stage: "test" \ No newline at end of file diff --git a/valid-auth.edn b/valid-auth.edn deleted file mode 100644 index d444915..0000000 --- a/valid-auth.edn +++ /dev/null @@ -1,9 +0,0 @@ -{:postgres-db-user "forgejo" - :postgres-db-password "forgejo-db-password" - :mailer-user "" - :mailer-pw "" - :aws-access-key-id "AWS_KEY_ID" - :aws-secret-access-key "AWS_KEY_SECRET" - :restic-password "" - :mon-auth {:grafana-cloud-user "user" - :grafana-cloud-password "password"}} diff --git a/valid-config.edn b/valid-config.edn deleted file mode 100644 index c8d4253..0000000 --- a/valid-config.edn +++ /dev/null @@ -1,12 +0,0 @@ -{:default-app-name "Meissas awesome forgejo" - :fqdn "test.de" - :issuer "staging" - :mailer-from "test@test.de" - :mailer-host-port "test.de:123" - :service-whitelist-domains "test.de" - :service-noreply-address "noreply@test.de" - :volume-total-storage-size 6 - :restic-repository "repo-path" - :mon-cfg {:grafana-cloud-url "url-for-your-prom-remote-write-endpoint" - :k3s-cluster-name "jitsi" - :k3s-cluster-stage "test"}}