From 7453c4edd9c1586b12eec2e53c18f28aedabbe2f Mon Sep 17 00:00:00 2001 From: ansgarz Date: Fri, 18 Mar 2022 12:33:07 +0100 Subject: [PATCH] mop add test --- src/main/clj/dda/c4k_nextcloud/uberjar.clj | 9 +++++---- src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc | 2 ++ src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc | 9 +++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/clj/dda/c4k_nextcloud/uberjar.clj b/src/main/clj/dda/c4k_nextcloud/uberjar.clj index 4c5a766..16e6a3b 100644 --- a/src/main/clj/dda/c4k_nextcloud/uberjar.clj +++ b/src/main/clj/dda/c4k_nextcloud/uberjar.clj @@ -5,7 +5,8 @@ [clojure.string :as cs] [clojure.tools.reader.edn :as edn] [expound.alpha :as expound] - [dda.c4k-nextcloud.core :as core])) + [dda.c4k-nextcloud.core :as core] + [dda.c4k-nextcloud.nextcloud :as nextcloud])) (def usage "usage: @@ -22,7 +23,7 @@ (defn expound-config [config] - (expound/expound ::core/config config)) + (expound/expound ::nextcloud/config config)) (defn invalid-args-msg [spec args] @@ -43,14 +44,14 @@ auth-str (slurp auth) config-edn (edn/read-string config-str) auth-edn (edn/read-string auth-str) - config-valid? (s/valid? core/config? config-edn) + config-valid? (s/valid? nextcloud/config? config-edn) auth-valid? (s/valid? core/auth? auth-edn)] (if (and config-valid? auth-valid?) (println (core/generate config-edn auth-edn)) (do (when (not config-valid?) (println - (expound/expound-str core/config? config-edn {:print-specs? false}))) + (expound/expound-str nextcloud/config? config-edn {:print-specs? false}))) (when (not auth-valid?) (println (expound/expound-str core/auth? auth-edn {:print-specs? false}))))))))))) diff --git a/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc b/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc index 274ede8..e99967b 100644 --- a/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc @@ -2,6 +2,8 @@ (:require [clojure.spec.alpha :as s] #?(:cljs [shadow.resource :as rc]) + #?(:clj [orchestra.core :refer [defn-spec]] + :cljs [orchestra.core :refer-macros [defn-spec]]) [dda.c4k-common.yaml :as yaml] [dda.c4k-common.base64 :as b64] [dda.c4k-common.predicate :as cp] diff --git a/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc b/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc index c549c21..e313178 100644 --- a/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc +++ b/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc @@ -66,6 +66,15 @@ :hostPath {:path "xx"}}} (cut/generate-persistent-volume {:nextcloud-data-volume-path "xx"})))) +(deftest should-generate-persistent-volume-claim + (is (= {([:apiVersion "v1"] + [:kind "PersistentVolumeClaim"] + [:metadata #ordered/map + ([:name "cloud-pvc"] + [:labels #ordered/map + ([:app.kubernetes.io/application "cloud"])])] [:spec #ordered/map ([:storageClassName "manual"] [:accessModes ["ReadWriteOnce"]] [:resources #ordered/map ([:requests #ordered/map ([:storage "50Gi"])])] [:selector #ordered/map ([:matchLabels #ordered/map ([:app.kubernetes.io/application "cloud"])])])])} + (cut/generate-pvc {:nextcloud-data-volume-path "xx"})))) + (deftest should-generate-deployment (is (= {:apiVersion "apps/v1" :kind "Deployment"