Skip to content

Commit e64fe3a

Browse files
committed
ci: improve test stability with extended timeouts and better error handling
- Increase test timeout from 30m to 60m in GNUmakefile - Add 90-minute job timeouts to GitHub Actions workflow - Improve CloudStack simulator readiness check with better logging - Add retry logic for data center deployment (3 attempts) - Add detailed error reporting for failed simulator startup This addresses the frequent CI timeouts around 27-29 minutes by: 1. Giving tests more time to complete (60m vs 30m) 2. Allowing jobs to run longer (90m vs default 6h) 3. Better debugging info when simulator fails to start 4. Retry mechanism for transient deployment failures
1 parent d95c5a6 commit e64fe3a

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

.github/actions/setup-cloudstack/action.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,30 @@ runs:
4343
run: |
4444
echo "Starting Cloudstack health check"
4545
T=0
46-
until [ $T -gt 40 ] || curl -sfL http://localhost:8080 --output /dev/null
46+
MAX_WAIT=40
47+
SLEEP_INTERVAL=30
48+
49+
echo "Will wait up to $((MAX_WAIT * SLEEP_INTERVAL / 60)) minutes for CloudStack to be ready"
50+
51+
until [ $T -gt $MAX_WAIT ] || curl -sfL http://localhost:8080 --output /dev/null
4752
do
48-
echo "Waiting for Cloudstack to be ready..."
53+
echo "Waiting for Cloudstack to be ready... (attempt $((T+1))/$((MAX_WAIT+1)), elapsed: $((T * SLEEP_INTERVAL / 60))m $((T * SLEEP_INTERVAL % 60))s)"
4954
((T+=1))
50-
sleep 30
55+
sleep $SLEEP_INTERVAL
5156
done
5257
5358
# After loop, check if Cloudstack is up
5459
if ! curl -sfSL http://localhost:8080 --output /dev/null; then
55-
echo "Cloudstack did not become ready in time"
60+
echo "Cloudstack did not become ready in time after $((MAX_WAIT * SLEEP_INTERVAL / 60)) minutes"
61+
echo "Checking CloudStack container status:"
62+
docker ps -a | grep cloudstack || echo "No CloudStack containers found"
63+
echo "Checking CloudStack logs:"
64+
docker logs $(docker ps -q --filter "ancestor=apache/cloudstack-simulator") --tail 50 || echo "Could not retrieve logs"
65+
echo "Testing connectivity:"
5666
curl -v http://localhost:8080 || true
5767
exit 22
68+
else
69+
echo "CloudStack is ready after $((T * SLEEP_INTERVAL / 60))m $((T * SLEEP_INTERVAL % 60))s"
5870
fi
5971
- name: Setting up Cloudstack
6072
id: setup-cloudstack
@@ -64,8 +76,23 @@ runs:
6476
set -euo pipefail
6577
6678
echo "Deploying Data Center..."
67-
docker exec $(docker container ls --format=json -l | jq -r .ID) \
68-
python /root/tools/marvin/marvin/deployDataCenter.py -i /root/setup/dev/advanced.cfg
79+
# Retry data center deployment up to 3 times
80+
for attempt in 1 2 3; do
81+
echo "Data center deployment attempt $attempt/3"
82+
if docker exec $(docker container ls --format=json -l | jq -r .ID) \
83+
python /root/tools/marvin/marvin/deployDataCenter.py -i /root/setup/dev/advanced.cfg; then
84+
echo "Data center deployment successful on attempt $attempt"
85+
break
86+
else
87+
echo "Data center deployment failed on attempt $attempt"
88+
if [ $attempt -eq 3 ]; then
89+
echo "All data center deployment attempts failed"
90+
exit 1
91+
fi
92+
echo "Waiting 30 seconds before retry..."
93+
sleep 30
94+
fi
95+
done
6996
7097
# Get the container ID of the running simulator
7198
CONTAINER_ID=$(docker ps --filter "ancestor=apache/cloudstack-simulator:${{ matrix.cloudstack-version }}" --format "{{.ID}}" | head -n1)

.github/workflows/acceptance.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
name: Terraform ${{ matrix.terraform-version }} with Cloudstack ${{ matrix.cloudstack-version }}
4848
needs: [prepare-matrix]
4949
runs-on: ubuntu-latest
50+
timeout-minutes: 90
5051
steps:
5152
- uses: actions/checkout@v4
5253
- name: Set up Go
@@ -86,6 +87,7 @@ jobs:
8687
name: OpenTofu ${{ matrix.opentofu-version }} with Cloudstack ${{ matrix.cloudstack-version }}
8788
needs: [prepare-matrix]
8889
runs-on: ubuntu-latest
90+
timeout-minutes: 90
8991
steps:
9092
- uses: actions/checkout@v4
9193
- name: Set up Go

GNUmakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test: fmtcheck
3131
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
3232

3333
testacc: fmtcheck
34-
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 30m
34+
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 60m
3535

3636
vet:
3737
@echo "go vet ."

0 commit comments

Comments
 (0)