ci: Fix service container networking in native engine tests
Some checks failed
CI/CD / Test (push) Successful in 1m16s
CI/CD / Lint (push) Successful in 1m13s
CI/CD / Integration Tests (push) Failing after 52s
CI/CD / Native Engine Tests (push) Failing after 2m50s
CI/CD / Build & Release (push) Has been skipped

- Remove port mappings that don't work in containerized jobs
- Add health checks for service containers with proper timeout/retry logic
- Use service hostnames (postgres-native, mysql-native) instead of localhost
- Add comprehensive debugging output for network troubleshooting
- Revert to standard PostgreSQL (5432) and MySQL (3306) ports
- Add POSTGRES_USER env var for explicit user configuration
- Services now accessible by hostname within the container network
This commit is contained in:
2026-01-30 21:42:39 +01:00
parent e880b5c8b2
commit c7d878a121

View File

@ -200,13 +200,22 @@ jobs:
env:
POSTGRES_PASSWORD: nativetest
POSTGRES_DB: nativedb
ports: ['5433:5432']
POSTGRES_USER: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql-native:
image: mysql:5.7 # Better compatibility with Go driver
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: nativetest
MYSQL_DATABASE: nativedb
ports: ['3307:3306']
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
env:
@ -221,13 +230,30 @@ jobs:
- name: Wait for databases
run: |
echo "Waiting for PostgreSQL on localhost:5433..."
echo "=== Debugging network and services ==="
hostname -I || true
netstat -tlnp || true
nslookup postgres-native || true
nslookup mysql-native || true
echo "=== Waiting for PostgreSQL service ==="
for i in $(seq 1 60); do
pg_isready -h localhost -p 5433 && break || sleep 2
if pg_isready -h postgres-native -p 5432; then
echo "PostgreSQL is ready!"
break
fi
echo "Attempt $i: PostgreSQL not ready, waiting..."
sleep 2
done
echo "Waiting for MySQL on localhost:3307..."
echo "=== Waiting for MySQL service ==="
for i in $(seq 1 60); do
mysqladmin ping -h localhost -P 3307 -u root -pnativetest --silent && break || sleep 2
if mysqladmin ping -h mysql-native -u root -pnativetest --silent; then
echo "MySQL is ready!"
break
fi
echo "Attempt $i: MySQL not ready, waiting..."
sleep 2
done
- name: Build dbbackup for native testing
@ -238,7 +264,7 @@ jobs:
PGPASSWORD: nativetest
run: |
echo "=== Setting up PostgreSQL test data ==="
psql -h localhost -p 5433 -U postgres -d nativedb -c "
psql -h postgres-native -p 5432 -U postgres -d nativedb -c "
CREATE TABLE native_test_users (
id SERIAL PRIMARY KEY,
username VARCHAR(50) NOT NULL,
@ -265,8 +291,8 @@ jobs:
mkdir -p /tmp/pg-native-test
./dbbackup-native backup single nativedb \
--db-type postgres \
--host localhost \
--port 5433 \
--host postgres-native \
--port 5432 \
--user postgres \
--backup-dir /tmp/pg-native-test \
--native \
@ -300,7 +326,7 @@ jobs:
MYSQL_PWD: nativetest
run: |
echo "=== Setting up MySQL test data ==="
mysql -h localhost -P 3307 -u root -pnativetest nativedb -e "
mysql -h mysql-native -P 3306 -u root -pnativetest nativedb -e "
CREATE TABLE native_test_orders (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_name VARCHAR(100) NOT NULL,
@ -326,8 +352,8 @@ jobs:
mkdir -p /tmp/mysql-native-test
MYSQL_PWD=nativetest ./dbbackup-native backup single nativedb \
--db-type mysql \
--host localhost \
--port 3307 \
--host mysql-native \
--port 3306 \
--user root \
--backup-dir /tmp/mysql-native-test \
--native \