feat: PostgreSQL driver support
This commit is contained in:
1 parent
eb9bfabed5
commit
dc5d12348c
24 files changed
+1585
-75
No files matched your search
@@ -87,6 +87,46 @@ tasks:
|
||||
exit $STATUS
|
||||
silent: true
|
||||
|
||||
test:postgres:
|
||||
desc: Run the PostgreSQL tests against real servers (postgres:16 then postgres:17 in Docker, removed afterwards)
|
||||
cmds:
|
||||
- cmd: |
|
||||
PASSWORD=renewcms-test-postgres
|
||||
STATUS=0
|
||||
run_engine() {
|
||||
NAME="renewcms-test-postgres-$1"
|
||||
IMAGE="postgres:$1"
|
||||
docker rm -f "$NAME" >/dev/null 2>&1
|
||||
docker run -d --name "$NAME" -e POSTGRES_PASSWORD="$PASSWORD" -p 127.0.0.1::5432 "$IMAGE" >/dev/null || return 1
|
||||
MAPPING="$(docker port "$NAME" 5432/tcp | head -n 1)"
|
||||
PORT="${MAPPING##*:}"
|
||||
READY=no
|
||||
TRIES=0
|
||||
while [ "$TRIES" -lt 90 ]; do
|
||||
if docker exec "$NAME" pg_isready -h 127.0.0.1 -U postgres >/dev/null 2>&1 && docker exec "$NAME" psql -h 127.0.0.1 -U postgres -c 'SELECT 1' >/dev/null 2>&1; then
|
||||
READY=yes
|
||||
break
|
||||
fi
|
||||
TRIES=$((TRIES + 1))
|
||||
sleep 2
|
||||
done
|
||||
if [ "$READY" != yes ]; then
|
||||
echo "$IMAGE did not become ready" >&2
|
||||
docker logs "$NAME" 2>&1 | tail -n 20 >&2
|
||||
docker rm -f "$NAME" >/dev/null 2>&1
|
||||
return 1
|
||||
fi
|
||||
echo "== $IMAGE on 127.0.0.1:$PORT"
|
||||
RENEWCMS_TEST_POSTGRES_DSN="postgres://postgres:$PASSWORD@127.0.0.1:$PORT/postgres?sslmode=disable" go test -tags nofrontend ./test/... -run Postgres -count=1 {{.CLI_ARGS}}
|
||||
RESULT=$?
|
||||
docker rm -f "$NAME" >/dev/null 2>&1
|
||||
return $RESULT
|
||||
}
|
||||
run_engine 16 || STATUS=1
|
||||
run_engine 17 || STATUS=1
|
||||
exit $STATUS
|
||||
silent: true
|
||||
|
||||
test:s3:
|
||||
desc: Run the S3 storage integration test against a throwaway SeaweedFS in Docker (skipped when Docker is unavailable)
|
||||
cmds:
|
||||
|
||||
Reference in new issue
Block a user