Skip to content

Commit 239aeba

Browse files
committed
test(http-cache): add default render helm unit tests
http-cache was one of eight user-facing apps with no helm-unittest coverage. Assisted-by: LLM Signed-off-by: Akanksha Trehun <[email protected]>
1 parent e94fcf8 commit 239aeba

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

‎packages/apps/http-cache/Makefile‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ generate:
1919
cozyvalues-gen -m 'httpcache' -v values.yaml -s values.schema.json -r README.md -g ../../../api/apps/v1alpha1/httpcache/types.go
2020
../../../hack/update-crd.sh
2121

22+
.PHONY: test
23+
test:
24+
helm unittest .
25+
2226
update:
2327
tag=$$(git ls-remote --tags --sort="v:refname" https://github.com/chrislim2888/IP2Location-C-Library | awk -F'[/^]' 'END{print $$3}') && \
2428
sed -i "/^ARG IP2LOCATION_C_VERSION=/ s/=.*/=$$tag/" images/nginx/Dockerfile
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
suite: haproxy default render
2+
templates:
3+
- templates/haproxy/deployment.yaml
4+
- templates/haproxy/configmap.yaml
5+
6+
release:
7+
name: http-cache-test
8+
namespace: tenant-test
9+
10+
tests:
11+
- it: renders the haproxy Deployment with the default replica count
12+
template: templates/haproxy/deployment.yaml
13+
asserts:
14+
- hasDocuments:
15+
count: 1
16+
- equal:
17+
path: spec.replicas
18+
value: 2
19+
- equal:
20+
path: spec.template.spec.containers[0].image
21+
value: haproxy:latest
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
suite: nginx cache default render
2+
templates:
3+
- templates/nginx/deployment.yaml
4+
- templates/nginx/configmap.yaml
5+
6+
release:
7+
name: http-cache-test
8+
namespace: tenant-test
9+
10+
tests:
11+
- it: renders a PodDisruptionBudget plus a Deployment, PVC and Service per nginx replica
12+
template: templates/nginx/deployment.yaml
13+
asserts:
14+
- hasDocuments:
15+
count: 7
16+
17+
- it: pins the nginx cache image on the first replica's Deployment
18+
template: templates/nginx/deployment.yaml
19+
documentIndex: 1
20+
asserts:
21+
- equal:
22+
path: kind
23+
value: Deployment
24+
- equal:
25+
path: spec.template.spec.containers[0].image
26+
value: ghcr.io/cozystack/cozystack/nginx-cache:v1.6.0@sha256:bd042a8a9789e8b21b12cb266e390484a3a48f4af6ca6e2d2864a8a83c74bd25
27+
28+
- it: sizes the first replica's PVC from values.size
29+
template: templates/nginx/deployment.yaml
30+
documentIndex: 2
31+
asserts:
32+
- equal:
33+
path: kind
34+
value: PersistentVolumeClaim
35+
- equal:
36+
path: spec.resources.requests.storage
37+
value: 10Gi

0 commit comments

Comments
 (0)