Test for valid resources

This commit is contained in:
bom 2023-03-28 12:06:31 +02:00
parent 4f65c61c1c
commit 93a36e992e
6 changed files with 22 additions and 24 deletions

View file

@ -48,7 +48,7 @@ test-schema:
stage: build_and_test stage: build_and_test
script: script:
- lein uberjar - 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: artifacts:
paths: paths:
- target/uberjar - target/uberjar

View file

@ -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"))))

View file

@ -9,5 +9,5 @@ volume-total-storage-size: 6
restic-repository: "repo-path" restic-repository: "repo-path"
mon-cfg: mon-cfg:
grafana-cloud-url: "url-for-your-prom-remote-write-endpoint" grafana-cloud-url: "url-for-your-prom-remote-write-endpoint"
k3s-cluster-name: "jitsi" cluster-name: "jitsi"
k3s-cluster-stage: "test" cluster-stage: "test"

View file

@ -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"}}

View file

@ -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"}}