reuse e2e scripts

This commit is contained in:
bakito 2022-10-07 07:32:20 +02:00
parent 662b177acf
commit f17f049f62
No known key found for this signature in database
GPG key ID: BCCEB081DB8A24D8
20 changed files with 50 additions and 43 deletions

View file

@ -86,28 +86,12 @@ jobs:
version: v0.14.0
kubectl_version: v1.24.0
- name: Install Helm Chart
run: |
helm install agh-e2e testdata/e2e/agh-e2e -n agh-e2e --create-namespace
kubectl config set-context --current --namespace=agh-e2e
run: ./testdata/e2e/bin/install-chart.sh
- name: Wait for sync to finish
run: kubectl wait --for=jsonpath='{.status.phase}'=Succeeded pod/adguardhome-sync --timeout=1m
run: ./testdata/e2e/bin/wait-for-sync.sh
- name: Show origin Logs
run: |
echo Pod adguardhome-origin logs
kubectl logs adguardhome-origin
run: ./testdata/e2e/bin/show-origin-logs.sh
- name: Show Replica Logs
run: |
for pod in $(kubectl get pods -l bakito.net/adguardhome-sync=replica -o name); do
echo Pod "${pod} logs"
kubectl logs ${pod}
ERRORS=$(kubectl logs ${pod} | grep '\[error\]' | wc -l)
echo "Found ${ERRORS} error(s) in log"
echo "----------------------------------------------"
done
run: ./testdata/e2e/bin/show-replica-logs.sh
- name: Show Sync Logs
run: |
echo Pod adguardhome-sync logs
kubectl logs adguardhome-sync
ERRORS=$(kubectl logs adguardhome-sync | grep Error | wc -l)
echo "Found ${ERRORS} error(s) in log";
if [[ "${ERRORS}" != "0" ]]; then exit 1; fi
run: ./testdata/e2e/bin/show-sync-logs.sh

View file

@ -64,5 +64,4 @@ kind-create:
kind create cluster
kind-test:
helm delete agh-e2e -n agh-e2e
helm install agh-e2e testdata/e2e/agh-e2e -n agh-e2e --create-namespace
@./testdata/e2e/bin/install-chart.sh

9
testdata/e2e/bin/install-chart.sh vendored Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
set -e
kubectl config set-context --current --namespace=agh-e2e
if [[ $(helm list --no-headers -n agh-e2e | grep agh-e2e | wc -l) == "1" ]]; then
helm delete agh-e2e -n agh-e2e --wait
fi
helm install agh-e2e testdata/e2e -n agh-e2e --create-namespace

5
testdata/e2e/bin/show-origin-logs.sh vendored Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash
set -e
echo Pod adguardhome-origin logs
kubectl logs adguardhome-origin

10
testdata/e2e/bin/show-replica-logs.sh vendored Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
set -e
for pod in $(kubectl get pods -l bakito.net/adguardhome-sync=replica -o name); do
echo Pod "${pod} logs"
kubectl logs ${pod}
ERRORS=$(kubectl logs ${pod} | grep '\[error\]' | wc -l)
echo "Found ${ERRORS} error(s) in log"
echo "----------------------------------------------"
done

8
testdata/e2e/bin/show-sync-logs.sh vendored Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
set -e
echo Pod adguardhome-sync logs
kubectl logs adguardhome-sync
ERRORS=$(kubectl logs adguardhome-sync | grep Error | wc -l)
echo "Found ${ERRORS} error(s) in log";
if [[ "${ERRORS}" != "0" ]]; then exit 1; fi

7
testdata/e2e/bin/wait-for-agh-pods.sh vendored Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
set -e
echo "wait for adguardhome pods"
for pod in $(kubectl get pods -l bakito.net/adguardhome-sync -o name); do
kubectl wait --for condition=Ready ${pod} --timeout=30s
done

4
testdata/e2e/bin/wait-for-sync.sh vendored Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
set -e
kubectl wait --for=jsonpath='{.status.phase}'=Succeeded pod/adguardhome-sync --timeout=1m

View file

@ -1,15 +0,0 @@
apiVersion: v1
kind: Pod
metadata:
name: adguardhome-sync
spec:
containers:
- name: adguardhome-sync
image: ghcr.io/bakito/adguardhome-sync:main
command:
- /opt/go/adguardhome-sync
- run
envFrom:
- configMapRef:
name: sync-conf
restartPolicy: Never

View file

@ -12,11 +12,7 @@ spec:
- /bin/bash
- -c
- |
#!/bin/bash
echo "wait for adguardhome pods"
for pod in $(kubectl get pods -l bakito.net/adguardhome-sync -o name); do
kubectl wait --for condition=Ready ${pod} --timeout=30s
done
{{- .Files.Get "bin/wait-for-agh-pods.sh" | nindent 10}}
containers:
- name: adguardhome-sync
image: ghcr.io/bakito/adguardhome-sync:main