Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EliavLunar committed Jan 14, 2025
1 parent f7eba25 commit 644b858
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Helm Chart CI

on:
pull_request:
paths:
- charts/**
jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Install Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
- name: Install Helm unittest plugin
run: helm plugin install https://github.com/quintush/helm-unittest

- name: Update Helm dependencies
run: helm dependency update ./charts/lunar-proxy

- name: Run Helm unittest
run: helm unittest ./charts/lunar-proxy
33 changes: 33 additions & 0 deletions charts/lunar-proxy/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
suite: Test image configuration

tests:
- it: should use the pro image from GCP when pro is enabled
template: templates/deployment.yaml
set:
pro: true
image:
tag: "v2.0.0"
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: "us-central1-docker.pkg.dev/prj-common-442813/lunar-proxy-pro/lunar-proxy-pro:v2.0.0"

- it: should use the public dockerhub image when pro is disabled
template: templates/deployment.yaml
set:
pro: false
image:
tag: "v1.0.0"
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: "lunarapi/lunar-proxy:v1.0.0"

- it: should use default app version if image tag is not set
template: templates/deployment.yaml
set:
pro: false
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: "lunarapi/lunar-proxy:v0.8.25" # Hardcoded value from values.yaml. In reality `helm package` command in the CI pipeline would replace this with the actual appVersion

0 comments on commit 644b858

Please sign in to comment.