mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-04-24 11:18:35 -05:00
chore: simplify ruby e2e ci scripts (#3152)
* chore: simplify start script * chore: log * fix: log paths * fix: race? * fix: deadlock? --------- Co-authored-by: mrkaye97 <mrkaye97@gmail.com>
This commit is contained in:
@@ -4,10 +4,6 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/**"
|
||||
- "api/**"
|
||||
- "api-contracts/**"
|
||||
- "internal/**"
|
||||
- "pkg/**"
|
||||
- "sdks/ruby/**"
|
||||
push:
|
||||
branches:
|
||||
@@ -135,21 +131,72 @@ jobs:
|
||||
bundler-cache: true
|
||||
working-directory: ./sdks/ruby/examples
|
||||
|
||||
- name: Start example worker
|
||||
working-directory: ./sdks/ruby/examples
|
||||
run: bundle exec ruby worker.rb > worker.log 2>&1 &
|
||||
|
||||
- name: Wait for worker health
|
||||
- name: Wait for API readiness
|
||||
working-directory: .
|
||||
run: |
|
||||
for i in $(seq 1 30); do
|
||||
if curl -s http://localhost:8001/health > /dev/null 2>&1; then
|
||||
echo "Worker is healthy after ${i}s"
|
||||
exit 0
|
||||
echo "Waiting for API at http://localhost:8080/api/ready..."
|
||||
for i in $(seq 1 60); do
|
||||
if curl -sf http://localhost:8080/api/ready > /dev/null 2>&1; then
|
||||
echo "API ready after ${i}s"
|
||||
break
|
||||
fi
|
||||
if [ "$i" -eq 60 ]; then
|
||||
echo "API did not become ready within 60s"
|
||||
tail -n 50 engine.log 2>/dev/null || true
|
||||
tail -n 50 api.log 2>/dev/null || true
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "Worker failed to start within 30s"
|
||||
cat ./sdks/ruby/examples/worker.log || true
|
||||
sleep 5
|
||||
|
||||
- name: Start example worker and wait for health
|
||||
working-directory: ./sdks/ruby/examples
|
||||
run: |
|
||||
export HATCHET_CLIENT_WORKER_HEALTHCHECK_PORT=8001
|
||||
stdbuf -o0 -e0 bundle exec ruby worker.rb > worker.log 2>&1 &
|
||||
WORKER_PID=$!
|
||||
echo "Worker started with PID $WORKER_PID"
|
||||
|
||||
MAX_WAIT=45
|
||||
POLL_INTERVAL=1
|
||||
echo "Waiting 5s for worker to initialize..."
|
||||
sleep 5
|
||||
|
||||
for i in $(seq 1 $MAX_WAIT); do
|
||||
if ! kill -0 "$WORKER_PID" 2>/dev/null; then
|
||||
echo "Worker process (PID $WORKER_PID) exited before becoming healthy"
|
||||
echo "=== worker.log ==="
|
||||
cat worker.log || true
|
||||
echo "=== tail engine.log ==="
|
||||
tail -n 80 "$GITHUB_WORKSPACE/engine.log" 2>/dev/null || true
|
||||
echo "=== tail api.log ==="
|
||||
tail -n 80 "$GITHUB_WORKSPACE/api.log" 2>/dev/null || true
|
||||
exit 1
|
||||
fi
|
||||
if curl -sf http://localhost:8001/health > /dev/null 2>&1; then
|
||||
echo "Worker is healthy after ${i}s"
|
||||
exit 0
|
||||
fi
|
||||
if [ $((i % 5)) -eq 0 ]; then
|
||||
echo "Still waiting for worker health... ${i}s/${MAX_WAIT}s"
|
||||
echo "--- worker.log (last 25 lines) ---"
|
||||
tail -n 25 worker.log 2>/dev/null || true
|
||||
echo "--- engine.log (last 25 lines) ---"
|
||||
tail -n 25 "$GITHUB_WORKSPACE/engine.log" 2>/dev/null || true
|
||||
echo "--- api.log (last 25 lines) ---"
|
||||
tail -n 25 "$GITHUB_WORKSPACE/api.log" 2>/dev/null || true
|
||||
fi
|
||||
sleep $POLL_INTERVAL
|
||||
done
|
||||
|
||||
echo "Worker failed to become healthy within ${MAX_WAIT}s"
|
||||
echo "=== worker.log ==="
|
||||
cat worker.log || true
|
||||
echo "=== tail engine.log ==="
|
||||
tail -n 80 "$GITHUB_WORKSPACE/engine.log" 2>/dev/null || true
|
||||
echo "=== tail api.log ==="
|
||||
tail -n 80 "$GITHUB_WORKSPACE/api.log" 2>/dev/null || true
|
||||
exit 1
|
||||
|
||||
- name: Run e2e tests
|
||||
|
||||
Reference in New Issue
Block a user