Skip to content

Commit

Permalink
feat: (CCIE-3082) add unit testing to GHA (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtsai-czi authored Aug 1, 2024
1 parent d6380ac commit 8d332f7
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Unit testing

on: pull_request

jobs:
unittest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: d3adb5/helm-unittest-action@v2
with:
helm-version: v3.8.0
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions stack/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
.idea/
*.tmproj
.vscode/
# testing
tests
42 changes: 42 additions & 0 deletions stack/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
suite: test deployment
templates:
- deployment.yaml
tests:
- it: should work
set:
services:
service1:
args: ["arg1", "arg2"]
command: ["command1", "command2"]
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
maxUnavailable: 1
replicaCount: 2
sidecars:
- name: sidecar1
image: "sidecar1:latest"
- name: sidecar2
image: "sidecar2:latest"
initContainers:
- name: initContainer1
image: "alpine:latest"
command: ["echo", "Hello World"]
asserts:
- isKind:
of: Deployment
- isSubset:
path: spec
content:
revisionHistoryLimit: 3
any: true
- containsDocument:
apiVersion: apps/v1
kind: Deployment

# path: metadata.name
# pattern: -my-chart$
# - equal:
# path: spec.template.spec.containers[0].image
# value: nginx:latest

0 comments on commit 8d332f7

Please sign in to comment.