-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nicolas Bigler <nicolas.bigler@vshn.ch>
- Loading branch information
Showing
10 changed files
with
193 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: E2E | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
test-e2e: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Get KUBECONFIG | ||
shell: bash | ||
env: | ||
LAB_KUBECONFIG: ${{ secrets.LAB_KUBECONFIG }} | ||
run: | | ||
echo "$LAB_KUBECONFIG" > kubeconfig | ||
- name: Run tests | ||
run: make e2e-test | ||
env: | ||
KUBECONFIG: kubeconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ SHELL := bash | |
|
||
include Makefile.vars.mk | ||
|
||
# testing | ||
include tests/tests.mk | ||
|
||
.PHONY: all | ||
all: help | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestSuite | ||
testDirs: | ||
- ./test/e2e/ | ||
namespace: appcat-e2e | ||
timeout: 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 600 | ||
--- | ||
apiVersion: vshn.appcat.vshn.io/v1 | ||
kind: VSHNMariaDB | ||
metadata: | ||
finalizers: | ||
- finalizer.apiextensions.crossplane.io | ||
name: mariadb-e2e-test | ||
namespace: appcat-e2e | ||
spec: | ||
compositeDeletePolicy: Background | ||
compositionRef: | ||
name: vshnmariadb.vshn.appcat.vshn.io | ||
compositionUpdatePolicy: Automatic | ||
parameters: | ||
backup: {} | ||
service: | ||
serviceLevel: besteffort | ||
version: "11.2" | ||
size: | ||
plan: standard-2 | ||
tls: | ||
authClients: true | ||
enabled: true | ||
resourceRef: | ||
apiVersion: vshn.appcat.vshn.io/v1 | ||
kind: XVSHNMariaDB | ||
writeConnectionSecretToRef: | ||
name: mariadb-e2e-test-creds | ||
status: | ||
conditions: | ||
- status: "True" | ||
type: Synced | ||
- reason: Available | ||
status: "True" | ||
type: Ready | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
type: connection.crossplane.io/v1alpha1 | ||
metadata: | ||
name: mariadb-e2e-test-creds | ||
namespace: appcat-e2e | ||
ownerReferences: | ||
- apiVersion: vshn.appcat.vshn.io/v1 | ||
kind: VSHNMariaDB | ||
name: mariadb-e2e-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: vshn.appcat.vshn.io/v1 | ||
kind: VSHNMariaDB | ||
metadata: | ||
name: mariadb-e2e-test | ||
namespace: appcat-e2e | ||
spec: | ||
parameters: | ||
size: | ||
plan: standard-2 | ||
writeConnectionSecretToRef: | ||
name: mariadb-e2e-test-creds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 240 | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: connect-mariadb | ||
namespace: appcat-e2e | ||
status: | ||
conditions: | ||
- type: Complete | ||
status: 'True' | ||
succeeded: 1 | ||
ready: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: connect-mariadb | ||
namespace: appcat-e2e | ||
spec: | ||
backoffLimit: 10 | ||
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" && mariadb -h $MARIADB_HOST -u $MARIADB_USERNAME --password="$MARIADB_PASSWORD" -P $MARIADB_PORT --ssl-verify-server-cert --ssl-ca=/etc/mariadb-tls/ca.crt -e "select 1;" | ||
envFrom: | ||
- secretRef: | ||
name: mariadb-e2e-test-creds | ||
volumeMounts: | ||
- name: mariadb-tls-secrets | ||
mountPath: /etc/mariadb-tls | ||
readOnly: true | ||
volumes: | ||
- name: mariadb-tls-secrets | ||
secret: | ||
secretName: mariadb-e2e-test-creds | ||
items: | ||
- key: ca.crt | ||
path: ca.crt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
delete: | ||
# This will wait until resources are really gone | ||
- apiVersion: batch/v1 | ||
kind: Job | ||
name: connect-mariadb | ||
namespace: appcat-e2e | ||
- apiVersion: v1 | ||
kind: Pod | ||
labels: | ||
e2e-test: mariadb | ||
namespace: appcat-e2e | ||
- apiVersion: vshn.appcat.vshn.io/v1 | ||
kind: VSHNMariaDB | ||
name: mariadb-e2e-test | ||
namespace: appcat-e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
### | ||
### E2E Tests | ||
### with KUTTL (https://kuttl.dev) | ||
### | ||
|
||
go_bin ?= $(PWD)/.work/bin | ||
$(go_bin): | ||
@mkdir -p $@ | ||
|
||
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 | ||
|
||
.PHONY: .e2e-test | ||
e2e-test: $(kuttl_bin) ## Run e2e tests | ||
GOBIN=$(go_bin) $(kuttl_bin) test ./tests/e2e --config ./tests/e2e/kuttl-test.yaml --suppress-log=Events | ||
@rm -f kubeconfig | ||
# kuttl leaves kubeconfig garbage: https://github.com/kudobuilder/kuttl/issues/297 | ||
|
||
.PHONY: .run-single-e2e | ||
run-single-e2e: | ||
GOBIN=$(go_bin) $(kuttl_bin) test ./tests/e2e --config ./tests/e2e/kuttl-test.yaml --suppress-log=Events --test $(test) | ||
@rm -f kubeconfig | ||
|
||
.PHONY: .e2e-test-clean | ||
.e2e-test-clean: | ||
@if [ -f $(KUBECONFIG) ]; then \ | ||
kubectl delete mariadb --all; \ | ||
kubectl delete jobs --all; \ | ||
kubectl delete pods --all; \ | ||
else \ | ||
echo "no kubeconfig found"; \ | ||
fi | ||
rm -f $(kuttl_bin) |