Update tests
This commit is contained in:
parent
9d99de13eb
commit
572ddb9747
1 changed files with 62 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
[dda.c4k-common.base64 :as b64]
|
[dda.c4k-common.base64 :as b64]
|
||||||
[dda.c4k-forgejo.forgejo :as cut]))
|
[dda.c4k-forgejo.forgejo :as cut]))
|
||||||
|
|
||||||
|
(st/instrument `cut/generate-deployment)
|
||||||
(st/instrument `cut/generate-appini-env)
|
(st/instrument `cut/generate-appini-env)
|
||||||
(st/instrument `cut/generate-ingress)
|
(st/instrument `cut/generate-ingress)
|
||||||
(st/instrument `cut/generate-secrets)
|
(st/instrument `cut/generate-secrets)
|
||||||
|
@ -14,6 +15,8 @@
|
||||||
(deftest should-generate-appini-env
|
(deftest should-generate-appini-env
|
||||||
(is (= {:APP_NAME-c1 "",
|
(is (= {:APP_NAME-c1 "",
|
||||||
:APP_NAME-c2 "test forgejo",
|
:APP_NAME-c2 "test forgejo",
|
||||||
|
:FORGEJO__federation__ENABLED-c1 "false",
|
||||||
|
:FORGEJO__federation__ENABLED-c2 "true",
|
||||||
:FORGEJO__mailer__FROM-c1 "",
|
:FORGEJO__mailer__FROM-c1 "",
|
||||||
:FORGEJO__mailer__FROM-c2 "test@test.com",
|
:FORGEJO__mailer__FROM-c2 "test@test.com",
|
||||||
:FORGEJO__mailer__SMTP_ADDR-c1 "m.t.de",
|
:FORGEJO__mailer__SMTP_ADDR-c1 "m.t.de",
|
||||||
|
@ -31,6 +34,7 @@
|
||||||
:FORGEJO__service__NO_REPLY_ADDRESS-c1 "",
|
:FORGEJO__service__NO_REPLY_ADDRESS-c1 "",
|
||||||
:FORGEJO__service__NO_REPLY_ADDRESS-c2 "noreply@test.com"}
|
:FORGEJO__service__NO_REPLY_ADDRESS-c2 "noreply@test.com"}
|
||||||
(th/map-diff (cut/generate-appini-env {:default-app-name ""
|
(th/map-diff (cut/generate-appini-env {:default-app-name ""
|
||||||
|
:deploy-federated "false"
|
||||||
:fqdn "test.de"
|
:fqdn "test.de"
|
||||||
:mailer-from ""
|
:mailer-from ""
|
||||||
:mailer-host "m.t.de"
|
:mailer-host "m.t.de"
|
||||||
|
@ -39,6 +43,7 @@
|
||||||
:service-noreply-address ""
|
:service-noreply-address ""
|
||||||
})
|
})
|
||||||
(cut/generate-appini-env {:default-app-name "test forgejo"
|
(cut/generate-appini-env {:default-app-name "test forgejo"
|
||||||
|
:deploy-federated "true"
|
||||||
:fqdn "test.com"
|
:fqdn "test.com"
|
||||||
:mailer-from "test@test.com"
|
:mailer-from "test@test.com"
|
||||||
:mailer-host "mail.test.com"
|
:mailer-host "mail.test.com"
|
||||||
|
@ -47,6 +52,63 @@
|
||||||
:service-noreply-address "noreply@test.com"
|
:service-noreply-address "noreply@test.com"
|
||||||
})))))
|
})))))
|
||||||
|
|
||||||
|
(deftest should-generate-non-federated-deployment
|
||||||
|
(is (= {:apiVersion "apps/v1",
|
||||||
|
:kind "Deployment",
|
||||||
|
:metadata {:name "forgejo", :namespace "default", :labels {:app "forgejo"}},
|
||||||
|
:spec
|
||||||
|
{:replicas 1,
|
||||||
|
:selector {:matchLabels {:app "forgejo"}},
|
||||||
|
:template
|
||||||
|
{:metadata {:name "forgejo", :labels {:app "forgejo"}},
|
||||||
|
:spec
|
||||||
|
{:containers
|
||||||
|
[{:name "forgejo",
|
||||||
|
:image "codeberg.org/forgejo/forgejo:1.19",
|
||||||
|
:imagePullPolicy "IfNotPresent",
|
||||||
|
:envFrom [{:configMapRef {:name "forgejo-env"}} {:secretRef {:name "forgejo-secrets"}}],
|
||||||
|
:volumeMounts [{:name "forgejo-data-volume", :mountPath "/data"}],
|
||||||
|
:ports [{:containerPort 22, :name "git-ssh"} {:containerPort 3000, :name "forgejo"}]}],
|
||||||
|
:volumes [{:name "forgejo-data-volume", :persistentVolumeClaim {:claimName "forgejo-data-pvc"}}]}}}}
|
||||||
|
(cut/generate-deployment
|
||||||
|
{:default-app-name ""
|
||||||
|
:deploy-federated "false"
|
||||||
|
:fqdn "test.de"
|
||||||
|
:mailer-from ""
|
||||||
|
:mailer-host "m.t.de"
|
||||||
|
:mailer-port "123"
|
||||||
|
:service-domain-whitelist "adb.de"
|
||||||
|
:service-noreply-address ""}
|
||||||
|
))))
|
||||||
|
|
||||||
|
(deftest should-generate-federated-deployment
|
||||||
|
(is (= {:apiVersion "apps/v1",
|
||||||
|
:kind "Deployment",
|
||||||
|
:metadata {:name "forgejo", :namespace "default", :labels {:app "forgejo"}},
|
||||||
|
:spec
|
||||||
|
{:replicas 1,
|
||||||
|
:selector {:matchLabels {:app "forgejo"}},
|
||||||
|
:template
|
||||||
|
{:metadata {:name "forgejo", :labels {:app "forgejo"}},
|
||||||
|
:spec
|
||||||
|
{:containers
|
||||||
|
[{:name "forgejo",
|
||||||
|
:image "codeberg.org/meissa/forgejo:federated-latest",
|
||||||
|
:imagePullPolicy "IfNotPresent",
|
||||||
|
:envFrom [{:configMapRef {:name "forgejo-env"}} {:secretRef {:name "forgejo-secrets"}}],
|
||||||
|
:volumeMounts [{:name "forgejo-data-volume", :mountPath "/data"}],
|
||||||
|
:ports [{:containerPort 22, :name "git-ssh"} {:containerPort 3000, :name "forgejo"}]}],
|
||||||
|
:volumes [{:name "forgejo-data-volume", :persistentVolumeClaim {:claimName "forgejo-data-pvc"}}]}}}}
|
||||||
|
(cut/generate-deployment
|
||||||
|
{:default-app-name ""
|
||||||
|
:deploy-federated "true"
|
||||||
|
:fqdn "test.de"
|
||||||
|
:mailer-from ""
|
||||||
|
:mailer-host "m.t.de"
|
||||||
|
:mailer-port "123"
|
||||||
|
:service-domain-whitelist "adb.de"
|
||||||
|
:service-noreply-address ""}))))
|
||||||
|
|
||||||
(deftest should-generate-secret
|
(deftest should-generate-secret
|
||||||
(is (= {:FORGEJO__database__USER-c1 "",
|
(is (= {:FORGEJO__database__USER-c1 "",
|
||||||
:FORGEJO__database__USER-c2 (b64/encode "pg-user"),
|
:FORGEJO__database__USER-c2 (b64/encode "pg-user"),
|
||||||
|
|
Loading…
Reference in a new issue