mop add test
This commit is contained in:
parent
1c179daf2c
commit
7453c4edd9
3 changed files with 16 additions and 4 deletions
|
@ -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})))))))))))
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue