e95adcc757
## Summary Follow-up to #18157. Cherry-picks the useful parts from #18481 (by @dnplkndll), adapted to align with the current state of `main`: - **Helm unit tests** for Redis external authentication (secret-based + plaintext password, both server and worker) - **Helm unit tests** for `extraEnv` injection (plain values and `valueFrom` on both server and worker) - **JSON schema validation** for `server.extraEnv` and `worker.extraEnv` in `values.schema.json` - **Fix** `server_url_test.yaml` to use JSONPath filters (`@.name=="SERVER_URL"`) instead of brittle `env[0]` index selectors - **Fix** worker `storageEnv` whitespace (missing `-` in `{{- $storageEnv | nindent 12 }}`) Stale tests from #18481 (for `disableDbMigrations`, `server.env` pass-through, and `run-migrations` init container) were dropped since those features were removed during the #18157 cleanup. ## Test plan - [ ] `helm lint` passes - [ ] `helm template` renders cleanly - [ ] Unit tests pass with `helm unittest` (requires the plugin) Made with [Cursor](https://cursor.com)
73 lines
1.9 KiB
YAML
73 lines
1.9 KiB
YAML
suite: server url
|
|
templates:
|
|
- templates/deployment-server.yaml
|
|
release:
|
|
name: my-twenty
|
|
namespace: default
|
|
tests:
|
|
- it: derives from ingress with paths
|
|
set:
|
|
server.ingress.enabled: true
|
|
server.ingress.hosts:
|
|
- host: crm.example.com
|
|
paths:
|
|
- path: /
|
|
pathType: Prefix
|
|
server.ingress.tls:
|
|
- secretName: example-tls
|
|
hosts:
|
|
- crm.example.com
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].env[?(@.name=="SERVER_URL")].value
|
|
value: "https://crm.example.com:443"
|
|
- it: falls back to service when ingress disabled
|
|
set:
|
|
server.ingress.enabled: false
|
|
server.service.port: 3000
|
|
server.env.SERVER_URL: ""
|
|
asserts:
|
|
- matchRegex:
|
|
path: spec.template.spec.containers[0].env[?(@.name=="SERVER_URL")].value
|
|
pattern: ^http://my-twenty-twenty-server\.default\.svc\.cluster\.local:3000$
|
|
---
|
|
suite: ingress configuration
|
|
templates:
|
|
- templates/ingress.yaml
|
|
release:
|
|
name: my-twenty
|
|
namespace: default
|
|
tests:
|
|
- it: renders with host and paths
|
|
set:
|
|
server.ingress.hosts:
|
|
- host: twenty.example.com
|
|
paths:
|
|
- path: /
|
|
pathType: Prefix
|
|
server.ingress.tls:
|
|
- hosts:
|
|
- twenty.example.com
|
|
secretName: twenty-tls
|
|
asserts:
|
|
- equal:
|
|
path: spec.rules[0].host
|
|
value: twenty.example.com
|
|
- equal:
|
|
path: spec.rules[0].http.paths[0].path
|
|
value: /
|
|
- equal:
|
|
path: spec.tls[0].hosts[0]
|
|
value: twenty.example.com
|
|
- equal:
|
|
path: spec.tls[0].secretName
|
|
value: twenty-tls
|
|
- it: adds cert-manager annotation when acme true
|
|
set:
|
|
server.ingress.acme: true
|
|
asserts:
|
|
- isSubset:
|
|
path: metadata.annotations
|
|
content:
|
|
cert-manager.io/cluster-issuer: letsencrypt-prod
|