Skip to content

Commit

Permalink
chore: add first e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Schuetz <[email protected]>
  • Loading branch information
Thomas Schuetz authored and thschue committed Jul 13, 2023
1 parent 163b68c commit b6fc01e
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 3 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Test Scenarios
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'

env:
# renovate: datasource=github-tags depName=kudobuilder/kuttl
KUTTL_VERSION: "v0.15.0"

defaults:
run:
shell: bash

jobs:
run-scenarios:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3

- uses: actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b # v4
with:
python-version: '3.9'
check-latest: true

- name: Download KUTTL
run: |
curl -fL https://github.com/kudobuilder/kuttl/releases/download/${{ env.KUTTL_VERSION }}/kubectl-kuttl_${KUTTL_VERSION#v}_linux_x86_64 -o kubectl-kuttl
chmod +x kubectl-kuttl
mv kubectl-kuttl /usr/local/bin
- name: Set up chart-testing
uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0

- name: Cleanup Chart.lock for test
run: rm charts/glasskube-operator/Chart.lock

- name: Run chart-testing (lint)
run: ct lint --validate-maintainers=false --check-version-increment=false --chart-dirs charts --target-branch ${{ github.event.repository.default_branch }} --all

- name: Create kind cluster
uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00 # v1.5.0

- name: Cleanup Chart.lock for test
run: rm charts/glasskube-operator/Chart.lock

- name: Run chart-testing (install)
run: >
ct install --chart-dirs charts --skip-clean-up --target-branch ${{ github.event.repository.default_branch }} --all
--helm-extra-set-args '--set=cert-manager.enabled=true --set=mariadb-operator.enabled=true --set=cloudnative-pg.enabled=true --set=kube-prometheus-stack.enabled=true'
- name: Run Tests
working-directory: e2e
run: make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.gradle/
/**/build/
/.idea/
/e2e/kubeconfig
/charts/*/charts/
4 changes: 2 additions & 2 deletions charts/glasskube-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: "0.6.3" # x-release-please-version
version: "0.6.3" # x-release-please-version
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.6.3" # x-release-please-version
appVersion: "0.6.3" # x-release-please-version
dependencies:
- name: cert-manager
condition: cert-manager.enabled
Expand Down
2 changes: 1 addition & 1 deletion charts/glasskube-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
operator:
image:
repository: glasskube/operator
tag: "" # defaults to Chart.appVersion if unspecified
tag: "" # defaults to Chart.appVersion if unspecified
replicaCount: 1
resources:
limits:
Expand Down
3 changes: 3 additions & 0 deletions e2e/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.PHONY: test
test:
kubectl kuttl test --start-kind=false ./kuttl --config=./kuttl/kuttl-test.yaml
7 changes: 7 additions & 0 deletions e2e/kuttl/kuttl-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kuttl.dev/v1
kind: TestSuite
testDirs:
- ./test
timeout: 400
skipDelete: true
namespace: default
27 changes: 27 additions & 0 deletions e2e/kuttl/test/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: matomo-matomo
labels:
app: matomo
app.kubernetes.io/managed-by: glasskube-operator
glasskube.eu/Matomo: matomo
status:
availableReplicas: 1
readyReplicas: 1
replicas: 1
updatedReplicas: 1

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: matomo-matomo-mariadb
status:
availableReplicas: 1
currentReplicas: 1
readyReplicas: 1
replicas: 1
updatedReplicas: 1

6 changes: 6 additions & 0 deletions e2e/kuttl/test/00-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: "glasskube.eu/v1alpha1"
kind: Matomo
metadata:
name: matomo
spec:
host: matomo.minikube

0 comments on commit b6fc01e

Please sign in to comment.