Skip to content

Commit 19f7a62

Browse files
author
Mohit Joshi
committed
Writing a new wrapper framework for executing pg_tde testcases on Jenkins
1 parent c7f348c commit 19f7a62

15 files changed

+2345
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# Configuration
4+
INSTALL_DIR="/home/mohit.joshi/postgresql/pg_tde/bld_18.0.1/install"
5+
PRIMARY_PORT="5432"
6+
REPLICA_PORT="5433"
7+
DB_NAME="sbtest"
8+
9+
# Track mismatch status
10+
MISMATCH_FOUND=0
11+
12+
echo "🔍 Checking row counts for tables ddl_test_1 to ddl_test_500..."
13+
14+
# Loop through table names from ddl_test_1 to ddl_test_500
15+
for i in $(seq 1 500); do
16+
TABLE="ddl_test_$i"
17+
18+
# Get row count from Primary
19+
PRIMARY_COUNT=$($INSTALL_DIR/bin/psql -p $PRIMARY_PORT -d $DB_NAME -t -c \
20+
"SELECT COUNT(*) FROM $TABLE;" | tr -d '[:space:]')
21+
22+
# Get row count from Replica
23+
REPLICA_COUNT=$($INSTALL_DIR/bin/psql -p $REPLICA_PORT -d $DB_NAME -t -c \
24+
"SELECT COUNT(*) FROM $TABLE;" | tr -d '[:space:]')
25+
26+
# Compare counts
27+
if [[ "$PRIMARY_COUNT" -ne "$REPLICA_COUNT" ]]; then
28+
echo "❌ Mismatch in table '$TABLE': Primary=$PRIMARY_COUNT, Replica=$REPLICA_COUNT"
29+
MISMATCH_FOUND=1
30+
else
31+
echo "✅ Table '$TABLE' matches: $PRIMARY_COUNT rows"
32+
fi
33+
done
34+
35+
# Exit with error if any mismatch is found
36+
if [[ "$MISMATCH_FOUND" -eq 1 ]]; then
37+
echo "🚨 Row count mismatch detected in one or more tables!"
38+
exit 1
39+
else
40+
echo "🎉 All tables match perfectly!"
41+
exit 0
42+
fi
43+

0 commit comments

Comments
 (0)