Skip to content

Commit d8ba0b4

Browse files
issue-471: no fix at the moment
Signed-off-by: ivan katliarchuk <[email protected]>
1 parent d28886f commit d8ba0b4

File tree

7 files changed

+109
-17
lines changed

7 files changed

+109
-17
lines changed

issue-471/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
description: An example chart with customized subchart
3-
name: with-subchart
3+
name: array-substitution
44
version: 0.1.0
55
issueLink: https://github.com/helm-unittest/helm-unittest/issues/471
66
supportedLinks:

issue-471/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11

22
# - matchSnapshot: {}
3+
4+
bug
5+
```
6+
path: hosts[1] values: hotpatch
7+
287 setMap: map[hosts:[<nil> hotpatch]]
8+
```

issue-471/templates/ingress.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- if .Values.ingress.enabled -}}
2+
apiVersion: extensions/v1beta1
3+
kind: Ingress
4+
metadata:
5+
name: ingress-under-test
6+
spec:
7+
rules:
8+
{{- range $host := .Values.ingress.hosts }}
9+
- host: {{ $host }}
10+
http:
11+
paths:
12+
- path: /
13+
backend:
14+
serviceName: my-test-service
15+
{{- end -}}
16+
{{- end -}}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
first test:
2+
1: |
3+
apiVersion: extensions/v1beta1
4+
kind: Ingress
5+
metadata:
6+
name: ingress-under-test
7+
spec:
8+
rules:
9+
- host: chart-example.local
10+
http:
11+
paths:
12+
- backend:
13+
serviceName: my-test-service
14+
path: /
15+
job level override test:
16+
1: |
17+
apiVersion: extensions/v1beta1
18+
kind: Ingress
19+
metadata:
20+
name: ingress-under-test
21+
spec:
22+
rules:
23+
- host: chart-example.local
24+
http:
25+
paths:
26+
- backend:
27+
serviceName: my-test-service
28+
path: /

issue-471/tests/simple_test.yaml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
suite: just a test
22
templates:
33
- simple.yaml
4+
set:
5+
hosts[1]: SUITE-host-set-1
6+
ingress:
7+
hosts[1]: SUITE-example.local-1
48
tests:
59
- it: paradox
610
template: simple.yaml
7-
set:
8-
hosts[1]: hotpatch
11+
# set:
12+
# hosts[1]: job-host-set-1
913
asserts:
10-
- notEqual:
11-
path: anArrayValues.rules[0].host
12-
value: null
14+
# - notEqual:
15+
# path: anArrayValues.rules[0].host
16+
# value: null
1317
- equal:
1418
path: anArrayValues.rules
1519
value:
16-
- host: null
17-
- host: hotpatch1
18-
- equal:
19-
path: anArrayValues.rules[1].host
20-
value: hotpatch
20+
- host: chart-example.local
21+
- host: SUITE-host-set-1
22+
# - equal:
23+
# path: anArrayValues.rules
24+
# value:
25+
# - host: null
26+
# - host: hotpatch1
27+
# - equal:
28+
# path: anArrayValues.rules[1].host
29+
# value: hotpatch
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
suite: ingress under
2+
templates:
3+
- ingress.yaml
4+
set:
5+
ingress:
6+
enabled: true
7+
hosts[1]: chart-example.suite-level
8+
tests:
9+
- it: first test
10+
set:
11+
ingress:
12+
enabled: true
13+
hosts[1]: chart-example.job-level
14+
asserts:
15+
- matchSnapshot: {}
16+
- exists:
17+
path: spec.rules[?(@.host == "chart-example.local")]
18+
19+
- it: job level override test
20+
# set:
21+
# ingress:
22+
# hosts[1]: chart-example.job-level
23+
asserts:
24+
- matchSnapshot: {}
25+
- exists:
26+
path: spec.rules[?(@.host == "chart-example.local")]
27+
- exists:
28+
path: spec.rules[?(@.host == "chart-example.job-level")]

issue-471/values.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
hosts:
2-
- chart-example.local
2+
- chart-hosts-example.local
33
- chart-example.remote
44

5-
hostsMap:
6-
- name: value0
7-
attribute: attribute0
8-
- name: value1
9-
attribute: attribute1
5+
# tests:
6+
# hostsMap:
7+
# - name: value0
8+
# attribute: attribute0
9+
# - name: value1
10+
# attribute: attribute1
11+
12+
ingress:
13+
hosts:
14+
- chart-ingress-example.local

0 commit comments

Comments
 (0)