Skip to content

Commit 3bbe20b

Browse files
committed
Fix CI integration test issues
- Fix GitHub Actions workflow to run tests from correct directory - Add robust process cleanup with trap handlers - Add port availability checking with wait_for_port function - Increase sleep times for better process startup reliability - Add netstat fallback for port checking in CI environments - Improve process management to prevent zombie processes
1 parent f6c6796 commit 3bbe20b

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ jobs:
7070
override: true
7171
- run: |
7272
pip install psycopg
73-
- run: ./tests-integration/test.sh
73+
- run: |
74+
cd tests-integration
75+
./test.sh
7476
7577
msrv:
7678
name: MSRV

tests-integration/test.sh

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22

33
set -e
44

5+
# Function to cleanup processes
6+
cleanup() {
7+
echo "🧹 Cleaning up processes..."
8+
for pid in $CSV_PID $TRANSACTION_PID $PARQUET_PID $RBAC_PID $SSL_PID; do
9+
if [ ! -z "$pid" ]; then
10+
kill -9 $pid 2>/dev/null || true
11+
fi
12+
done
13+
}
14+
15+
# Trap to cleanup on exit
16+
trap cleanup EXIT
17+
18+
# Function to wait for port to be available
19+
wait_for_port() {
20+
local port=$1
21+
local timeout=30
22+
local count=0
23+
24+
# Use netstat as fallback if lsof is not available
25+
while (lsof -Pi :$port -sTCP:LISTEN -t >/dev/null 2>&1) || (netstat -ln 2>/dev/null | grep ":$port " >/dev/null 2>&1); do
26+
if [ $count -ge $timeout ]; then
27+
echo "❌ Port $port still in use after ${timeout}s timeout"
28+
exit 1
29+
fi
30+
sleep 1
31+
count=$((count + 1))
32+
done
33+
}
34+
535
echo "🚀 Running DataFusion PostgreSQL Integration Tests"
636
echo "=================================================="
737

@@ -28,6 +58,7 @@ pip install -q psycopg
2858
echo ""
2959
echo "📊 Test 1: Enhanced CSV Data Loading & PostgreSQL Compatibility"
3060
echo "----------------------------------------------------------------"
61+
wait_for_port 5433
3162
../target/debug/datafusion-postgres-cli -p 5433 --csv delhi:delhiclimate.csv &
3263
CSV_PID=$!
3364
sleep 5
@@ -53,9 +84,10 @@ sleep 3
5384
echo ""
5485
echo "🔐 Test 2: Transaction Support"
5586
echo "------------------------------"
87+
wait_for_port 5433
5688
../target/debug/datafusion-postgres-cli -p 5433 --csv delhi:delhiclimate.csv &
5789
TRANSACTION_PID=$!
58-
sleep 3
90+
sleep 5
5991

6092
if python3 test_transactions.py; then
6193
echo "✅ Transaction test passed"
@@ -72,9 +104,10 @@ sleep 3
72104
echo ""
73105
echo "📦 Test 3: Enhanced Parquet Data Loading & Advanced Data Types"
74106
echo "--------------------------------------------------------------"
107+
wait_for_port 5434
75108
../target/debug/datafusion-postgres-cli -p 5434 --parquet all_types:all_types.parquet &
76109
PARQUET_PID=$!
77-
sleep 3
110+
sleep 5
78111

79112
if python3 test_parquet.py; then
80113
echo "✅ Enhanced Parquet test passed"
@@ -85,11 +118,13 @@ else
85118
fi
86119

87120
kill -9 $PARQUET_PID 2>/dev/null || true
121+
sleep 3
88122

89123
# Test 4: Role-Based Access Control
90124
echo ""
91125
echo "🔐 Test 4: Role-Based Access Control (RBAC)"
92126
echo "--------------------------------------------"
127+
wait_for_port 5435
93128
../target/debug/datafusion-postgres-cli -p 5435 --csv delhi:delhiclimate.csv &
94129
RBAC_PID=$!
95130
sleep 5
@@ -115,6 +150,7 @@ sleep 3
115150
echo ""
116151
echo "🔒 Test 5: SSL/TLS Security Features"
117152
echo "------------------------------------"
153+
wait_for_port 5436
118154
../target/debug/datafusion-postgres-cli -p 5436 --csv delhi:delhiclimate.csv &
119155
SSL_PID=$!
120156
sleep 5

0 commit comments

Comments
 (0)