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"}
|
||||
:dependencies [[org.clojure/clojure "1.10.3"]
|
||||
[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"]]
|
||||
:target-path "target/%s/"
|
||||
:source-paths ["src/main/cljc"
|
||||
|
|
|
@ -2,42 +2,21 @@
|
|||
(:require
|
||||
#?(:clj [clojure.test :refer [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]))
|
||||
|
||||
|
||||
(deftest should-generate-appini-env
|
||||
(is (= {:apiVersion "v1",
|
||||
:kind "ConfigMap",
|
||||
:metadata {:name "gitea-env", :namespace "default"},
|
||||
:data
|
||||
{:GITEA__database__DB_TYPE "postgres",
|
||||
:GITEA__database__HOST
|
||||
"postgresql-service.default.svc.cluster.local:5432",
|
||||
:GITEA__database__NAME "gitea",
|
||||
:GITEA__database__USER "pg-user",
|
||||
:GITEA__database__PASSWD "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"}))))
|
||||
|
||||
(is (= {:GITEA__database__USER-c1 nil,
|
||||
:GITEA__database__USER-c2 "pg-user",
|
||||
:GITEA__database__PASSWD-c1 nil,
|
||||
:GITEA__database__PASSWD-c2 "pg-pw",
|
||||
:GITEA__server__DOMAIN-c1 nil,
|
||||
:GITEA__server__DOMAIN-c2 "test.com",
|
||||
:GITEA__server__ROOT_URL-c1 "https://",
|
||||
:GITEA__server__ROOT_URL-c2 "https://test.com"}
|
||||
(ct/map-diff (cut/generate-appini-env {})
|
||||
(cut/generate-appini-env {:fqdn "test.com" :issuer "staging" :postgres-db-user "pg-user" :postgres-db-password "pg-pw"})))))
|
||||
|
||||
(deftest should-generate-ingress
|
||||
(is (= {:apiVersion "networking.k8s.io/v1",
|
||||
:kind "Ingress",
|
||||
: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"}))))
|
||||
(is (= {:hosts-c1 nil, :hosts-c2 "test.com", :host-c1 nil, :host-c2 "test.com"}
|
||||
(ct/map-diff (cut/generate-ingress {}) (cut/generate-ingress {:fqdn "test.com" :issuer "staging"})))))
|
||||
|
|
Loading…
Reference in a new issue