
### Description of the change This adds unittests for the default configuration of our dependencies. ### Benefits We are able to detect changes in upstream Charts for those settings. ### Applicable issues - fixes #409 ### Additional information I merged existing unittests with the new ones for `postgresql-ha` and `postgresql`. However, I decided to not do this for `redis-cluster` and `redis`, because the existing tests[^1] also ensure how the Chart behaves when both redis dependencies are disabled. It didn't felt right to split those files. ### Checklist - [x] Templating unittests are added Signed-off-by: justusbunsi <sk.bunsenbrenner@gmail.com> [^1]:e733287dc2/unittests/config/cache-config.yaml
,e733287dc2/unittests/config/queue-config.yaml
,e733287dc2/unittests/config/session-config.yaml
Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/748 Co-authored-by: justusbunsi <sk.bunsenbrenner@gmail.com> Co-committed-by: justusbunsi <sk.bunsenbrenner@gmail.com>
91 lines
2.8 KiB
YAML
91 lines
2.8 KiB
YAML
suite: Dependency checks | Customization integrity | redis-cluster
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
set:
|
|
redis:
|
|
enabled: false
|
|
redis-cluster:
|
|
enabled: true
|
|
usePassword: false
|
|
cluster:
|
|
nodes: 5
|
|
replicas: 2
|
|
tests:
|
|
- it: "[redis-cluster] configures correct nodes/replicas"
|
|
template: charts/redis-cluster/templates/redis-statefulset.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
equal:
|
|
path: spec.replicas
|
|
value: 5
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: spec.template.spec.containers[0].args[0]
|
|
pattern: REDIS_CLUSTER_REPLICAS="2"
|
|
- it: "[redis-cluster] support auth-less connections"
|
|
asserts:
|
|
- template: charts/redis-cluster/templates/secret.yaml
|
|
hasDocuments:
|
|
count: 0
|
|
- template: charts/redis-cluster/templates/redis-statefulset.yaml
|
|
documentIndex: 0
|
|
contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: ALLOW_EMPTY_PASSWORD
|
|
value: "yes"
|
|
- it: "[redis-cluster] support auth-full connections"
|
|
set:
|
|
redis-cluster:
|
|
usePassword: true
|
|
asserts:
|
|
- template: charts/redis-cluster/templates/secret.yaml
|
|
containsDocument:
|
|
kind: Secret
|
|
apiVersion: v1
|
|
name: gitea-unittests-redis-cluster
|
|
namespace: testing
|
|
- template: charts/redis-cluster/templates/redis-statefulset.yaml
|
|
documentIndex: 0
|
|
contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: REDISCLI_AUTH
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: gitea-unittests-redis-cluster
|
|
key: redis-password
|
|
- template: charts/redis-cluster/templates/redis-statefulset.yaml
|
|
documentIndex: 0
|
|
contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: REDIS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: gitea-unittests-redis-cluster
|
|
key: redis-password
|
|
- it: "[redis-cluster] renders the referenced service"
|
|
template: charts/redis-cluster/templates/headless-svc.yaml
|
|
asserts:
|
|
- containsDocument:
|
|
kind: Service
|
|
apiVersion: v1
|
|
name: gitea-unittests-redis-cluster-headless
|
|
namespace: testing
|
|
- documentIndex: 0
|
|
contains:
|
|
path: spec.ports
|
|
content:
|
|
name: tcp-redis
|
|
port: 6379
|
|
targetPort: tcp-redis
|
|
- it: "[gitea] waits for redis-cluster to be up and running"
|
|
template: templates/gitea/init.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData["configure_gitea.sh"]
|
|
pattern: nc -vz -w2 gitea-unittests-redis-cluster-headless.testing.svc.cluster.local 6379
|