Skip to content

Commit 7f78680

Browse files
authored
Test from 0 (#3)
* init tests * gitignore * tests
1 parent 6dd3aab commit 7f78680

14 files changed

Lines changed: 1971 additions & 51 deletions

File tree

Lines changed: 343 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,343 @@
1+
---
2+
# Source: external-dns/templates/clusterrolebinding.yaml
3+
apiVersion: rbac.authorization.k8s.io/v1
4+
kind: ClusterRoleBinding
5+
metadata:
6+
name: golden-file-test-external-dns-test-namespace
7+
labels:
8+
app.kubernetes.io/instance: golden-file-test
9+
app.kubernetes.io/managed-by: Helm
10+
app.kubernetes.io/name: external-dns
11+
app.kubernetes.io/version: 0.18.0
12+
roleRef:
13+
apiGroup: rbac.authorization.k8s.io
14+
kind: ClusterRole
15+
name: golden-file-test-external-dns-test-namespace
16+
subjects:
17+
- kind: ServiceAccount
18+
name: golden-file-test-external-dns
19+
namespace: "test-namespace"
20+
---
21+
# Source: external-dns/templates/clusterrole.yaml
22+
apiVersion: rbac.authorization.k8s.io/v1
23+
kind: ClusterRole
24+
metadata:
25+
name: golden-file-test-external-dns-test-namespace
26+
labels:
27+
app.kubernetes.io/instance: golden-file-test
28+
app.kubernetes.io/managed-by: Helm
29+
app.kubernetes.io/name: external-dns
30+
app.kubernetes.io/version: 0.18.0
31+
rules:
32+
- apiGroups:
33+
- ""
34+
resources:
35+
- services
36+
- pods
37+
- nodes
38+
- namespaces
39+
verbs:
40+
- get
41+
- list
42+
- watch
43+
- apiGroups:
44+
- "discovery.k8s.io"
45+
resources:
46+
- endpointslices
47+
verbs:
48+
- get
49+
- list
50+
- watch
51+
- apiGroups:
52+
- extensions
53+
- "networking.k8s.io"
54+
- getambassador.io
55+
resources:
56+
- ingresses
57+
- hosts
58+
verbs:
59+
- get
60+
- list
61+
- watch
62+
- apiGroups:
63+
- route.openshift.io
64+
resources:
65+
- routes
66+
verbs:
67+
- get
68+
- list
69+
- watch
70+
- apiGroups:
71+
- networking.istio.io
72+
resources:
73+
- gateways
74+
- virtualservices
75+
verbs:
76+
- get
77+
- list
78+
- watch
79+
- apiGroups:
80+
- zalando.org
81+
resources:
82+
- routegroups
83+
verbs:
84+
- get
85+
- list
86+
- watch
87+
- apiGroups:
88+
- zalando.org
89+
resources:
90+
- routegroups/status
91+
verbs:
92+
- patch
93+
- update
94+
- apiGroups:
95+
- projectcontour.io
96+
resources:
97+
- httpproxies
98+
verbs:
99+
- get
100+
- watch
101+
- list
102+
- apiGroups:
103+
- gloo.solo.io
104+
- gateway.solo.io
105+
resources:
106+
- proxies
107+
- virtualservices
108+
verbs:
109+
- get
110+
- list
111+
- watch
112+
- apiGroups:
113+
- configuration.konghq.com
114+
resources:
115+
- tcpingresses
116+
verbs:
117+
- get
118+
- list
119+
- watch
120+
- apiGroups:
121+
- gateway.networking.k8s.io
122+
resources:
123+
- gateways
124+
- httproutes
125+
- tlsroutes
126+
- tcproutes
127+
- udproutes
128+
- grpcroutes
129+
verbs:
130+
- get
131+
- list
132+
- watch
133+
- apiGroups:
134+
- cis.f5.com
135+
resources:
136+
- virtualservers
137+
- transportservers
138+
verbs:
139+
- get
140+
- watch
141+
- list
142+
---
143+
# Source: external-dns/templates/deployment.yaml
144+
apiVersion: apps/v1
145+
kind: Deployment
146+
metadata:
147+
name: golden-file-test-external-dns
148+
namespace: "test-namespace"
149+
labels:
150+
app.kubernetes.io/instance: golden-file-test
151+
app.kubernetes.io/managed-by: Helm
152+
app.kubernetes.io/name: external-dns
153+
app.kubernetes.io/version: 0.18.0
154+
spec:
155+
revisionHistoryLimit: 10
156+
replicas: 1
157+
selector:
158+
matchLabels:
159+
app.kubernetes.io/instance: golden-file-test
160+
app.kubernetes.io/name: external-dns
161+
template:
162+
metadata:
163+
labels:
164+
app.kubernetes.io/instance: golden-file-test
165+
app.kubernetes.io/managed-by: Helm
166+
app.kubernetes.io/name: external-dns
167+
app.kubernetes.io/version: 0.18.0
168+
spec:
169+
170+
securityContext:
171+
fsGroup: 1001
172+
fsGroupChangePolicy: Always
173+
supplementalGroups: []
174+
sysctls: []
175+
affinity:
176+
podAffinity:
177+
178+
podAntiAffinity:
179+
preferredDuringSchedulingIgnoredDuringExecution:
180+
- podAffinityTerm:
181+
labelSelector:
182+
matchLabels:
183+
app.kubernetes.io/instance: golden-file-test
184+
app.kubernetes.io/name: external-dns
185+
topologyKey: kubernetes.io/hostname
186+
weight: 1
187+
nodeAffinity:
188+
189+
automountServiceAccountToken: true
190+
serviceAccountName: golden-file-test-external-dns
191+
containers:
192+
- name: external-dns
193+
image: docker.io/bitnami/external-dns:0.18.0-debian-12-r4
194+
imagePullPolicy: "IfNotPresent"
195+
args:
196+
# Generic arguments
197+
- --metrics-address=:7979
198+
- --log-level=info
199+
- --log-format=text
200+
- --policy=upsert-only
201+
- --provider=aws
202+
- --registry=txt
203+
- --interval=1m
204+
- --source=service
205+
- --source=ingress
206+
# AWS arguments
207+
- --aws-api-retries=3
208+
- --aws-zone-type=
209+
- --aws-batch-change-size=1000
210+
env:
211+
# AWS environment variables
212+
- name: AWS_DEFAULT_REGION
213+
value: us-east-1
214+
envFrom:
215+
ports:
216+
- name: http
217+
containerPort: 7979
218+
livenessProbe:
219+
tcpSocket:
220+
port: http
221+
initialDelaySeconds: 10
222+
periodSeconds: 10
223+
timeoutSeconds: 5
224+
successThreshold: 1
225+
failureThreshold: 2
226+
readinessProbe:
227+
httpGet:
228+
path: /healthz
229+
port: http
230+
initialDelaySeconds: 5
231+
periodSeconds: 10
232+
timeoutSeconds: 5
233+
successThreshold: 1
234+
failureThreshold: 6
235+
securityContext:
236+
allowPrivilegeEscalation: false
237+
capabilities:
238+
drop:
239+
- ALL
240+
privileged: false
241+
readOnlyRootFilesystem: true
242+
runAsGroup: 1001
243+
runAsNonRoot: true
244+
runAsUser: 1001
245+
seLinuxOptions: {}
246+
seccompProfile:
247+
type: RuntimeDefault
248+
resources:
249+
limits:
250+
cpu: 150m
251+
ephemeral-storage: 2Gi
252+
memory: 192Mi
253+
requests:
254+
cpu: 100m
255+
ephemeral-storage: 50Mi
256+
memory: 128Mi
257+
volumeMounts:
258+
- name: empty-dir
259+
mountPath: /tmp
260+
subPath: tmp-dir
261+
volumes:
262+
- name: empty-dir
263+
emptyDir: {}
264+
---
265+
# Source: external-dns/templates/networkpolicy.yaml
266+
kind: NetworkPolicy
267+
apiVersion: networking.k8s.io/v1
268+
metadata:
269+
name: golden-file-test-external-dns
270+
namespace: "test-namespace"
271+
labels:
272+
app.kubernetes.io/instance: golden-file-test
273+
app.kubernetes.io/managed-by: Helm
274+
app.kubernetes.io/name: external-dns
275+
app.kubernetes.io/version: 0.18.0
276+
app.kubernetes.io/component: controller
277+
spec:
278+
podSelector:
279+
matchLabels:
280+
app.kubernetes.io/instance: golden-file-test
281+
app.kubernetes.io/name: external-dns
282+
policyTypes:
283+
- Ingress
284+
- Egress
285+
egress:
286+
- {}
287+
ingress:
288+
- ports:
289+
- port: 7979
290+
---
291+
# Source: external-dns/templates/pdb.yaml
292+
apiVersion: policy/v1
293+
kind: PodDisruptionBudget
294+
metadata:
295+
name: golden-file-test-external-dns
296+
namespace: "test-namespace"
297+
labels:
298+
app.kubernetes.io/instance: golden-file-test
299+
app.kubernetes.io/managed-by: Helm
300+
app.kubernetes.io/name: external-dns
301+
app.kubernetes.io/version: 0.18.0
302+
spec:
303+
maxUnavailable: 1
304+
selector:
305+
matchLabels:
306+
app.kubernetes.io/instance: golden-file-test
307+
app.kubernetes.io/name: external-dns
308+
---
309+
# Source: external-dns/templates/serviceaccount.yaml
310+
apiVersion: v1
311+
kind: ServiceAccount
312+
metadata:
313+
name: golden-file-test-external-dns
314+
namespace: "test-namespace"
315+
labels:
316+
app.kubernetes.io/instance: golden-file-test
317+
app.kubernetes.io/managed-by: Helm
318+
app.kubernetes.io/name: external-dns
319+
app.kubernetes.io/version: 0.18.0
320+
automountServiceAccountToken: false
321+
---
322+
# Source: external-dns/templates/service.yaml
323+
apiVersion: v1
324+
kind: Service
325+
metadata:
326+
name: golden-file-test-external-dns
327+
namespace: "test-namespace"
328+
labels:
329+
app.kubernetes.io/instance: golden-file-test
330+
app.kubernetes.io/managed-by: Helm
331+
app.kubernetes.io/name: external-dns
332+
app.kubernetes.io/version: 0.18.0
333+
spec:
334+
type: ClusterIP
335+
sessionAffinity: None
336+
ports:
337+
- name: http
338+
port: 7979
339+
protocol: TCP
340+
targetPort: http
341+
selector:
342+
app.kubernetes.io/instance: golden-file-test
343+
app.kubernetes.io/name: external-dns
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package golden
2+
3+
import (
4+
"path/filepath"
5+
"testing"
6+
"tests/golden"
7+
8+
"github.com/stretchr/testify/require"
9+
"github.com/stretchr/testify/suite"
10+
)
11+
12+
var defaultSetValues = map[string]string{
13+
"commitSha": "ed5e844826ce4be1711b05c6a9940a85c8326868",
14+
"rollme": "false",
15+
"itIsTest": "true",
16+
}
17+
18+
func TestGoldenDefault(t *testing.T) {
19+
t.Parallel()
20+
21+
chartPath, err := filepath.Abs("../../..")
22+
require.NoError(t, err)
23+
24+
suite.Run(t, &golden.TemplateGoldenTest{
25+
ChartPath: chartPath,
26+
Release: "golden-file-test",
27+
Namespace: "test-namespace",
28+
GoldenFileName: "default",
29+
Templates: []string{
30+
"templates/clusterrolebinding.yaml",
31+
"templates/clusterrole.yaml",
32+
//"templates/configmap.yaml",
33+
"templates/deployment.yaml",
34+
//"templates/extra-list.yaml",
35+
"templates/networkpolicy.yaml",
36+
"templates/pdb.yaml",
37+
//"templates/podmonitor.yaml",
38+
//"templates/psp-clusterrolebinding.yaml",
39+
//"templates/psp-clusterrole.yaml",
40+
//"templates/psp.yaml",
41+
//"templates/rolebindings.yaml",
42+
//"templates/role.yaml",
43+
//"templates/secret.yaml",
44+
"templates/serviceaccount.yaml",
45+
//"templates/servicemonitor.yaml",
46+
"templates/service.yaml",
47+
//"templates/tls-secret.yaml",
48+
},
49+
SetValues: defaultSetValues,
50+
ValuesFiles: []string{
51+
"../../values/default.values.yaml",
52+
},
53+
})
54+
}

0 commit comments

Comments
 (0)