Skip to content

add log timestamp

add log timestamp #36

Workflow file for this run

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@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
- 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@v2
- name: Create kind cluster
uses: helm/[email protected]
- 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