Added shynet webserver unit test
This commit is contained in:
parent
33e394f0a2
commit
194b87467c
3 changed files with 59 additions and 6 deletions
25
.gitignore
vendored
25
.gitignore
vendored
|
@ -1,3 +1,28 @@
|
||||||
.clj-kondo/
|
.clj-kondo/
|
||||||
.lsp/
|
.lsp/
|
||||||
|
|
||||||
|
# pybuilder
|
||||||
|
.pybuilder/
|
||||||
|
__pycache__/
|
||||||
|
|
||||||
|
# lein
|
||||||
target/
|
target/
|
||||||
|
.lein-repl-history
|
||||||
|
.lein-failures
|
||||||
|
pom.*
|
||||||
|
|
||||||
|
# cljs
|
||||||
|
.shadow-cljs
|
||||||
|
.nrepl-*
|
||||||
|
package-lock.json
|
||||||
|
node_modules/
|
||||||
|
public/js/
|
||||||
|
|
||||||
|
# ide
|
||||||
|
.calva
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
auth.edn
|
||||||
|
config.edn
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
(defmethod yaml/load-resource :matomo [resource-name]
|
(defmethod yaml/load-resource :matomo [resource-name]
|
||||||
(case resource-name
|
(case resource-name
|
||||||
"matomo/certificate.yaml" (rc/inline "matomo/certificate.yaml")
|
"matomo/certificate.yaml" (rc/inline "matomo/certificate.yaml")
|
||||||
"matomo/deployments.yaml" (rc/inline "matomo/deployments.yaml")
|
;"matomo/deployments.yaml" (rc/inline "matomo/deployments.yaml")
|
||||||
"matomo/ingress.yaml" (rc/inline "matomo/ingress.yaml")
|
;"matomo/ingress.yaml" (rc/inline "matomo/ingress.yaml")
|
||||||
"matomo/services.yaml" (rc/inline "matomo/services.yaml")
|
;"matomo/services.yaml" (rc/inline "matomo/services.yaml")
|
||||||
"matomo/statefulset.yaml" (rc/inline "matomo/statefulset.yaml")
|
;"matomo/statefulset.yaml" (rc/inline "matomo/statefulset.yaml")
|
||||||
(throw (js/Error. "Undefined Resource!")))))
|
(throw (js/Error. "Undefined Resource!")))))
|
||||||
|
|
||||||
(defn generate-certificate [config]
|
(defn generate-certificate [config]
|
||||||
|
@ -31,8 +31,8 @@
|
||||||
(defn generate-webserver-deployment []
|
(defn generate-webserver-deployment []
|
||||||
(let [shynet-application "shynet-webserver"]
|
(let [shynet-application "shynet-webserver"]
|
||||||
(-> (yaml/from-string (yaml/load-resource "matomo/deployments-template.yaml"))
|
(-> (yaml/from-string (yaml/load-resource "matomo/deployments-template.yaml"))
|
||||||
(cm/replace-named-value "shynet-application" shynet-application)
|
(cm/replace-all-matching-values-by-new-value "shynet-application" shynet-application)
|
||||||
(dissoc [:spec :template :spec :containers 0] :command))))
|
(update-in [:spec :template :spec :containers 0] dissoc :command))))
|
||||||
|
|
||||||
(defn generate-ingress [config]
|
(defn generate-ingress [config]
|
||||||
(let [{:keys [fqdn issuer]
|
(let [{:keys [fqdn issuer]
|
||||||
|
|
28
src/test/cljc/dda/c4k_matomo/matomo_test.cljc
Normal file
28
src/test/cljc/dda/c4k_matomo/matomo_test.cljc
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
(ns dda.c4k-matomo.matomo-test
|
||||||
|
(:require
|
||||||
|
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
||||||
|
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
||||||
|
[dda.c4k-matomo.matomo :as cut]))
|
||||||
|
|
||||||
|
|
||||||
|
(deftest should-generate-webserver-deployment
|
||||||
|
(is (= {:apiVersion "apps/v1"
|
||||||
|
:kind "Deployment"
|
||||||
|
:metadata
|
||||||
|
{:name "shynet-webserver"
|
||||||
|
:namespace "default"
|
||||||
|
:labels {:app "shynet-webserver"}}
|
||||||
|
:spec
|
||||||
|
{:selector {:matchLabels {:app "shynet-webserver"}}
|
||||||
|
:strategy {:type "Recreate"}
|
||||||
|
:replicas 1
|
||||||
|
:template
|
||||||
|
{:metadata {:labels {:app "shynet-webserver"}}
|
||||||
|
:spec
|
||||||
|
{:containers
|
||||||
|
[{:name "shynet-webserver"
|
||||||
|
:image "milesmcc/shynet:edge"
|
||||||
|
:imagePullPolicy "IfNotPresent"
|
||||||
|
:envFrom [{:secretRef {:name "shynet-settings"}}]}]}}}}
|
||||||
|
(cut/generate-webserver-deployment))))
|
||||||
|
|
Loading…
Reference in a new issue