fixed tests

This commit is contained in:
jerger 2022-05-27 18:29:54 +02:00
parent 307da76cd8
commit 63e1eaffa8
2 changed files with 127 additions and 94 deletions

View file

@ -20,14 +20,6 @@
"jitsi/jvb-service.yaml" (rc/inline "jitsi/jvb-service.yaml") "jitsi/jvb-service.yaml" (rc/inline "jitsi/jvb-service.yaml")
"jitsi/secret.yaml" (rc/inline "jitsi/secret.yaml") "jitsi/secret.yaml" (rc/inline "jitsi/secret.yaml")
"jitsi/web-service.yaml" (rc/inline "jitsi/web-service.yaml") "jitsi/web-service.yaml" (rc/inline "jitsi/web-service.yaml")
;; TODO - dat gibt es nicht, oder?
"jitsi/pod-security-policy.yaml" (rc/inline "jitsi/pod-security-policy.yaml")
;; TODO - dat gibt es nicht, oder?
"jitsi/role-binding.yaml" (rc/inline "jitsi/role-binding.yaml")
;; TODO - dat gibt es nicht, oder?
"jitsi/role.yaml" (rc/inline "jitsi/role.yaml")
;; TODO - dat gibt es nicht, oder?
"jitsi/service-account.yaml" (rc/inline "jitsi/service-account.yaml")
(throw (js/Error. "Undefined Resource!"))))) (throw (js/Error. "Undefined Resource!")))))
(defn generate-ingress [config] (defn generate-ingress [config]

View file

@ -6,102 +6,143 @@
(deftest should-generate-deployment (deftest should-generate-deployment
(is (= {:apiVersion "apps/v1" (is (= {:apiVersion "apps/v1",
:kind "Deployment" :kind "Deployment",
:metadata :metadata {:labels {:app "jitsi"}, :name "jitsi"},
{:name "jitsi-webserver"
:namespace "default"
:labels {:app "jitsi-webserver"}}
:spec :spec
{:selector {:matchLabels {:app "jitsi-webserver"}} {:strategy {:type "Recreate"},
:strategy {:type "Recreate"} :selector {:matchLabels {:app "jitsi"}},
:replicas 1
:template :template
{:metadata {:labels {:app "jitsi-webserver"}} {:metadata {:labels {:app "jitsi"}},
:spec :spec
{:containers {:containers
[{:name "jitsi-webserver" [{:name "jicofo",
:image "milesmcc/jitsi:v0.12.0" :image "jitsi/jicofo:stable-7287",
:imagePullPolicy "IfNotPresent" :imagePullPolicy "IfNotPresent",
:envFrom [{:secretRef {:name "jitsi-settings"}}]}]}}}} :env
(cut/generate-deployment)))) [{:name "XMPP_SERVER", :value "localhost"}
{:name "XMPP_DOMAIN", :value "meet.meissa-gmbh"}
(deftest should-generate-celeryworker-deployment {:name "XMPP_AUTH_DOMAIN", :value "auth.meet.meissa-gmbh"}
(is (= {:apiVersion "apps/v1" {:name "XMPP_MUC_DOMAIN", :value "muc.meet.meissa-gmbh"}
:kind "Deployment" {:name "XMPP_INTERNAL_MUC_DOMAIN",
:metadata :value "internal-muc.meet.meissa-gmbh"}
{:name "jitsi-celeryworker" {:name "JICOFO_COMPONENT_SECRET",
:namespace "default" :valueFrom
:labels {:app "jitsi-celeryworker"}} {:secretKeyRef
:spec {:name "jitsi-config", :key "JICOFO_COMPONENT_SECRET"}}}
{:selector {:matchLabels {:app "jitsi-celeryworker"}} {:name "JICOFO_AUTH_USER", :value "focus"}
:strategy {:type "Recreate"} {:name "JICOFO_AUTH_PASSWORD",
:replicas 1 :valueFrom
:template {:secretKeyRef
{:metadata {:labels {:app "jitsi-celeryworker"}} {:name "jitsi-config", :key "JICOFO_AUTH_PASSWORD"}}}
:spec {:name "TZ", :value "Europe/Berlin"}
{:containers {:name "JVB_BREWERY_MUC", :value "jvbbrewery"}]}
[{:name "jitsi-celeryworker" {:name "prosody",
:image "milesmcc/jitsi:v0.12.0" :image "jitsi/prosody:stable-7287",
:imagePullPolicy "IfNotPresent" :imagePullPolicy "IfNotPresent",
:command ["./celeryworker.sh"] :env
:envFrom [{:secretRef {:name "jitsi-settings"}}]}]}}}} [{:name "PUBLIC_URL", :value "xy"}
(cut/generate-celeryworker-deployment)))) {:name "XMPP_DOMAIN", :value "meet.meissa-gmbh"}
{:name "XMPP_AUTH_DOMAIN", :value "auth.meet.meissa-gmbh"}
(deftest should-generate-certificate {:name "XMPP_MUC_DOMAIN", :value "muc.meet.meissa-gmbh"}
(is (= {:apiVersion "cert-manager.io/v1" {:name "XMPP_INTERNAL_MUC_DOMAIN",
:kind "Certificate" :value "internal-muc.meet.meissa-gmbh"}
:metadata {:name "jitsi-cert", :namespace "default"} {:name "JICOFO_COMPONENT_SECRET",
:spec :valueFrom
{:secretName "jitsi-secret" {:secretKeyRef
:commonName "test.com" {:name "jitsi-config", :key "JICOFO_COMPONENT_SECRET"}}}
:dnsNames ["test.com"] {:name "JVB_AUTH_USER", :value "jvb"}
:issuerRef {:name "letsencrypt-staging-issuer", :kind "ClusterIssuer"}}} {:name "JVB_AUTH_PASSWORD",
(cut/generate-certificate {:fqdn "test.com" :issuer :staging})))) :valueFrom
{:secretKeyRef
{:name "jitsi-config", :key "JVB_AUTH_PASSWORD"}}}
{:name "JICOFO_AUTH_USER", :value "focus"}
{:name "JICOFO_AUTH_PASSWORD",
:valueFrom
{:secretKeyRef
{:name "jitsi-config", :key "JICOFO_AUTH_PASSWORD"}}}
{:name "TZ", :value "Europe/Berlin"}
{:name "JVB_TCP_HARVESTER_DISABLED", :value "true"}]}
{:name "web",
:image "domaindrivenarchitecture/c4k-jitsi",
:imagePullPolicy "IfNotPresent",
:env
[{:name "PUBLIC_URL", :value "xy"}
{:name "XMPP_SERVER", :value "localhost"}
{:name "JICOFO_AUTH_USER", :value "focus"}
{:name "XMPP_DOMAIN", :value "meet.meissa-gmbh"}
{:name "XMPP_AUTH_DOMAIN", :value "auth.meet.meissa-gmbh"}
{:name "XMPP_INTERNAL_MUC_DOMAIN",
:value "internal-muc.meet.meissa-gmbh"}
{:name "XMPP_BOSH_URL_BASE", :value "http://127.0.0.1:5280"}
{:name "XMPP_MUC_DOMAIN", :value "muc.meet.meissa-gmbh"}
{:name "TZ", :value "Europe/Berlin"}
{:name "JVB_TCP_HARVESTER_DISABLED", :value "true"}
{:name "DEFAULT_LANGUAGE", :value "de"}
{:name "RESOLUTION", :value "480"}
{:name "RESOLUTION_MIN", :value "240"}
{:name "RESOLUTION_WIDTH", :value "853"}
{:name "RESOLUTION_WIDTH_MIN", :value "427"}
{:name "DISABLE_AUDIO_LEVELS", :value "true"}]}
{:name "jvb",
:image "jitsi/jvb:stable-7287",
:imagePullPolicy "IfNotPresent",
:env
[{:name "PUBLIC_URL", :value "xy"}
{:name "XMPP_SERVER", :value "localhost"}
{:name "DOCKER_HOST_ADDRESS", :value "xy"}
{:name "XMPP_DOMAIN", :value "meet.meissa-gmbh"}
{:name "XMPP_AUTH_DOMAIN", :value "auth.meet.meissa-gmbh"}
{:name "XMPP_INTERNAL_MUC_DOMAIN",
:value "internal-muc.meet.meissa-gmbh"}
{:name "JVB_STUN_SERVERS",
:value
"stun.1und1.de:3478,stun.t-online.de:3478,stun.hosteurope.de:3478"}
{:name "JICOFO_AUTH_USER", :value "focus"}
{:name "JVB_TCP_HARVESTER_DISABLED", :value "true"}
{:name "JVB_AUTH_USER", :value "jvb"}
{:name "JVB_PORT", :value "30300"}
{:name "JVB_AUTH_PASSWORD",
:valueFrom
{:secretKeyRef
{:name "jitsi-config", :key "JVB_AUTH_PASSWORD"}}}
{:name "JICOFO_AUTH_PASSWORD",
:valueFrom
{:secretKeyRef
{:name "jitsi-config", :key "JICOFO_AUTH_PASSWORD"}}}
{:name "JVB_BREWERY_MUC", :value "jvbbrewery"}
{:name "TZ", :value "Europe/Berlin"}]}]}}}}
(cut/generate-deployment {:fqdn "xy"}))))
(deftest should-generate-ingress (deftest should-generate-ingress
(is (= {:apiVersion "networking.k8s.io/v1" (is (= {:apiVersion "networking.k8s.io/v1",
:kind "Ingress" :kind "Ingress",
:metadata :metadata
{:name "jitsi-webserver-ingress" {:name "jitsi",
:annotations :annotations
{:cert-manager.io/cluster-issuer "staging" {:cert-manager.io/cluster-issuer "staging",
:nginx.ingress.kubernetes.io/proxy-body-size "256m" :ingress.kubernetes.io/ssl-redirect "true",
:nginx.ingress.kubernetes.io/ssl-redirect "true" :kubernetes.io/ingress.class ""}},
:nginx.ingress.kubernetes.io/rewrite-target "/"
:nginx.ingress.kubernetes.io/proxy-connect-timeout "300"
:nginx.ingress.kubernetes.io/proxy-send-timeout "300"
:nginx.ingress.kubernetes.io/proxy-read-timeout "300"}}
:spec :spec
{:tls [{:hosts ["test.com"], :secretName "jitsi-secret"}] {:tls [{:hosts ["test.com"], :secretName "tls-jitsi"}],
:rules :rules
[{:host "test.com" [{:host "test.com",
:http {:paths [{:backend {:service :http
{:name "jitsi-webserver-service" :port {:number 8080}}}, :path "/", :pathType "Prefix"}]}}]}} {:paths
[{:path "/",
:pathType "Prefix",
:backend {:service {:name "web", :port {:number 80}}}}]}}]}}
(cut/generate-ingress {:fqdn "test.com" :issuer :staging})))) (cut/generate-ingress {:fqdn "test.com" :issuer :staging}))))
(deftest should-generate-secret (deftest should-generate-secret
(is (= {:apiVersion "v1" (is (= {:apiVersion "v1",
:kind "Secret" :kind "Secret",
:metadata {:name "jitsi-settings"} :metadata {:name "jitsi-config"},
:type "Opaque" :type "Opaque",
:stringData :data
{:DEBUG "False" {:JVB_AUTH_PASSWORD "anZiLWF1dGg=",
:ALLOWED_HOSTS "*" :JICOFO_AUTH_PASSWORD "amljb2ZvLWF1dGg=",
:DJANGO_SECRET_KEY "django-pw" :JICOFO_COMPONENT_SECRET "amljb2ZvLWNvbXA="}}
:ACCOUNT_SIGNUPS_ENABLED "False" (cut/generate-secret {:jvb-auth-password "jvb-auth"
:TIME_ZONE "America/New_York" :jicofo-auth-password "jicofo-auth"
:REDIS_CACHE_LOCATION :jicofo-component-secret "jicofo-comp"}))))
"redis://jitsi-redis.default.svc.cluster.local/0"
:CELERY_BROKER_URL
"redis://jitsi-redis.default.svc.cluster.local/1"
:DB_NAME "jitsi"
:DB_USER "postgres-user"
:DB_PASSWORD "postgres-pw"
:DB_HOST "postgresql-service"
:EMAIL_HOST_USER ""
:EMAIL_HOST_PASSWORD ""
:EMAIL_HOST ""
:SERVER_EMAIL "jitsi <noreply@jitsi.example.com>"}}
(cut/generate-secret {:fqdn "test.com" :django-secret-key "django-pw"
:postgres-db-user "postgres-user" :postgres-db-password "postgres-pw"}))))