From 054e6954af9ff90e159227f2bdb21adfa7c6bfab Mon Sep 17 00:00:00 2001 From: erik Date: Wed, 17 Jan 2024 11:43:32 +0100 Subject: [PATCH] Implement tests --- .../cljc/dda/c4k_forgejo/forgejo_test.cljc | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/test/cljc/dda/c4k_forgejo/forgejo_test.cljc b/src/test/cljc/dda/c4k_forgejo/forgejo_test.cljc index 71805a3..7e5b3b2 100644 --- a/src/test/cljc/dda/c4k_forgejo/forgejo_test.cljc +++ b/src/test/cljc/dda/c4k_forgejo/forgejo_test.cljc @@ -130,3 +130,32 @@ :storage-c2 "15Gi"} (th/map-diff (cut/generate-data-volume {:volume-total-storage-size 1}) (cut/generate-data-volume {:volume-total-storage-size 15}))))) + +(deftest should-generate-middleware-ratelimit + (is (= {:apiVersion "traefik.io/v1alpha1", + :kind "Middleware", + :metadata {:name "ratelimit"}, + :spec {:rateLimit {:average 10, :burst 5}}} + (cut/generate-rate-limit-middleware {:fqdn "test.de" + :mailer-from "" + :mailer-host "m.t.de" + :mailer-port "123" + :service-noreply-address "" + :average 10 + :burst 5})))) + +(deftest should-generate-middleware-ratelimit-ingress-and-cert + (is (= {:traefik.ingress.kubernetes.io/router.entrypoints "web, websecure", + :traefik.ingress.kubernetes.io/router.middlewares + "default-redirect-https@kubernetescrd, default-ratelimit@kubernetescrd", + :metallb.universe.tf/address-pool "public"} + (-> (second + (cut/generate-rate-limit-ingress-and-cert + {:fqdn "test.de" + :mailer-from "" + :mailer-host "m.t.de" + :mailer-port "123" + :service-noreply-address "" + :average 10 + :burst 5})) + :metadata :annotations))))