add test for pg/generate-secret

This commit is contained in:
Michael Jerger 2025-01-14 17:14:24 +01:00
parent c44f176700
commit d444c5a9f0
2 changed files with 58 additions and 37 deletions
src/test/cljc/dda/c4k_common

View file

@ -62,8 +62,7 @@
:postgres-data-volume-path "/var/postgres"
:pv-storage-size-gb 10
:pvc-storage-class-name "manual"
:namespace "default"}))))
)
:namespace "default"})))))
(deftest should-generate-deployment
(is (= [{:image "postgres:14"
@ -165,6 +164,20 @@
:pv-storage-size-gb 20
:pvc-storage-class-name "local-path"
:namespace "default"}
{:postgres-db-user "xx-us" :postgres-db-password "xx-pw"})))
(is (= {:apiVersion "v1"
:kind "Secret"
:metadata {:name "postgres-secret" :namespace "app"}
:type "Opaque"
:data
{:postgres-user "eHgtdXM=", :postgres-password "eHgtcHc="}}
(cut/generate-secret {:postgres-image "postgres:13"
:postgres-size :2gb
:db-name "postgres"
:postgres-data-volume-path "/var/postgres"
:pv-storage-size-gb 20
:pvc-storage-class-name "local-path"
:namespace "app"}
{:postgres-db-user "xx-us" :postgres-db-password "xx-pw"}))))

View file

@ -49,7 +49,15 @@
:metadata {:name "postgres-secret", :namespace "default"},
:type "Opaque",
:data {:postgres-user "eHgtdXM=", :postgres-password "eHgtcHc="}}
(cut/generate-secret {:postgres-db-user "xx-us" :postgres-db-password "xx-pw"}))))
(cut/generate-secret {:postgres-db-user "xx-us" :postgres-db-password "xx-pw"})))
(is (= {:apiVersion "v1",
:kind "Secret",
:metadata {:name "postgres-secret", :namespace "app"},
:type "Opaque",
:data {:postgres-user "eHgtdXM=", :postgres-password "eHgtcHc="}}
(cut/generate-secret {:namespace "app"}
{:postgres-db-user "xx-us"
:postgres-db-password "xx-pw"}))))
(deftest should-generate