Implement generation tests
This commit is contained in:
parent
0db2059c3f
commit
5f1626f488
1 changed files with 96 additions and 4 deletions
|
@ -5,8 +5,100 @@
|
||||||
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[dda.c4k-common.yaml :as yaml]
|
[dda.c4k-common.yaml :as yaml]
|
||||||
[dda.c4k-taiga.core :as cut]
|
[dda.c4k-taiga.taiga :as cut]))
|
||||||
[clojure.spec.alpha :as s]))
|
|
||||||
|
|
||||||
(deftest dummy-taiga-test
|
#?(:cljs
|
||||||
(is true))
|
(defmethod yaml/load-resource :website-test [resource-name]
|
||||||
|
(case resource-name
|
||||||
|
"taiga-test/valid-config.yaml" (rc/inline "taiga-test/valid-config.yaml")
|
||||||
|
"taiga-test/valid-auth.yaml" (rc/inline "taiga-test/valid-auth.yaml")
|
||||||
|
(throw (js/Error. "Undefined Resource!")))))
|
||||||
|
|
||||||
|
(deftest should-generate-configmap
|
||||||
|
(is (= {:apiVersion "v1",
|
||||||
|
:kind "ConfigMap",
|
||||||
|
:metadata {:name "taiga-configmap", :namespace "default"},
|
||||||
|
:data
|
||||||
|
{:ENABLE_TELEMETRY "false",
|
||||||
|
:TAIGA_SITES_SCHEME "https",
|
||||||
|
:TAIGA_SITES_DOMAIN "taiga.test.meissa.de",
|
||||||
|
:TAIGA_SUBPATH "",
|
||||||
|
:TAIGA_URL "https://taiga.test.meissa.de",
|
||||||
|
:TAIGA_WEBSOCKETS_URL "wss://taiga.test.meissa.de",
|
||||||
|
:PUBLIC_REGISTER_ENABLED "false",
|
||||||
|
:ENABLE_GITHUB_IMPORTER "false",
|
||||||
|
:ENABLE_JIRA_IMPORTER "false",
|
||||||
|
:ENABLE_TRELLO_IMPORTER "false",
|
||||||
|
:RABBITMQ_DEFAULT_VHOST "taiga",
|
||||||
|
:SESSION_COOKIE_SECURE "false",
|
||||||
|
:CSRF_COOKIE_SECURE "false"}}
|
||||||
|
(cut/generate-configmap (yaml/load-as-edn "taiga-test/valid-config.yaml")))))
|
||||||
|
|
||||||
|
(deftest should-generate-pvc-taiga-media-data
|
||||||
|
(is (= {:apiVersion "v1",
|
||||||
|
:kind "PersistentVolumeClaim",
|
||||||
|
:metadata
|
||||||
|
{:name "taiga-media-data",
|
||||||
|
:namespace "default",
|
||||||
|
:labels {:app "taiga", :app.kubernetes.part-of "taiga"}},
|
||||||
|
:spec
|
||||||
|
{:storageClassName "local-path",
|
||||||
|
:accessModes ["ReadWriteOnce"],
|
||||||
|
:resources {:requests {:storage "5"}}}}
|
||||||
|
(cut/generate-pvc-taiga-media-data (yaml/load-as-edn "taiga-test/valid-config.yaml")))))
|
||||||
|
|
||||||
|
(deftest should-generate-pvc-taiga-static-data
|
||||||
|
(is (= {:apiVersion "v1",
|
||||||
|
:kind "PersistentVolumeClaim",
|
||||||
|
:metadata
|
||||||
|
{:name "taiga-media-data",
|
||||||
|
:namespace "default",
|
||||||
|
:labels {:app "taiga", :app.kubernetes.part-of "taiga"}},
|
||||||
|
:spec
|
||||||
|
{:storageClassName "local-path",
|
||||||
|
:accessModes ["ReadWriteOnce"],
|
||||||
|
:resources {:requests {:storage "5"}}}}
|
||||||
|
(cut/generate-pvc-taiga-static-data (yaml/load-as-edn "taiga-test/valid-config.yaml")))))
|
||||||
|
|
||||||
|
(deftest should-generate-rabbitmq-pvc-async
|
||||||
|
(is (= {:apiVersion "v1",
|
||||||
|
:kind "PersistentVolumeClaim",
|
||||||
|
:metadata
|
||||||
|
{:name "taiga-media-data",
|
||||||
|
:namespace "default",
|
||||||
|
:labels {:app "taiga", :app.kubernetes.part-of "taiga"}},
|
||||||
|
:spec
|
||||||
|
{:storageClassName "local-path",
|
||||||
|
:accessModes ["ReadWriteOnce"],
|
||||||
|
:resources {:requests {:storage "5"}}}}
|
||||||
|
(cut/generate-rabbitmq-pvc-async(yaml/load-as-edn "taiga-test/valid-config.yaml")))))
|
||||||
|
|
||||||
|
(deftest should-generate-rabbitmq-pvc-events
|
||||||
|
(is (= {:apiVersion "v1",
|
||||||
|
:kind "PersistentVolumeClaim",
|
||||||
|
:metadata
|
||||||
|
{:name "taiga-media-data",
|
||||||
|
:namespace "default",
|
||||||
|
:labels {:app "taiga", :app.kubernetes.part-of "taiga"}},
|
||||||
|
:spec
|
||||||
|
{:storageClassName "local-path",
|
||||||
|
:accessModes ["ReadWriteOnce"],
|
||||||
|
:resources {:requests {:storage "5"}}}}
|
||||||
|
(cut/generate-rabbitmq-pvc-events (yaml/load-as-edn "taiga-test/valid-config.yaml")))))
|
||||||
|
|
||||||
|
(deftest should-generate-secret
|
||||||
|
(is (= {:apiVersion "v1",
|
||||||
|
:kind "Secret",
|
||||||
|
:metadata
|
||||||
|
{:name "taiga-secret", :labels {:app.kubernetes.part-of "taiga"}},
|
||||||
|
:data
|
||||||
|
{:TAIGA_SECRET_KEY "some-key",
|
||||||
|
:EMAIL_HOST_USER "mailer-user",
|
||||||
|
:EMAIL_HOST_PASSWORD "mailer-pw",
|
||||||
|
:RABBITMQ_USER "rabbit-user",
|
||||||
|
:RABBITMQ_PASS "rabbit-pw",
|
||||||
|
:RABBITMQ_ERLANG_COOKIE "rabbit-erlang",
|
||||||
|
:DJANGO_SUPERUSER_USERNAME "taiga-admin",
|
||||||
|
:DJANGO_SUPERUSER_PASSWORD "super-password",
|
||||||
|
:DJANGO_SUPERUSER_EMAIL "some@example.com"}}
|
||||||
|
(cut/generate-secret (yaml/load-as-edn "taiga-test/valid-auth.yaml")))))
|
Loading…
Reference in a new issue