Rewrite tests using new common_test
This commit is contained in:
parent
1fa978e4cc
commit
3d4b5728d1
2 changed files with 14 additions and 35 deletions
|
@ -5,7 +5,7 @@
|
||||||
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.10.3"]
|
:dependencies [[org.clojure/clojure "1.10.3"]
|
||||||
[org.clojure/tools.reader "1.3.6"]
|
[org.clojure/tools.reader "1.3.6"]
|
||||||
[org.domaindrivenarchitecture/c4k-common-clj "2.0.3"]
|
[org.domaindrivenarchitecture/c4k-common-clj "2.1.0"]
|
||||||
[hickory "0.7.1"]]
|
[hickory "0.7.1"]]
|
||||||
:target-path "target/%s/"
|
:target-path "target/%s/"
|
||||||
:source-paths ["src/main/cljc"
|
:source-paths ["src/main/cljc"
|
||||||
|
|
|
@ -2,42 +2,21 @@
|
||||||
(:require
|
(:require
|
||||||
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
||||||
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
||||||
|
[dda.c4k-common.common-test :as ct]
|
||||||
[dda.c4k-gitea.gitea :as cut]))
|
[dda.c4k-gitea.gitea :as cut]))
|
||||||
|
|
||||||
|
|
||||||
(deftest should-generate-appini-env
|
(deftest should-generate-appini-env
|
||||||
(is (= {:apiVersion "v1",
|
(is (= {:GITEA__database__USER-c1 nil,
|
||||||
:kind "ConfigMap",
|
:GITEA__database__USER-c2 "pg-user",
|
||||||
:metadata {:name "gitea-env", :namespace "default"},
|
:GITEA__database__PASSWD-c1 nil,
|
||||||
:data
|
:GITEA__database__PASSWD-c2 "pg-pw",
|
||||||
{:GITEA__database__DB_TYPE "postgres",
|
:GITEA__server__DOMAIN-c1 nil,
|
||||||
:GITEA__database__HOST
|
:GITEA__server__DOMAIN-c2 "test.com",
|
||||||
"postgresql-service.default.svc.cluster.local:5432",
|
:GITEA__server__ROOT_URL-c1 "https://",
|
||||||
:GITEA__database__NAME "gitea",
|
:GITEA__server__ROOT_URL-c2 "https://test.com"}
|
||||||
:GITEA__database__USER "pg-user",
|
(ct/map-diff (cut/generate-appini-env {})
|
||||||
:GITEA__database__PASSWD "pg-pw",
|
(cut/generate-appini-env {:fqdn "test.com" :issuer "staging" :postgres-db-user "pg-user" :postgres-db-password "pg-pw"})))))
|
||||||
:GITEA__server__DOMAIN "test.com",
|
|
||||||
:GITEA__server__ROOT_URL "https://test.com"}}
|
|
||||||
(cut/generate-appini-env {:fqdn "test.com" :issuer "staging" :postgres-db-user "pg-user" :postgres-db-password "pg-pw"}))))
|
|
||||||
|
|
||||||
|
|
||||||
(deftest should-generate-ingress
|
(deftest should-generate-ingress
|
||||||
(is (= {:apiVersion "networking.k8s.io/v1",
|
(is (= {:hosts-c1 nil, :hosts-c2 "test.com", :host-c1 nil, :host-c2 "test.com"}
|
||||||
:kind "Ingress",
|
(ct/map-diff (cut/generate-ingress {}) (cut/generate-ingress {:fqdn "test.com" :issuer "staging"})))))
|
||||||
:metadata
|
|
||||||
{:name "ingress-gitea",
|
|
||||||
:namespace "default",
|
|
||||||
:annotations
|
|
||||||
{:kubernetes.io/ingress.class "traefik",
|
|
||||||
:cert-manager.io/cluster-issuer "staging"}},
|
|
||||||
:spec
|
|
||||||
{:tls [{:hosts ["test.com"], :secretName "gitea-ingress-cert"}],
|
|
||||||
:rules
|
|
||||||
[{:host "test.com",
|
|
||||||
:http
|
|
||||||
{:paths
|
|
||||||
[{:pathType "Prefix",
|
|
||||||
:path "/",
|
|
||||||
:backend
|
|
||||||
{:service {:name "gitea-service", :port {:number 3000}}}}]}}]}}
|
|
||||||
(cut/generate-ingress {:fqdn "test.com" :issuer "staging"}))))
|
|
||||||
|
|
Loading…
Reference in a new issue