aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexv-smirnov <alex@ydb.tech>2023-08-24 01:12:55 +0300
committeralexv-smirnov <alex@ydb.tech>2023-08-24 01:30:38 +0300
commit2486de060e5d12eaedf7788e0041b8aec92ae027 (patch)
tree5f4c20b0601a6bbae186d6e4f5497c6c081b9398
parent50d1783a3b18dcd6be6f0daa376411e2c7082063 (diff)
downloadydb-2486de060e5d12eaedf7788e0041b8aec92ae027.tar.gz
Fix kqp fed query test in github, enable s3 recipe usage
-rw-r--r--.github/actions/prepare_vm/action.yaml2
-rwxr-xr-xydb/core/kqp/ut/federated_query/run_testpack28
-rwxr-xr-xydb/tests/tools/s3_recipe/start.sh22
-rwxr-xr-xydb/tests/tools/s3_recipe/stop.sh9
-rw-r--r--ydb/tests/tools/s3_recipe/ya.make5
5 files changed, 65 insertions, 1 deletions
diff --git a/.github/actions/prepare_vm/action.yaml b/.github/actions/prepare_vm/action.yaml
index 47ec8420f9..6506919339 100644
--- a/.github/actions/prepare_vm/action.yaml
+++ b/.github/actions/prepare_vm/action.yaml
@@ -31,7 +31,7 @@ runs:
sudo apt-get -y install --no-install-recommends \
python-is-python3 git cmake python3-pip ninja-build antlr3 m4 \
clang-14 lld-14 llvm-14 libidn11-dev libaio1 libaio-dev parallel s3cmd make
- sudo pip3 install conan==1.59 pytest==7.1.3 pytest-timeout pytest-xdist==3.3.1 setproctitle==1.3.2 grpcio grpcio-tools PyHamcrest tornado xmltodict pyarrow boto3
+ sudo pip3 install conan==1.59 pytest==7.1.3 pytest-timeout pytest-xdist==3.3.1 setproctitle==1.3.2 grpcio grpcio-tools PyHamcrest tornado xmltodict pyarrow boto3 moto[server]
- name: install ccache
shell: bash
run: |
diff --git a/ydb/core/kqp/ut/federated_query/run_testpack b/ydb/core/kqp/ut/federated_query/run_testpack
new file mode 100755
index 0000000000..5be30f1a7d
--- /dev/null
+++ b/ydb/core/kqp/ut/federated_query/run_testpack
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+set -e
+CTX_DIR=$(mktemp -d)
+echo Working dir: $CTX_DIR
+cd "$CTX_DIR"
+
+# Start server
+MOTO_SERVER_EXECUTABLE=moto_server $source_root/ydb/tests/tools/s3_recipe/start.sh $CTX_DIR
+
+# Run test
+set +e
+S3_ENDPOINT=$(cat $CTX_DIR/env.json | grep 'S3_ENDPOINT' | cut -f 4 -d '"') \
+$build_root/ydb/core/kqp/ut/federated_query/ydb-core-kqp-ut-federated_query $*
+
+code=$?
+if [ $code -gt 0 ];then
+ echo
+ echo "Test execution failed"
+ echo
+fi
+
+# Stop server (removes working dir!)
+$source_root/ydb/tests/tools/s3_recipe/stop.sh $CTX_DIR
+
+# Return result code from test run
+if [ $code -gt 0 ];then
+ exit $code
+fi
diff --git a/ydb/tests/tools/s3_recipe/start.sh b/ydb/tests/tools/s3_recipe/start.sh
new file mode 100755
index 0000000000..2f69232e79
--- /dev/null
+++ b/ydb/tests/tools/s3_recipe/start.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+echo
+echo Starting S3 server
+echo
+
+CTX_DIR=$1
+YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd" \
+PYTHONPATH=$source_root/ydb/public/sdk/python3:$source_root/library/python/testing/yatest_common:$source_root/library/python/testing:$source_root \
+python3 $source_root/ydb/tests/tools/s3_recipe/__main__.py start --output-dir $CTX_DIR --build-root "$build_root" --env-file $CTX_DIR/env.json
+code=$?
+if [ $code -gt 0 ];then
+ echo
+ echo "S3 server start failed"
+ echo
+ exit $code
+fi
+
+echo
+echo S3 server started successfully
+echo
+
+
diff --git a/ydb/tests/tools/s3_recipe/stop.sh b/ydb/tests/tools/s3_recipe/stop.sh
new file mode 100755
index 0000000000..f5dd121b9e
--- /dev/null
+++ b/ydb/tests/tools/s3_recipe/stop.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+echo
+echo Stopping S3 server
+echo
+
+CTX_DIR=$1
+PYTHONPATH=$source_root/ydb/public/sdk/python3:$source_root/library/python/testing/yatest_common:$source_root/library/python/testing:$source_root \
+python3 $source_root/ydb/tests/tools/s3_recipe/__main__.py stop --output-dir $CTX_DIR --build-root "$build_root" --env-file $CTX_DIR/env.json
+
diff --git a/ydb/tests/tools/s3_recipe/ya.make b/ydb/tests/tools/s3_recipe/ya.make
index 10d390f5b6..87b935895b 100644
--- a/ydb/tests/tools/s3_recipe/ya.make
+++ b/ydb/tests/tools/s3_recipe/ya.make
@@ -9,4 +9,9 @@ PEERDIR(
library/recipes/common
)
+FILES(
+ start.sh
+ stop.sh
+)
+
END()