oncall-engine/helm/oncall/tests/redis_password_env_test.yaml
Raz Amir 40890e26ba
Helm: Allow using existing secrets for redis and mysql (#2156)
# What this PR does
This PR adds the ability to use an existing secret for external Redis
and external MySQL and it follows the same changes that PR #761 did for
RabbitMQ (including the fix that was done for it later in #775)

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)

---------

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2023-06-13 05:42:22 +00:00

85 lines
2.4 KiB
YAML

suite: test Redis password envs for deployments
release:
name: oncall
templates:
- engine/deployment.yaml
- engine/job-migrate.yaml
- celery/deployment-celery.yaml
- secrets.yaml
tests:
- it: secrets -> should fail if externalRedis.password not set
set:
redis.enabled: false
asserts:
- failedTemplate:
errorMessage: externalRedis.password is required if not redis.enabled and not externalRedis.existingSecret
template: secrets.yaml
- it: externalRedis.password -> should create a Secret -redis-external
templates:
- engine/deployment.yaml
- engine/job-migrate.yaml
- celery/deployment-celery.yaml
set:
redis.enabled: false
externalRedis:
password: abcd123
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: oncall-redis-external
key: redis-password
- containsDocument:
kind: Secret
apiVersion: v1
name: oncall-redis-external
template: secrets.yaml
- equal:
path: data.redis-password
value: abcd123
decodeBase64: true
documentIndex: 1
template: secrets.yaml
- it: externalRedis.existingSecret -> should use existing secret
templates:
- engine/deployment.yaml
- engine/job-migrate.yaml
- celery/deployment-celery.yaml
set:
redis.enabled: false
externalRedis:
existingSecret: some-redis-secret
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: some-redis-secret
key: redis-password
- it: externalRedis.passwordKey -> should be used for existing secret
templates:
- engine/deployment.yaml
- engine/job-migrate.yaml
- celery/deployment-celery.yaml
set:
redis.enabled: false
externalRedis:
existingSecret: some-redis-secret
passwordKey: redis.key
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: some-redis-secret
key: redis.key