Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: (CCIE-3082) add unit testing to GHA #64

Merged
merged 9 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading