From c1f2cefd145261512ed58a4e581239895c71cd9c Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Tue, 20 Feb 2024 18:21:03 +0100 Subject: [PATCH] keep compatibility --- src/main/cljc/dda/c4k_common/postgres.cljc | 11 ++++++++--- src/test/cljc/dda/c4k_common/postgres_test.cljc | 8 ++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/cljc/dda/c4k_common/postgres.cljc b/src/main/cljc/dda/c4k_common/postgres.cljc index 4e59061..98364d5 100644 --- a/src/main/cljc/dda/c4k_common/postgres.cljc +++ b/src/main/cljc/dda/c4k_common/postgres.cljc @@ -64,9 +64,14 @@ (defn-spec generate-secret map? - [config pg-config? - auth pg-auth?] - (int/generate-secret config auth)) + ([auth pg-auth?] + (let [final-config default-config] + (int/generate-secret final-config auth))) + ([config pg-config? + auth pg-auth?] + (let [final-config (merge default-config + config)] + (int/generate-secret final-config auth)))) (defn-spec generate-service map? diff --git a/src/test/cljc/dda/c4k_common/postgres_test.cljc b/src/test/cljc/dda/c4k_common/postgres_test.cljc index bd26fa0..90be20b 100644 --- a/src/test/cljc/dda/c4k_common/postgres_test.cljc +++ b/src/test/cljc/dda/c4k_common/postgres_test.cljc @@ -39,6 +39,14 @@ :resources {:requests {:storage "10Gi"}}}} (cut/generate-pvc {})))) +(deftest should-generate-secret + (is (= {:apiVersion "v1", + :kind "Secret", + :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"})))) + (deftest should-generate (is (= 6