-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import ydb.tests.postgres_integrations.library | ||
import pytest | ||
|
||
|
||
def pytest_collection_finish(session: pytest.Session): | ||
ydb.tests.postgres_integrations.library.pytest_collection_finish(session) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/exchange/ | ||
/sources/ | ||
/test-result/ |
28 changes: 28 additions & 0 deletions
28
ydb/tests/postgres_integrations/go-libpq/data/common-go-scripts/go-run-separate-tests.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
ONE_TEST_TIMEOUT=5s | ||
TEST_BINARY=./test.binary | ||
|
||
echo "Get test list" | ||
TESTS=$($TEST_BINARY --test.list "^Test" | sort) | ||
|
||
|
||
echo "Shell $SHELL" | ||
|
||
rm -f /test-result/raw/result.txt | ||
for TEST_NAME in $TESTS; do | ||
echo -n "Test: $TEST_NAME " | ||
if echo "$TEST_NAME" | grep -Eq "$YDB_PG_TESTFILTER"; then | ||
echo start | ||
else | ||
echo skip | ||
continue | ||
fi | ||
CMD="$TEST_BINARY --test.run '^$TEST_NAME\$' --test.v --test.timeout='$ONE_TEST_TIMEOUT'" | ||
echo "$CMD" | ||
bash -c "$CMD" >> /test-result/raw/result.txt 2>&1 || true | ||
done | ||
|
||
go-junit-report < /test-result/raw/result.txt > /test-result/raw/result.xml |
22 changes: 22 additions & 0 deletions
22
ydb/tests/postgres_integrations/go-libpq/data/docker-compose-host.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: "3" | ||
services: | ||
project: | ||
network_mode: host | ||
|
||
image: ydb-test/go-pqlib | ||
build: | ||
context: ../../.. | ||
dockerfile: languages/go/libpq/Dockerfile | ||
network: host | ||
environment: | ||
- PGUSER=${YDB_PG_USER:-root} | ||
- PGPASSWORD=${YDB_PG_PASSWORD:-1234} | ||
- PGHOST=${YDB_PG_HOST:-ydb} | ||
- PGPORT=${YDB_PG_PORT:-5432} | ||
- PGDATABASE=${YDB_PG_DATABASE:-local} | ||
- PQGOSSLTESTS=0 | ||
- PQSSLCERTTEST_PATH=certs | ||
- YDB_PG_TESTNAME=${YDB_PG_TESTNAME:-} | ||
volumes: | ||
- ./exchange:/exchange | ||
- ./test-result/:/test-result |
40 changes: 40 additions & 0 deletions
40
ydb/tests/postgres_integrations/go-libpq/data/docker-compose.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
version: "3" | ||
services: | ||
ydb: | ||
image: ghcr.io/ydb-platform/local-ydb:nightly | ||
environment: | ||
- "YDB_DEFAULT_LOG_LEVEL=DEBUG" | ||
- "GRPC_TLS_PORT=2135" | ||
- "GRPC_PORT=2136" | ||
- "MON_PORT=8765" | ||
- "YDB_USE_IN_MEMORY_PDISKS=true" | ||
- "POSTGRES_USER=${YDB_PG_USER:-root}" | ||
- "POSTGRES_PASSWORD=${YDB_PG_PASSWORD:-1234}" | ||
- "YDB_FEATURE_FLAGS=enable_temp_tables" | ||
- "YDB_TABLE_ENABLE_PREPARED_DDL=true" | ||
healthcheck: | ||
test: "/bin/sh /health_check" | ||
interval: 1s | ||
start_period: 1m | ||
project: | ||
depends_on: | ||
ydb: | ||
condition: service_healthy | ||
|
||
image: ydb-test/go-pqlib | ||
build: | ||
context: ../../.. | ||
dockerfile: languages/go/libpq/Dockerfile | ||
network: host | ||
environment: | ||
- PGUSER=${YDB_PG_USER:-root} | ||
- PGPASSWORD=${YDB_PG_PASSWORD:-1234} | ||
- PGHOST=${YDB_PG_HOST:-ydb} | ||
- PGPORT=${YDB_PG_PORT:-5432} | ||
- PGDATABASE=${YDB_PG_DATABASE:-/local} | ||
- PQGOSSLTESTS=0 | ||
- PQSSLCERTTEST_PATH=certs | ||
- YDB_PG_TESTNAME=${YDB_PG_TESTNAME:-} | ||
volumes: | ||
- ./exchange:/exchange | ||
- ./test-result/:/test-result |
24 changes: 24 additions & 0 deletions
24
ydb/tests/postgres_integrations/go-libpq/data/docker-init.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
apt-get update && apt-get install -y patch | ||
|
||
go install github.com/jstemmer/go-junit-report/[email protected] | ||
|
||
mkdir -p /original-sources | ||
cd /original-sources | ||
|
||
wget https://github.com/lib/pq/archive/refs/tags/v1.10.9.tar.gz -O libpq.tar.gz | ||
tar --strip-components=1 -zxvf libpq.tar.gz | ||
rm -f libpq.tar.gz | ||
|
||
mkdir -p /project/sources/ | ||
cp -R /original-sources/. /project/sources/ | ||
|
||
cd /project/sources/ | ||
[ -e /patch.diff ] && patch -s -p0 < /patch.diff | ||
|
||
# cache binary | ||
echo "Build test binary" | ||
go test -c -o ./test.binary |
38 changes: 38 additions & 0 deletions
38
ydb/tests/postgres_integrations/go-libpq/data/docker-start.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
echo "Start script" | ||
|
||
rm -rf /test-result 2> /dev/null || true | ||
|
||
mkdir -p /exchange | ||
mkdir -p /test-result/raw | ||
|
||
if [ -e /exchange/sources ]; then | ||
echo "Skip prepare sources, because it is exist" | ||
else | ||
echo "Copy sources" | ||
mkdir -p /exchange/sources | ||
cp -R /project/sources/. /exchange/sources | ||
chmod -R a+rw /exchange/sources | ||
fi | ||
|
||
cd /project/sources/ | ||
|
||
export YDB_PG_TESTFILTER="${YDB_PG_TESTFILTER:-}" # set YDB_PG_TESTNAME to empty string if it not set | ||
|
||
echo "Run tests: '$YDB_PG_TESTFILTER'" | ||
|
||
echo "Start test" | ||
|
||
mkdir -p /test-result/raw | ||
PQTEST_BINARY_PARAMETERS=no /go-run-separate-tests.bash | ||
|
||
sed -e 's|classname=""|classname="golang-lib-pq"|' -i /test-result/raw/result.xml | ||
|
||
if [ -n "${YDB_PG_TESTFILTER:-}" ]; then | ||
cat /test-result/raw/result.txt | ||
fi | ||
|
||
chmod -R a+rw /test-result |
Oops, something went wrong.