wrote tests upfront
This commit is contained in:
parent
2af76f8557
commit
b689d520ce
5 changed files with 20 additions and 16 deletions
|
@ -43,7 +43,7 @@
|
||||||
(postgres/generate-deployment {:postgres-image "postgres:14"
|
(postgres/generate-deployment {:postgres-image "postgres:14"
|
||||||
:postgres-size :2gb})
|
:postgres-size :2gb})
|
||||||
(postgres/generate-service)
|
(postgres/generate-service)
|
||||||
(forgejo/generate-deployment)
|
(forgejo/generate-deployment config)
|
||||||
(forgejo/generate-service)
|
(forgejo/generate-service)
|
||||||
(forgejo/generate-service-ssh)
|
(forgejo/generate-service-ssh)
|
||||||
(forgejo/generate-data-volume config)
|
(forgejo/generate-data-volume config)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
(pred/string-of-separated-by? pred/fqdn-string? #"," input)))
|
(pred/string-of-separated-by? pred/fqdn-string? #"," input)))
|
||||||
|
|
||||||
(s/def ::default-app-name string?)
|
(s/def ::default-app-name string?)
|
||||||
(s/def ::forgejo-image-name string?)
|
(s/def ::federated boolean?)
|
||||||
(s/def ::fqdn pred/fqdn-string?)
|
(s/def ::fqdn pred/fqdn-string?)
|
||||||
(s/def ::mailer-from pred/bash-env-string?)
|
(s/def ::mailer-from pred/bash-env-string?)
|
||||||
(s/def ::mailer-host pred/bash-env-string?)
|
(s/def ::mailer-host pred/bash-env-string?)
|
||||||
|
@ -39,11 +39,11 @@
|
||||||
::mailer-from
|
::mailer-from
|
||||||
::mailer-host
|
::mailer-host
|
||||||
::mailer-port
|
::mailer-port
|
||||||
::service-noreply-address
|
::service-noreply-address]
|
||||||
::deploy-federated]
|
|
||||||
:opt-un [::issuer
|
:opt-un [::issuer
|
||||||
::default-app-name
|
::default-app-name
|
||||||
::service-domain-whitelist]))
|
::service-domain-whitelist
|
||||||
|
::federated]))
|
||||||
|
|
||||||
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password ::mailer-user ::mailer-pw]))
|
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password ::mailer-user ::mailer-pw]))
|
||||||
|
|
||||||
|
@ -121,13 +121,7 @@
|
||||||
; ToDo: Need to add default image-name to config? Or hardcode?
|
; ToDo: Need to add default image-name to config? Or hardcode?
|
||||||
(defn-spec generate-deployment pred/map-or-seq?
|
(defn-spec generate-deployment pred/map-or-seq?
|
||||||
[config config?]
|
[config config?]
|
||||||
(let [{:keys [deploy-federated]} config
|
(yaml/load-as-edn "forgejo/deployment.yaml"))
|
||||||
deploy-federated-bool (boolean (Boolean/valueOf deploy-federated))]
|
|
||||||
(->
|
|
||||||
(yaml/load-as-edn "forgejo/deployment.yaml")
|
|
||||||
#(if deploy-federated-bool
|
|
||||||
(cm/replace-all-matching-values-by-new-value % "IMAGE_NAME" federated-image-name)
|
|
||||||
(cm/replace-all-matching-values-by-new-value %"IMAGE_NAME" default-name)))))
|
|
||||||
|
|
||||||
(defn generate-service
|
(defn generate-service
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -18,7 +18,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: forgejo
|
- name: forgejo
|
||||||
image: codeberg.org/meissa/forgejo:federated-latest #codeberg.org/forgejo/forgejo:1.19
|
image: codeberg.org/forgejo/forgejo:1.19
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
# config settings
|
# config settings
|
||||||
envFrom:
|
envFrom:
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
:FORGEJO__service__EMAIL_DOMAIN_WHITELIST-c1 "adb.de",
|
:FORGEJO__service__EMAIL_DOMAIN_WHITELIST-c1 "adb.de",
|
||||||
:FORGEJO__service__EMAIL_DOMAIN_WHITELIST-c2 "test.com,test.net",
|
:FORGEJO__service__EMAIL_DOMAIN_WHITELIST-c2 "test.com,test.net",
|
||||||
: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"
|
||||||
|
:FORGEJO__federation__ENABLED-c1 "true"
|
||||||
|
:FORGEJO__federation__ENABLED-c2 "false"}
|
||||||
(th/map-diff (cut/generate-appini-env {:default-app-name ""
|
(th/map-diff (cut/generate-appini-env {:default-app-name ""
|
||||||
:fqdn "test.de"
|
:fqdn "test.de"
|
||||||
:mailer-from ""
|
:mailer-from ""
|
||||||
|
@ -37,6 +39,7 @@
|
||||||
:mailer-port "123"
|
:mailer-port "123"
|
||||||
:service-domain-whitelist "adb.de"
|
:service-domain-whitelist "adb.de"
|
||||||
:service-noreply-address ""
|
:service-noreply-address ""
|
||||||
|
:federated true
|
||||||
})
|
})
|
||||||
(cut/generate-appini-env {:default-app-name "test forgejo"
|
(cut/generate-appini-env {:default-app-name "test forgejo"
|
||||||
:fqdn "test.com"
|
:fqdn "test.com"
|
||||||
|
@ -45,6 +48,7 @@
|
||||||
:mailer-port "456"
|
:mailer-port "456"
|
||||||
:service-domain-whitelist "test.com,test.net"
|
:service-domain-whitelist "test.com,test.net"
|
||||||
:service-noreply-address "noreply@test.com"
|
:service-noreply-address "noreply@test.com"
|
||||||
|
:federated false
|
||||||
})))))
|
})))))
|
||||||
|
|
||||||
(deftest should-generate-secret
|
(deftest should-generate-secret
|
||||||
|
@ -69,4 +73,10 @@
|
||||||
(is (= {:storage-c1 "1Gi",
|
(is (= {:storage-c1 "1Gi",
|
||||||
:storage-c2 "15Gi"}
|
:storage-c2 "15Gi"}
|
||||||
(th/map-diff (cut/generate-data-volume {:volume-total-storage-size 1})
|
(th/map-diff (cut/generate-data-volume {:volume-total-storage-size 1})
|
||||||
(cut/generate-data-volume {:volume-total-storage-size 15})))))
|
(cut/generate-data-volume {:volume-total-storage-size 15})))))
|
||||||
|
|
||||||
|
(deftest should-generate-deployment
|
||||||
|
(is (= {:image-c1 "codeberg.org/forgejo/forgejo:1.19",
|
||||||
|
:image-c2 "domaindrivenarchitecture/c4k-forgejo-fed"}
|
||||||
|
(th/map-diff (cut/generate-deployment {:federated false})
|
||||||
|
(cut/generate-deployment {:federated true})))))
|
|
@ -8,7 +8,7 @@ service-whitelist-domains: "test.de"
|
||||||
service-noreply-address: "noreply@test.de"
|
service-noreply-address: "noreply@test.de"
|
||||||
volume-total-storage-size: 6
|
volume-total-storage-size: 6
|
||||||
restic-repository: "repo-path"
|
restic-repository: "repo-path"
|
||||||
deploy-federated: "false"
|
federated: false
|
||||||
mon-cfg:
|
mon-cfg:
|
||||||
grafana-cloud-url: "url-for-your-prom-remote-write-endpoint"
|
grafana-cloud-url: "url-for-your-prom-remote-write-endpoint"
|
||||||
cluster-name: "forgejo"
|
cluster-name: "forgejo"
|
||||||
|
|
Loading…
Reference in a new issue