Update the docker compose file (#7524)

* Update the docker compose file to make /Tests/tests_all.sh can run successfully.

* Create database gorm in the compose file.

* Fix connection failure to local GaussDB instance (127.0.0.1:9950) that resulted in
"unexpected EOF" errors during initialization in tests.
This commit is contained in:
moseszane168 2025-08-04 12:07:30 +08:00 committed by GitHub
parent eb90a02a07
commit 6cc2c01268
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,3 +30,37 @@ services:
ports:
- "127.0.0.1:9940:4000"
command: /tidb-server -store unistore -path "" -lease 0s > tidb.log 2>&1 &
gaussdb:
image: 'opengauss/opengauss:7.0.0-RC1.B023'
hostname: opengauss-server
ports:
- "127.0.0.1:9950:5432"
environment:
- TZ=Asia/Shanghai
- GS_PASSWORD=Gaussdb@123
- GS_CLUSTER_NAME=opengauss_cluster
- PGDATA=/var/lib/opengauss/data
entrypoint: ""
command: |-
/bin/sh -c 'set -euo pipefail;
/usr/local/bin/entrypoint.sh gaussdb &
counter=1;
while [ "$$counter" -le 20 ]; do
if su - omm -c "gsql -U omm -d postgres -c \"SELECT 1;\""; then
echo "Creating database gorm...";
su - omm -c "gsql -U omm -d postgres -c \"CREATE DATABASE gorm DBCOMPATIBILITY '\'PG\'';\"";
echo "Database initialized successfully";
break;
fi;
echo "Waiting for database to be ready... ($$counter/12)";
sleep 5;
counter=$$(($$counter + 1));
done;
# timeout handling
if [ $$counter -gt 20 ]; then
echo "Error: Database failed to start within timeout";
exit 1;
fi;
# keep the container running: wait for the database process in the foreground
wait
'