From da85bc114e8f0afb33b56f0f892e177eb5017465 Mon Sep 17 00:00:00 2001 From: Mirco Date: Fri, 15 Nov 2024 12:09:22 +0100 Subject: [PATCH] tests for modelector environment --- src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc | 75 +++++++++++++++++++-- 1 file changed, 69 insertions(+), 6 deletions(-) diff --git a/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc b/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc index b3d5950..1e00cd0 100644 --- a/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc +++ b/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc @@ -150,6 +150,44 @@ {:fqdn "xy.xy.xy" :namespace "jitsi"})))) +(deftest should-generate-ingress-modelector + (is (= [{:apiVersion "cert-manager.io/v1", + :kind "Certificate", + :metadata + {:name "modelector", + :labels {:app.kubernetes.part-of "modelector"}, + :namespace "jitsi"}, + :spec + {:secretName "modelector", + :commonName "modelector.xy.xy", + :duration "2160h", + :renewBefore "720h", + :dnsNames ["modelector.xy.xy"], + :issuerRef {:name "staging", :kind "ClusterIssuer"}}} + {:apiVersion "networking.k8s.io/v1", + :kind "Ingress", + :metadata + {:namespace "jitsi", + :annotations + {:traefik.ingress.kubernetes.io/router.entrypoints "web, websecure", + :traefik.ingress.kubernetes.io/router.middlewares + "default-redirect-https@kubernetescrd", + :metallb.universe.tf/address-pool "public"}, + :name "modelector", + :labels {:app.kubernetes.part-of "modelector"}}, + :spec + {:tls [{:hosts ["modelector.xy.xy"], :secretName "modelector"}], + :rules + [{:host "modelector.xy.xy", + :http + {:paths + [{:pathType "Prefix", + :path "/", + :backend {:service {:name "modelector", :port {:number 80}}}}]}}]}}] + (cut/generate-ingress-modelector + {:fqdn "xy.xy" + :namespace "jitsi"})))) + (deftest should-generate-jvb-service (is (= {:apiVersion "v1", :kind "Service", @@ -208,20 +246,45 @@ {:fqdn "xy.xy.xy" :namespace "jitsi"})))) -(deftest should-generate-meapp-fullstack-service +(deftest should-generate-modelector-service (is (= {:apiVersion "v1", :kind "Service", :metadata - {:labels {:service "excalidraw-backend"}, - :name "excalidraw-backend", + {:labels {:service "modelector"}, + :name "modelector", :namespace "jitsi"}, :spec - {:ports [{:name "excalidraw-backend", :port 3002, :targetPort 80}], - :selector {:app "excalidraw-backend"}}} - (cut/generate-excalidraw-backend-service + {:ports [{:name "http", :port 80, :targetPort 8080}], + :selector {:app "modelector"}}} + (cut/generate-modelector-service {:fqdn "xy.xy.xy" :namespace "jitsi"})))) +(deftest should-generate-modelector-deployment + (is (= {:apiVersion "apps/v1", + :kind "Deployment", + :metadata + {:labels {:app "modelector"}, + :name "modelector", + :namespace "jitsi"}, + :spec + {:selector {:matchLabels {:app "modelector"}}, + :replicas 1, + :strategy {:type "Recreate"}, + :template + {:metadata {:labels {:app "modelector"}}, + :spec + {:containers + [{:name "modelector", + :image "domaindrivenarchitecture/moderator-election-vaadin_fullstack", + :imagePullPolicy "IfNotPresent", + :env + [{:name "MEMBERNAMES", + :value "Micha,Ansgar,Erik,Mirco"}]}]}}}} + (cut/generate-modelector-deployment + {:fqdn "xy.xy.xy" + :namespace "jitsi"})))) + (deftest should-generate-excalidraw-deployment (is (= {:apiVersion "v1", :kind "Service",