Skip to content

Commit 2d49682

Browse files
committed
add dummy test with helm-unittest
1 parent 1448433 commit 2d49682

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

.github/workflows/unit-tests.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Unit Tests
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
branches:
10+
- master
11+
12+
jobs:
13+
helm-unittest:
14+
15+
runs-on: ubuntu-latest
16+
# strategy:
17+
# matrix:
18+
# Relevant tools installed by default on ubuntu 20.04:
19+
# - helm 3.8.0
20+
# - jq 1.6
21+
# - kind 0.11.1
22+
# - kubectl 1.23.3
23+
# - minikube 1.25.1
24+
# - python 3.8.10
25+
# - yamllint 1.26.3
26+
# - yq 4.19.1
27+
# see: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
32+
- name: Install helm-unittest
33+
# We should periodically check to see if another fork has taken over maintenance,
34+
# as the de-facto "best" fork has changed several times over the years.
35+
run: |
36+
helm plugin install https://github.com/quintush/helm-unittest
37+
38+
- name: Install chart dependencies
39+
run: |
40+
helm dependency update
41+
42+
- name: Run helm-unittest
43+
# by default looks for tests/*_test.yaml
44+
run: |
45+
helm unittest --color --helm3 .

tests/dummy_test.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
suite: Dummy Tests
3+
templates:
4+
- configmaps_st2-conf.yaml
5+
6+
# this optionally overrides {{ .Release }}
7+
#release:
8+
# name: my-release # default: release-name
9+
# namespace: my-namespace # default: namespace
10+
# revision: 1 # default: 0
11+
# isUpgrade: true # default: false
12+
13+
# this optionally overrides {{ .Capabilities }}
14+
#capabilities:
15+
# majorVersion: 1 # default from Helm
16+
# minorVersion: 10 # default from Helm
17+
# apiVersions: # defaults to versionset used by k8s version
18+
# - br.dev.local/v2
19+
20+
# this optionally overrides {{ .Chart }}
21+
#chart:
22+
# version: 1.0.0 # default from Chart.yaml
23+
# appVersion: 1.0.0 # default from Chart.yaml
24+
25+
tests:
26+
27+
# name your test
28+
- it: should pass
29+
30+
# define values
31+
#values: # like `helm install -f` or `helm install --values`
32+
# - ./values/staging.yaml
33+
#set: # like `helm install --set`
34+
# image.pullPolicy: Always
35+
# resources:
36+
# limits:
37+
# memory: 128Mi
38+
39+
# narrow the template selection if needed.
40+
#template: deployment.yaml
41+
42+
# Select which document rendered by the template to use.
43+
# This will be fiddly for us as we have multiple documents in many of our templates.
44+
# So, we'll have to hard-code the order in our tests. Ick.
45+
#documentIndex: 0 # default: -1 (ie assert on all documents)
46+
47+
# specify relevant overrides
48+
#release: # {{ .Release }}
49+
# name: my-release
50+
# namespace:
51+
# revision: 9
52+
# isUpgrade: true
53+
#capabilities: # {{ .Capabilities }}
54+
# majorVersion: 1
55+
# minorVersion: 12
56+
# apiVersions:
57+
# - custom.api/v1
58+
#chart: # {{ .Chart }}
59+
# version: 1.0.0
60+
# appVersion: 1.0.0
61+
62+
# the meat of the test
63+
asserts:
64+
#- equal:
65+
# path: metadata.name
66+
# value: my-deploy
67+
#- equal:
68+
# path: metadata.name
69+
# value: your-service
70+
# not: true
71+
# template: web/service.yaml
72+
# documentIndex: 0
73+
74+
# our dummy test
75+
- hasDocuments:
76+
count: 1

0 commit comments

Comments
 (0)