Update GitHub Actions and fsnotify (#23) #67
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
name: E2E Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
logout: false | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Modify Dockerfile | |
run: | | |
sed -i -e "s|%VERSION%|latest|g" Dockerfile | |
- name: Build and push | |
id: docker_build_master | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/snorwin/haproxy:${{ github.sha }} | |
platforms: linux/amd64 | |
build-args: | | |
VERSION=test | |
HASH=${{ github.sha }} | |
test: | |
needs: image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create kind cluster | |
uses: helm/kind-action@v1.10.0 | |
- name: Install Helm chart for testing | |
run: | | |
kubectl cluster-info | |
helm install test test/helm/ --set image=ghcr.io/snorwin/haproxy:${{ github.sha }} | |
- name: Verify that client can connect to server using HAProxy | |
run: | | |
kubectl apply -f test/pod01.yaml | |
sleep 90 | |
if [ $(kubectl logs http-client-01 | grep "HTTP/1.0 200" | wc -l) -le 0 ]; then | |
exit 1 | |
fi | |
- name: Change HAProxy configuration (change timeout) | |
run: | | |
kubectl get cm haproxy-config -o yaml | sed 's/timeout client 10s/timeout client 15s/' | kubectl apply -f - | |
sleep 90 | |
- name: Verify that configuration was reloaded hitless | |
run: | | |
if [ $( kubectl logs haproxy | grep "reload successful" | wc -l) -ne 1 ]; then | |
exit 1 | |
fi | |
if [ $(kubectl logs http-client-01 | grep error | wc -l) -gt 0 ]; then | |
exit 1 | |
fi | |
- name: Change HAProxy configuration (invalid) | |
run: | | |
kubectl apply -f test/configmap-01.yaml | |
sleep 90 | |
- name: Verify that configuration was NOT reloaded | |
run: | | |
if [ $( kubectl logs haproxy | grep "reload failed" | wc -l) -ne 1 ]; then | |
exit 1 | |
fi | |
if [ $(kubectl logs http-client-01 | grep error | wc -l) -gt 0 ]; then | |
exit 1 | |
fi | |
- name: Change HAProxy configuration (add listen) | |
run: | | |
kubectl apply -f test/configmap-02.yaml | |
sleep 90 | |
- name: Verify that configuration was reloaded hitless | |
run: | | |
if [ $( kubectl logs haproxy | grep "reload successful" | wc -l) -ne 2 ]; then | |
exit 1 | |
fi | |
if [ $(kubectl logs http-client-01 | grep error | wc -l) -gt 0 ]; then | |
exit 1 | |
fi | |
- name: Verify that new client can connect to server using HAProxy | |
run: | | |
kubectl apply -f test/pod02.yaml | |
sleep 90 | |
if [ $(kubectl logs http-client-02 | grep "HTTP/1.0 200" | wc -l) -le 0 ]; then | |
exit 1 | |
fi |