Skip to content

Commit 6b2d604

Browse files
authored
increase ci timeout (#244)
* increase ci timeout * add timeout to glue redshift test * change the condition
1 parent c5981fd commit 6b2d604

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

.github/workflows/makefile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ jobs:
4747
LOCALSTACK_API_KEY: ${{ secrets.TEST_LOCALSTACK_API_KEY }}
4848
DNS_ADDRESS: 127.0.0.1
4949
DEBUG: 1
50-
timeout-minutes: 50
50+
timeout-minutes: 200
5151
run: make test-ci-all

glue-redshift-crawler/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ logs:
2626
@localstack logs > logs.txt
2727

2828
test-ci:
29-
make start install ready run; return_code=`echo $$?`;\
29+
TIMEOUT_MINUTES=2 make start install ready; \
30+
return_code=`echo $$?`; \
31+
TIMEOUT_MINUTES=2 ./run.sh; \
3032
make logs; make stop; exit $$return_code;
3133

3234
.PHONY: usage install start run stop ready logs test-ci
33-

glue-redshift-crawler/run.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ GLUE_DATABASE_NAME="gluedb"
1111
GLUE_CONNECTION_NAME="glueconnection"
1212
GLUE_CRAWLER_NAME="gluecrawler"
1313

14+
# Read timeout from environment variable, default to no timeout if not set
15+
TIMEOUT_MINUTES=${TIMEOUT_MINUTES:-}
16+
TIMEOUT_SECONDS=$((TIMEOUT_MINUTES * 60))
17+
1418
# Tear-down function to cleanup on exit
1519
function cleanup() {
1620
echo ""
@@ -30,10 +34,19 @@ wait () {
3034
command=$1
3135
field=$2
3236
expected=$3
37+
start_time=$(date +%s)
3338
current=$($command | jq -r $field)
39+
3440
while [ "$current" != "$expected" ]; do
3541
sleep 5
36-
echo "Waiting for state change. Current: $current / Expected: $expected"
42+
elapsed_time=$(( $(date +%s) - start_time ))
43+
44+
if [ -n "$TIMEOUT_MINUTES" ] && [ $elapsed_time -ge $TIMEOUT_SECONDS ]; then
45+
echo "Timeout after $TIMEOUT_SECONDS seconds. Current: $current / Expected: $expected"
46+
exit 1
47+
fi
48+
49+
echo "Waiting for state change. Current: $current / Expected: $expected. Elapsed time: $elapsed_time seconds"
3750
current=$($command | jq -r $field)
3851
done
3952
}
@@ -67,4 +80,4 @@ wait "awslocal glue get-crawler --name $GLUE_CRAWLER_NAME" ".Crawler.State" "REA
6780
echo "Getting Glue table..."
6881
awslocal glue get-table --database-name $GLUE_DATABASE_NAME --name "${REDSHIFT_DATABASE_NAME}_${REDSHIFT_SCHEMA_NAME}_${REDSHIFT_TABLE_NAME}"
6982

70-
echo "Done."
83+
echo "Done."

0 commit comments

Comments
 (0)