@@ -55,8 +55,7 @@ buildvariants:
5555 tasks :
5656 - name : " build"
5757 - name : " test-unit"
58- # SQL-2248: Fix integration test hang
59- # - name: "test-integration"
58+ - name : " test-integration"
6059
6160 - name : release
6261 display_name : " Release"
@@ -361,9 +360,55 @@ functions:
361360 ${PREPARE_SHELL}
362361 ./resources/run_adf.sh start &&
363362 ./gradlew -Dorg.gradle.java.home=${JAVA_HOME} runDataLoader &&
364- ./gradlew -Dorg.gradle.java.home=${JAVA_HOME} clean integrationTest -x test
365- EXITCODE=$?
363+ ./gradlew -Dorg.gradle.java.home=${JAVA_HOME} clean integrationTest \
364+ -x test > gradle_output.log 2>&1 &
365+ GRADLE_PID=$!
366+
367+ echo "Gradle process started with PID $GRADLE_PID"
368+
369+ # On Amazon Linux 2 hosts, the gradlew integrationTest command was hanging indefinitely.
370+ # This monitoring approach will detect build completion or failure even when the Gradle
371+ # process doesn't terminate properly and allows the task to complete.
372+ SECONDS=0
373+ TIMEOUT=1800 # 30 minute timeout
374+
375+ while true; do
376+ if grep -q "BUILD SUCCESSFUL" gradle_output.log; then
377+ echo "Build successful!"
378+ EXITCODE=0
379+ break
380+ fi
381+
382+ if grep -q "BUILD FAILED" gradle_output.log; then
383+ echo "Build failed!"
384+ EXITCODE=1
385+ break
386+ fi
387+
388+ if (( SECONDS > TIMEOUT )); then
389+ echo "$TIMEOUT second timeout reached. Exiting with failure."
390+ EXITCODE=1
391+ break
392+ fi
393+
394+ # Check if Gradle process is still running
395+ if ! kill -0 $GRADLE_PID 2>/dev/null; then
396+ echo "Gradle process has finished."
397+ wait $GRADLE_PID
398+ EXITCODE=$?
399+ break
400+ fi
401+
402+ sleep 5
403+ done
404+
405+ cat gradle_output.log
406+
407+ kill $GRADLE_PID 2>/dev/null || true
408+
366409 ./resources/run_adf.sh stop
410+
411+ echo "Integration test exit code: $EXITCODE"
367412 exit $EXITCODE
368413
369414 " trace artifacts " :
0 commit comments