Improve demo cluster start and stop handling #240
This file contains hidden or 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
| on: [ push ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-jepsen-test | |
| name: Jepsen Test | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| env: | |
| GOCACHE: /tmp/go-build | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Install netcat | |
| run: sudo apt-get update && sudo apt-get install -y netcat-openbsd | |
| - name: Install Leiningen | |
| run: | | |
| curl -L https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > ~/lein | |
| chmod +x ~/lein | |
| ~/lein version | |
| - name: Run Jepsen unit tests | |
| working-directory: jepsen | |
| run: ~/lein test | |
| - name: Launch demo cluster | |
| env: | |
| GOTMPDIR: /tmp/go-tmp | |
| run: | | |
| set -euo pipefail | |
| mkdir -p "$GOCACHE" "$GOTMPDIR" | |
| nohup go run cmd/server/demo.go > /tmp/elastickv-demo.log 2>&1 & | |
| echo $! > /tmp/elastickv-demo.pid | |
| echo "Waiting for redis listeners on 63791-63793..." | |
| for i in {1..45}; do | |
| if nc -z 127.0.0.1 63791 && nc -z 127.0.0.1 63792 && nc -z 127.0.0.1 63793; then | |
| echo "Cluster is up" | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| echo "Demo cluster failed to start; dumping log:" | |
| tail -n 200 /tmp/elastickv-demo.log || true | |
| exit 1 | |
| - name: Run Redis Jepsen workload against elastickv | |
| working-directory: jepsen | |
| run: | | |
| ~/lein run -m elastickv.redis-workload --time-limit 5 --rate 5 --concurrency 5 --ports 63791,63792,63793 --host 127.0.0.1 | |
| - name: Stop demo cluster | |
| run: | | |
| if [ -f /tmp/elastickv-demo.pid ]; then | |
| pid=$(cat /tmp/elastickv-demo.pid) | |
| kill "$pid" 2>/dev/null || true | |
| wait "$pid" 2>/dev/null || true | |
| fi |