Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karitham committed Jul 17, 2024
1 parent b213868 commit eabc90b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: d3adb5/helm-unittest-action@v2
with:
fetch-depth: 0
- uses: azure/setup-helm@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install helm unittest
run: helm plugin install https://github.com/helm-unittest/helm-unittest --version v0.5.1
- name: Run unittest
run: helm unittest charts/wga
5 changes: 5 additions & 0 deletions charts/wga/tests/defaultValues.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
endpoint:
address: 192.168.1.1
privateKeySecretName: wga-key
unbound:
ip: 192.168.1.53
6 changes: 2 additions & 4 deletions charts/wga/tests/endpoint_test.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
suite: test default image tags
templates:
- endpoint/deployment.yaml
values:
- defaultValues.yaml
tests:
- it: default image tags should equal to current appVersion
chart:
appVersion: 0.6.2
set:
endpoint.address: 192.168.1.1
endpoint.privateKeySecretName: wga-key
unbound.ip: 192.168.1.53
asserts:
- equal:
path: spec.template.spec.containers[0].image
Expand Down
12 changes: 2 additions & 10 deletions charts/wga/tests/unbound_test.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
suite: unbound
templates:
- unbound/service.yaml
values:
- defaultValues.yaml
tests:
- it: should set custom annotations for unbound service
set:
endpoint.address: 192.168.1.1
endpoint.privateKeySecretName: wga-key
unbound.ip: 192.168.1.53
unbound.service.annotations:
custom.annotation/test: "test-value"
another.annotation/example: "example-value"
Expand All @@ -18,19 +17,12 @@ tests:
another.annotation/example: "example-value"

- it: should not any annotation by default
set:
endpoint.address: 192.168.1.1
endpoint.privateKeySecretName: wga-key
unbound.ip: 192.168.1.53
asserts:
- isNullOrEmpty:
path: metadata.annotations

- it: should set metallb annotation when specified
set:
endpoint.address: 192.168.1.1
endpoint.privateKeySecretName: wga-key
unbound.ip: 192.168.1.53
unbound.service.annotations:
metallb.universe.tf/loadBalancerIPs: "192.168.1.53"
asserts:
Expand Down

0 comments on commit eabc90b

Please sign in to comment.