add test for pg/generate-secret
This commit is contained in:
parent
c44f176700
commit
d444c5a9f0
2 changed files with 58 additions and 37 deletions
src/test/cljc/dda/c4k_common
|
@ -17,53 +17,52 @@
|
|||
:namespace "default"
|
||||
:labels {:app "postgres"}}
|
||||
(:metadata (cut/generate-configmap {:postgres-image "postgres:13"
|
||||
:postgres-size :2gb
|
||||
:db-name "postgres"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:pv-storage-size-gb 10
|
||||
:pvc-storage-class-name "manual"
|
||||
:namespace "default"}))))
|
||||
:postgres-size :2gb
|
||||
:db-name "postgres"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:pv-storage-size-gb 10
|
||||
:pvc-storage-class-name "manual"
|
||||
:namespace "default"}))))
|
||||
(is (= {:name "postgres-config",
|
||||
:namespace "myapp"
|
||||
:labels {:app "postgres"}}
|
||||
(:metadata (cut/generate-configmap {:postgres-image "postgres:13"
|
||||
:postgres-size :2gb
|
||||
:db-name "postgres"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:pv-storage-size-gb 10
|
||||
:pvc-storage-class-name "manual"
|
||||
:namespace "myapp"}))))
|
||||
:postgres-size :2gb
|
||||
:db-name "postgres"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:pv-storage-size-gb 10
|
||||
:pvc-storage-class-name "manual"
|
||||
:namespace "myapp"}))))
|
||||
(is (= {:postgres-db "postgres"
|
||||
:postgresql.conf
|
||||
"max_connections = 100\nwork_mem = 4MB\nshared_buffers = 512MB\n"}
|
||||
(:data (cut/generate-configmap {:postgres-image "postgres:13"
|
||||
:postgres-size :2gb
|
||||
:db-name "postgres"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:pv-storage-size-gb 10
|
||||
:pvc-storage-class-name "manual"
|
||||
:namespace "default"}))))
|
||||
:postgres-size :2gb
|
||||
:db-name "postgres"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:pv-storage-size-gb 10
|
||||
:pvc-storage-class-name "manual"
|
||||
:namespace "default"}))))
|
||||
(is (= {:postgres-db "postgres"
|
||||
:postgresql.conf
|
||||
"max_connections = 700\nwork_mem = 3MB\nshared_buffers = 2048MB\n"}
|
||||
(:data (cut/generate-configmap {:postgres-image "postgres:13"
|
||||
:postgres-size :8gb
|
||||
:db-name "postgres"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:pv-storage-size-gb 10
|
||||
:pvc-storage-class-name "manual"
|
||||
:namespace "default"}))))
|
||||
:postgres-size :8gb
|
||||
:db-name "postgres"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:pv-storage-size-gb 10
|
||||
:pvc-storage-class-name "manual"
|
||||
:namespace "default"}))))
|
||||
(is (= {:postgres-db "test"
|
||||
:postgresql.conf
|
||||
"max_connections = 100\nwork_mem = 4MB\nshared_buffers = 512MB\n"}
|
||||
(:data (cut/generate-configmap {:postgres-image "postgres:13"
|
||||
:postgres-size :2gb
|
||||
:db-name "test"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:pv-storage-size-gb 10
|
||||
:pvc-storage-class-name "manual"
|
||||
:namespace "default"}))))
|
||||
)
|
||||
:postgres-size :2gb
|
||||
:db-name "test"
|
||||
:postgres-data-volume-path "/var/postgres"
|
||||
:pv-storage-size-gb 10
|
||||
:pvc-storage-class-name "manual"
|
||||
: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"}))))
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue