-
Notifications
You must be signed in to change notification settings - Fork 30
/
homepage_test.yaml
258 lines (254 loc) · 8.01 KB
/
homepage_test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
suite: ingress - homepage metadata test
templates:
- common.yaml
chart:
appVersion: &appVer v9.9.9
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should pass with ingress created with annotations from homepage enabled
set:
k1: some-name
k2: some-desc
k3: some-icon
k4: some-url
k5: some-type
k6: some-group
operator: &operator
verify:
enabled: false
service:
my-service:
enabled: true
primary: true
ports:
main:
enabled: true
primary: true
protocol: https
port: 9443
my-service2:
enabled: true
ports:
port-2:
enabled: true
primary: true
port: 80
someHost: test-host
somePath: /test-path
ingress:
my-ingress1:
enabled: true
primary: true
integrations:
traefik: &traefik
enabled: false
homepage:
enabled: true
hosts:
- host: "{{ .Values.someHost }}"
paths:
- path: "{{ .Values.somePath }}"
my-ingress2:
enabled: true
integrations:
traefik: *traefik
homepage:
enabled: true
name: "{{ .Values.k1 }}"
description: "{{ .Values.k2 }}"
icon: "{{ .Values.k3 }}"
group: "{{ .Values.k6 }}"
weight: 1
podSelector:
- main
- other
widget:
url: "{{ .Values.k4 }}"
type: "{{ .Values.k5 }}"
custom:
some-key: some-value
some-other-key: some-other-value
customkv:
- key: some-key-slice
value: some-value-slice
- key: some-other-key-slice
value: some-other-value-slice
hosts: &hosts
- host: test-host
paths:
- path: /test-path
my-ingress3:
enabled: true
targetSelector:
my-service2: port-2
integrations:
traefik: *traefik
homepage:
enabled: true
hosts:
- host: "{{ .Values.someHost }}"
paths:
- path: "{{ .Values.somePath }}"
asserts:
- documentIndex: &ingressDoc 2
isKind:
of: Ingress
- documentIndex: *ingressDoc
equal:
path: metadata.annotations
value:
gethomepage.dev/enabled: "true"
gethomepage.dev/name: CommonTest
gethomepage.dev/description: Helper chart to test different use cases of the common library
gethomepage.dev/href: https://test-host/test-path
gethomepage.dev/widget.url: https://test-release-name-common-test.test-release-namespace.svc:9443
gethomepage.dev/icon: https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png
gethomepage.dev/widget.type: commontest
- documentIndex: *ingressDoc
equal:
path: metadata.name
value: test-release-name-common-test
- documentIndex: *ingressDoc
equal:
path: metadata.namespace
value: test-release-namespace
- documentIndex: &otherIngressDoc 3
isKind:
of: Ingress
- documentIndex: *otherIngressDoc
equal:
path: metadata.annotations
value:
gethomepage.dev/enabled: "true"
gethomepage.dev/name: some-name
gethomepage.dev/description: some-desc
gethomepage.dev/group: some-group
gethomepage.dev/href: https://test-host/test-path
gethomepage.dev/icon: some-icon
gethomepage.dev/widget.url: some-url
gethomepage.dev/weight: "1"
gethomepage.dev/widget.type: some-type
gethomepage.dev/pod-selector: pod.name in (main,other)
gethomepage.dev/widget.some-key: some-value
gethomepage.dev/widget.some-other-key: some-other-value
gethomepage.dev/widget.some-key-slice: some-value-slice
gethomepage.dev/widget.some-other-key-slice: some-other-value-slice
- documentIndex: *otherIngressDoc
equal:
path: metadata.name
value: test-release-name-common-test-my-ingress2
- documentIndex: *otherIngressDoc
equal:
path: metadata.namespace
value: test-release-namespace
- documentIndex: &thirdIngressDoc 4
isKind:
of: Ingress
- documentIndex: *thirdIngressDoc
equal:
path: metadata.annotations
value:
gethomepage.dev/enabled: "true"
gethomepage.dev/name: CommonTest
gethomepage.dev/description: Helper chart to test different use cases of the common library
gethomepage.dev/href: https://test-host/test-path
gethomepage.dev/widget.url: http://test-release-name-common-test-my-service2.test-release-namespace.svc:80
gethomepage.dev/icon: https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png
gethomepage.dev/widget.type: commontest
- documentIndex: *thirdIngressDoc
equal:
path: metadata.name
value: test-release-name-common-test-my-ingress3
- documentIndex: *thirdIngressDoc
equal:
path: metadata.namespace
value: test-release-namespace
# Failures
- it: should fail with podSelector not a slice
set:
operator: *operator
service: &service
my-service:
enabled: true
primary: true
ports:
main:
enabled: true
primary: true
protocol: https
port: 9443
ingress:
my-ingress1:
enabled: true
primary: true
integrations:
traefik:
enabled: false
homepage:
enabled: true
podSelector: main
hosts: *hosts
asserts:
- failedTemplate:
errorMessage: Ingress - Expected [integrations.homepage.podSelector] to be a [slice], but got [string]
- it: should fail with custom widget not a map
set:
operator: *operator
service: *service
ingress:
my-ingress1:
enabled: true
primary: true
integrations:
traefik:
enabled: false
homepage:
enabled: true
widget:
custom: "not a map"
hosts: *hosts
asserts:
- failedTemplate:
errorMessage: Ingress - Expected [integrations.homepage.widget.custom] to be a [map], but got [string]
- it: should fail with customkv widget not a slice
set:
operator: *operator
service: *service
ingress:
my-ingress1:
enabled: true
primary: true
integrations:
traefik:
enabled: false
homepage:
enabled: true
widget:
customkv: "not a slice"
hosts: *hosts
asserts:
- failedTemplate:
errorMessage: Ingress - Expected [integrations.homepage.widget.customkv] to be a [slice], but got [string]
- it: should fail with customkv having empty key
set:
operator: *operator
service: *service
ingress:
my-ingress1:
enabled: true
primary: true
integrations:
traefik:
enabled: false
homepage:
enabled: true
widget:
customkv:
- key: ""
value: some-value
hosts: *hosts
asserts:
- failedTemplate:
errorMessage: Ingress - Expected non-empty [key] in [integrations.homepage.widget.customkv]