Skip to content

Commit 1651bab

Browse files
authored
Merge 7befb20 into f8f5387
2 parents f8f5387 + 7befb20 commit 1651bab

23 files changed

+1237
-0
lines changed

ydb/tests/library/harness/kikimr_runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def __make_run_command(self):
178178
"--grpc-port=%s" % self.grpc_port,
179179
"--mon-port=%d" % self.mon_port,
180180
"--ic-port=%d" % self.ic_port,
181+
"--pgwire-port=%d" % self.pgwire_port,
181182
]
182183
)
183184

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import ydb.tests.postgres_integrations.library
2+
import pytest
3+
4+
5+
def pytest_collection_finish(session: pytest.Session):
6+
ydb.tests.postgres_integrations.library.pytest_collection_finish(session)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/exchange/
2+
/sources/
3+
/test-result/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
ONE_TEST_TIMEOUT=5s
6+
TEST_BINARY=./test.binary
7+
8+
echo "Get test list"
9+
TESTS=$($TEST_BINARY --test.list "^Test" | sort)
10+
11+
12+
echo "Shell $SHELL"
13+
14+
rm -f /test-result/raw/result.txt
15+
for TEST_NAME in $TESTS; do
16+
echo -n "Test: $TEST_NAME "
17+
if echo "$TEST_NAME" | grep -Eq "$YDB_PG_TESTFILTER"; then
18+
echo start
19+
else
20+
echo skip
21+
continue
22+
fi
23+
CMD="$TEST_BINARY --test.run '^$TEST_NAME\$' --test.v --test.timeout='$ONE_TEST_TIMEOUT'"
24+
echo "$CMD"
25+
bash -c "$CMD" >> /test-result/raw/result.txt 2>&1 || true
26+
done
27+
28+
go-junit-report < /test-result/raw/result.txt > /test-result/raw/result.xml
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: "3"
2+
services:
3+
project:
4+
network_mode: host
5+
6+
image: ydb-test/go-pqlib
7+
build:
8+
context: ../../..
9+
dockerfile: languages/go/libpq/Dockerfile
10+
network: host
11+
environment:
12+
- PGUSER=${YDB_PG_USER:-root}
13+
- PGPASSWORD=${YDB_PG_PASSWORD:-1234}
14+
- PGHOST=${YDB_PG_HOST:-ydb}
15+
- PGPORT=${YDB_PG_PORT:-5432}
16+
- PGDATABASE=${YDB_PG_DATABASE:-local}
17+
- PQGOSSLTESTS=0
18+
- PQSSLCERTTEST_PATH=certs
19+
- YDB_PG_TESTNAME=${YDB_PG_TESTNAME:-}
20+
volumes:
21+
- ./exchange:/exchange
22+
- ./test-result/:/test-result
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: "3"
2+
services:
3+
ydb:
4+
image: ghcr.io/ydb-platform/local-ydb:nightly
5+
environment:
6+
- "YDB_DEFAULT_LOG_LEVEL=DEBUG"
7+
- "GRPC_TLS_PORT=2135"
8+
- "GRPC_PORT=2136"
9+
- "MON_PORT=8765"
10+
- "YDB_USE_IN_MEMORY_PDISKS=true"
11+
- "POSTGRES_USER=${YDB_PG_USER:-root}"
12+
- "POSTGRES_PASSWORD=${YDB_PG_PASSWORD:-1234}"
13+
- "YDB_FEATURE_FLAGS=enable_temp_tables"
14+
- "YDB_TABLE_ENABLE_PREPARED_DDL=true"
15+
healthcheck:
16+
test: "/bin/sh /health_check"
17+
interval: 1s
18+
start_period: 1m
19+
project:
20+
depends_on:
21+
ydb:
22+
condition: service_healthy
23+
24+
image: ydb-test/go-pqlib
25+
build:
26+
context: ../../..
27+
dockerfile: languages/go/libpq/Dockerfile
28+
network: host
29+
environment:
30+
- PGUSER=${YDB_PG_USER:-root}
31+
- PGPASSWORD=${YDB_PG_PASSWORD:-1234}
32+
- PGHOST=${YDB_PG_HOST:-ydb}
33+
- PGPORT=${YDB_PG_PORT:-5432}
34+
- PGDATABASE=${YDB_PG_DATABASE:-/local}
35+
- PQGOSSLTESTS=0
36+
- PQSSLCERTTEST_PATH=certs
37+
- YDB_PG_TESTNAME=${YDB_PG_TESTNAME:-}
38+
volumes:
39+
- ./exchange:/exchange
40+
- ./test-result/:/test-result
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
apt-get update && apt-get install -y patch
6+
7+
go install github.com/jstemmer/go-junit-report/v2@v2.0.0
8+
9+
mkdir -p /original-sources
10+
cd /original-sources
11+
12+
wget https://github.com/lib/pq/archive/refs/tags/v1.10.9.tar.gz -O libpq.tar.gz
13+
tar --strip-components=1 -zxvf libpq.tar.gz
14+
rm -f libpq.tar.gz
15+
16+
mkdir -p /project/sources/
17+
cp -R /original-sources/. /project/sources/
18+
19+
cd /project/sources/
20+
[ -e /patch.diff ] && patch -s -p0 < /patch.diff
21+
22+
# cache binary
23+
echo "Build test binary"
24+
go test -c -o ./test.binary
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
echo "Start script"
6+
7+
rm -rf /test-result 2> /dev/null || true
8+
9+
mkdir -p /exchange
10+
mkdir -p /test-result/raw
11+
12+
if [ -e /exchange/sources ]; then
13+
echo "Skip prepare sources, because it is exist"
14+
else
15+
echo "Copy sources"
16+
mkdir -p /exchange/sources
17+
cp -R /project/sources/. /exchange/sources
18+
chmod -R a+rw /exchange/sources
19+
fi
20+
21+
cd /project/sources/
22+
23+
export YDB_PG_TESTFILTER="${YDB_PG_TESTFILTER:-}" # set YDB_PG_TESTNAME to empty string if it not set
24+
25+
echo "Run tests: '$YDB_PG_TESTFILTER'"
26+
27+
echo "Start test"
28+
29+
mkdir -p /test-result/raw
30+
PQTEST_BINARY_PARAMETERS=no /go-run-separate-tests.bash
31+
32+
sed -e 's|classname=""|classname="golang-lib-pq"|' -i /test-result/raw/result.xml
33+
34+
if [ -n "${YDB_PG_TESTFILTER:-}" ]; then
35+
cat /test-result/raw/result.txt
36+
fi
37+
38+
chmod -R a+rw /test-result

0 commit comments

Comments
 (0)