move e2e test in regular build (#136)
* move e2e test in regular build * write to summary
This commit is contained in:
51
.github/workflows/e2e.yaml
vendored
Normal file
51
.github/workflows/e2e.yaml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: e2e tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
e2e:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Helm
|
||||
run: |
|
||||
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
|
||||
- name: Set up Registry Container
|
||||
run: |
|
||||
docker run -d --restart=always -p "127.0.0.1:5001:5000" --name kind-registry registry:2
|
||||
|
||||
- name: Build image
|
||||
run: ./testdata/e2e/bin/build-image.sh
|
||||
|
||||
- name: Create kind cluster
|
||||
uses: helm/kind-action@v1.5.0
|
||||
with:
|
||||
version: v0.17.0
|
||||
kubectl_version: v1.25.3
|
||||
config: testdata/e2e/kind/config.yaml
|
||||
- name: Set up Local Registry
|
||||
run: |
|
||||
# https://kind.sigs.k8s.io/docs/user/local-registry/
|
||||
docker network connect kind kind-registry
|
||||
kubectl apply -f testdata/e2e/kind/configmap-registry.yaml
|
||||
# image registry: localhost:5001/
|
||||
|
||||
- name: Install Helm Chart
|
||||
run: ./testdata/e2e/bin/install-chart.sh
|
||||
- name: Wait for sync to finish
|
||||
run: ./testdata/e2e/bin/wait-for-sync.sh
|
||||
- name: Show origin Logs
|
||||
run: ./testdata/e2e/bin/show-origin-logs.sh
|
||||
- name: Show Replica Logs
|
||||
run: ./testdata/e2e/bin/show-replica-logs.sh
|
||||
- name: Show Sync Logs
|
||||
run: ./testdata/e2e/bin/show-sync-logs.sh
|
||||
22
.github/workflows/publish.yml
vendored
22
.github/workflows/publish.yml
vendored
@@ -73,24 +73,4 @@ jobs:
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
test:
|
||||
needs: images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Create kind cluster
|
||||
uses: helm/kind-action@v1.5.0
|
||||
with:
|
||||
version: v0.17.0
|
||||
kubectl_version: v1.25.3
|
||||
- name: Install Helm Chart
|
||||
run: ./testdata/e2e/bin/install-chart.sh
|
||||
- name: Wait for sync to finish
|
||||
run: ./testdata/e2e/bin/wait-for-sync.sh
|
||||
- name: Show origin Logs
|
||||
run: ./testdata/e2e/bin/show-origin-logs.sh
|
||||
- name: Show Replica Logs
|
||||
run: ./testdata/e2e/bin/show-replica-logs.sh
|
||||
- name: Show Sync Logs
|
||||
run: ./testdata/e2e/bin/show-sync-logs.sh
|
||||
|
||||
|
||||
4
testdata/e2e/bin/build-image.sh
vendored
Executable file
4
testdata/e2e/bin/build-image.sh
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
docker build -f Dockerfile --build-arg VERSION=e2e-tests -t localhost:5001/adguardhome-sync:e2e .
|
||||
docker push localhost:5001/adguardhome-sync:e2e
|
||||
6
testdata/e2e/bin/show-origin-logs.sh
vendored
6
testdata/e2e/bin/show-origin-logs.sh
vendored
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo Pod adguardhome-origin logs
|
||||
kubectl logs adguardhome-origin
|
||||
echo "## Pod adguardhome-origin logs" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
kubectl logs adguardhome-origin >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
18
testdata/e2e/bin/show-replica-logs.sh
vendored
18
testdata/e2e/bin/show-replica-logs.sh
vendored
@@ -2,9 +2,17 @@
|
||||
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 "----------------------------------------------"
|
||||
echo "## Pod ${pod} logs" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
LOGS=$(kubectl logs ${pod})
|
||||
# ignore certain errors
|
||||
LOGS=$(echo -e "${LOGS}" | grep -v -e "error.* deleting filter .* no such file or directory" )
|
||||
# https://github.com/AdguardTeam/AdGuardHome/issues/4944
|
||||
LOGS=$(echo -e "${LOGS}" | grep -v -e "error.* creating dhcpv4 srv")
|
||||
echo -e "${LOGS}" >> $GITHUB_STEP_SUMMARY
|
||||
ERRORS=$(echo -e "${LOGS}"} | grep '\[error\]' | wc -l)
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
echo "Found ${ERRORS} error(s) in ${pod} log" >> $GITHUB_STEP_SUMMARY
|
||||
echo "----------------------------------------------" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
done
|
||||
|
||||
8
testdata/e2e/bin/show-sync-logs.sh
vendored
8
testdata/e2e/bin/show-sync-logs.sh
vendored
@@ -1,8 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo Pod adguardhome-sync logs
|
||||
kubectl logs adguardhome-sync
|
||||
echo "## Pod adguardhome-sync logs" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
kubectl logs adguardhome-sync >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
ERRORS=$(kubectl logs adguardhome-sync | grep Error | wc -l)
|
||||
echo "Found ${ERRORS} error(s) in log";
|
||||
echo "Found ${ERRORS} error(s) in adguardhome-sync log"; >> $GITHUB_STEP_SUMMARY
|
||||
if [[ "${ERRORS}" != "0" ]]; then exit 1; fi
|
||||
|
||||
21
testdata/e2e/kind/config.yaml
vendored
Normal file
21
testdata/e2e/kind/config.yaml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
kind: Cluster
|
||||
apiVersion: kind.x-k8s.io/v1alpha4
|
||||
nodes:
|
||||
- role: control-plane
|
||||
kubeadmConfigPatches:
|
||||
- |
|
||||
kind: InitConfiguration
|
||||
nodeRegistration:
|
||||
kubeletExtraArgs:
|
||||
node-labels: "ingress-ready=true"
|
||||
extraPortMappings:
|
||||
- containerPort: 80
|
||||
hostPort: 80
|
||||
protocol: TCP
|
||||
- containerPort: 443
|
||||
hostPort: 443
|
||||
protocol: TCP
|
||||
containerdConfigPatches:
|
||||
- |-
|
||||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5001"]
|
||||
endpoint = ["http://kind-registry:5000"]
|
||||
9
testdata/e2e/kind/configmap-registry.yaml
vendored
Normal file
9
testdata/e2e/kind/configmap-registry.yaml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: local-registry-hosting
|
||||
namespace: kube-public
|
||||
data:
|
||||
localRegistryHosting.v1: |
|
||||
host: "localhost:5001"
|
||||
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
|
||||
4
testdata/e2e/templates/configmap-sync.yaml
vendored
4
testdata/e2e/templates/configmap-sync.yaml
vendored
@@ -9,9 +9,9 @@ data:
|
||||
ORIGIN_URL: http://service-origin.{{ $.Release.Namespace }}.svc.cluster.local:3000
|
||||
ORIGIN_PASSWORD: password
|
||||
ORIGIN_USERNAME: username
|
||||
{{ range $i,$_ := .Values.replica.versions }}
|
||||
{{ range $i,$version := .Values.replica.versions }}
|
||||
REPLICA{{ $i }}_AUTOSETUP: "true"
|
||||
REPLICA{{ $i }}_URL: http://service-replica-{{ $i }}.{{ $.Release.Namespace }}.svc.cluster.local:3000
|
||||
REPLICA{{ $i }}_URL: http://service-replica-{{ $version | toString | replace "." "-" }}.{{ $.Release.Namespace }}.svc.cluster.local:3000
|
||||
REPLICA{{ $i }}_PASSWORD: password
|
||||
REPLICA{{ $i }}_USERNAME: username
|
||||
{{- end }}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{{ range $i, $version := .Values.replica.versions }}
|
||||
{{ range $_, $version := .Values.replica.versions }}
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: adguardhome-replica-{{ $i }}
|
||||
name: adguardhome-replica-{{ $version | toString | replace "." "-" }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: adguardhome-replica-{{ $i }}
|
||||
app.kubernetes.io/name: adguardhome-replica-{{ $version | toString | replace "." "-" }}
|
||||
bakito.net/adguardhome-sync: replica
|
||||
spec:
|
||||
containers:
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
{{- .Files.Get "bin/wait-for-agh-pods.sh" | nindent 10}}
|
||||
containers:
|
||||
- name: adguardhome-sync
|
||||
image: ghcr.io/bakito/adguardhome-sync:main
|
||||
image: localhost:5001/adguardhome-sync:e2e
|
||||
command:
|
||||
- /opt/go/adguardhome-sync
|
||||
- run
|
||||
|
||||
6
testdata/e2e/templates/service-replica.yaml
vendored
6
testdata/e2e/templates/service-replica.yaml
vendored
@@ -1,11 +1,11 @@
|
||||
{{ range $i ,$_ := .Values.replica.versions }}
|
||||
{{ range $i ,$version := .Values.replica.versions }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: service-replica-{{ $i }}
|
||||
name: service-replica-{{ $version | toString | replace "." "-" }}
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: adguardhome-replica-{{ $i }}
|
||||
app.kubernetes.io/name: adguardhome-replica-{{ $version | toString | replace "." "-" }}
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3000
|
||||
|
||||
Reference in New Issue
Block a user