Skip to content

Commit

Permalink
basic kuttle stuff
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Bigler <nicolas.bigler@vshn.ch>
  • Loading branch information
TheBigLee committed Nov 30, 2023
1 parent f8e2188 commit eea652c
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: E2E

on:
pull_request:
branches:
- master

jobs:
test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Run tests
run: make test-e2e
env:
KUBECONFIG: ${{ secrets.LAB_KUBECONFIG}}
6 changes: 6 additions & 0 deletions tests/e2e/kuttl-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestSuite
testDirs:
- ./test/e2e/
namespace: default
timeout: 60
41 changes: 41 additions & 0 deletions tests/e2e/local.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
###
### E2E Tests
### with KUTTL (https://kuttl.dev)
###

kuttl_bin = $(go_bin)/kubectl-kuttl
$(kuttl_bin): export GOBIN = $(go_bin)
$(kuttl_bin): | $(go_bin)
go install github.com/kudobuilder/kuttl/cmd/kubectl-kuttl@latest

mc_bin = $(go_bin)/mc
$(mc_bin): export GOBIN = $(go_bin)
$(mc_bin): | $(go_bin)
go install github.com/minio/mc@latest

test-e2e: export KUBECONFIG = $(KIND_KUBECONFIG)
test-e2e: $(kuttl_bin) $(mc_bin) local-install provider-config ## E2E tests
GOBIN=$(go_bin) $(kuttl_bin) test ./test/e2e --config ./test/e2e/kuttl-test.yaml --suppress-log=Events
@rm -f kubeconfig
# kuttl leaves kubeconfig garbage: https://github.com/kudobuilder/kuttl/issues/297

run-single-e2e: export KUBECONFIG = $(KIND_KUBECONFIG)
run-single-e2e: $(kuttl_bin) $(mc_bin) local-install provider-config ## Run specific e2e test with `run-single-e2e test=$name`
GOBIN=$(go_bin) $(kuttl_bin) test ./test/e2e --config ./test/e2e/kuttl-test.yaml --suppress-log=Events --test $(test)
@rm -f kubeconfig

.PHONY: .e2e-test-clean
.e2e-test-clean: export KUBECONFIG = $(KIND_KUBECONFIG)
.e2e-test-clean:
@if [ -f $(KIND_KUBECONFIG) ]; then \
kubectl delete buckets --all; \
kubectl delete iamkeys --all; \
kubectl delete postgresql --all; \
kubectl delete mysql --all; \
kubectl delete redis --all; \
kubectl delete kafka --all; \
kubectl delete opensearch --all; \
else \
echo "no kubeconfig found"; \
fi
rm -f $(kuttl_bin) $(mc_bin)
13 changes: 13 additions & 0 deletions tests/e2e/mariadb/00-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNMariaDB
metadata:
name: mariadb-e2e-test
namespace: appcat-e2e
spec:
parameters:
service:
version: "11.2"
size:
plan: standard-2
writeConnectionSecretToRef:
name: mariadb-creds
38 changes: 38 additions & 0 deletions tests/e2e/mariadb/01-connect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: batch/v1
kind: Job
metadata:
name: connect-mariadb
namespace: appcat-e2e
spec:
backoffLimit: 5
template:
metadata:
labels:
e2e-test: mariadb
spec:
restartPolicy: Never
containers:
- name: connect
image: dockerhub.vshn.net/bitnami/mariadb:latest
imagePullPolicy: IfNotPresent
command:
- bash
args:
- -c
- echo "Testing Select...\n" && mysql -h $MYSQL_HOST -u $MYSQL_USER --password="$MYSQL_PASSWORD" -P $MYSQL_PORT $MYSQL_DB -c -e "select 1;"
env:
- name: SSL_MODE
value: VERIFY_CA
envFrom:
- secretRef:
name: e2e-test-mysql-details
volumeMounts:
- name: ca
mountPath: /.mysql
volumes:
- name: ca
secret:
secretName: e2e-test-mysql-details
items:
- key: ca.crt
path: root.crt

0 comments on commit eea652c

Please sign in to comment.