aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqrort <qrort@yandex-team.com>2023-03-07 11:14:56 +0300
committerqrort <qrort@yandex-team.com>2023-03-07 11:14:56 +0300
commitfb974eec1b6958138ae30adaafd5503f0d91d388 (patch)
tree6ca3e98fb9c8a318455ec21349d42c879bb53d8f
parent980f2a05eb72bde52c212d5c67f8860e45ef1b10 (diff)
downloadydb-fb974eec1b6958138ae30adaafd5503f0d91d388.tar.gz
move all oss code into one target, README, missing canons for ydb_cli
-rw-r--r--ydb/tests/functional/README.md29
-rw-r--r--ydb/tests/functional/canonical/test_sql.py2
-rw-r--r--ydb/tests/functional/ydb_cli/test_ydb_backup.py2
-rw-r--r--ydb/tests/functional/ydb_cli/test_ydb_impex.py4
-rw-r--r--ydb/tests/functional/ydb_cli/test_ydb_scripting.py4
-rw-r--r--ydb/tests/functional/ydb_cli/test_ydb_table.py4
-rw-r--r--ydb/tests/library/common/yatest_common.py2
-rw-r--r--ydb/tests/library/harness/kikimr_cluster_interface.py2
-rw-r--r--ydb/tests/oss/canonical/__init__.py (renamed from ydb/tests/oss_canonical/__init__.py)0
-rw-r--r--ydb/tests/oss/canonical/canonical.py1
-rw-r--r--ydb/tests/oss/canonical/conftest.py (renamed from ydb/tests/oss_canonical/conftest.py)2
-rw-r--r--ydb/tests/oss/prepare/__init__.py0
-rw-r--r--ydb/tests/oss/prepare/compile_protos.py10
-rw-r--r--ydb/tests/oss/prepare/generate_test_context.py32
-rwxr-xr-xydb/tests/oss/prepare/prepare.sh19
-rw-r--r--ydb/tests/oss/ydb_sdk_import/README.md (renamed from ydb/tests/ydb_sdk_import/README.md)0
-rw-r--r--ydb/tests/oss/ydb_sdk_import/__init__.py (renamed from ydb/tests/ydb_sdk_import/__init__.py)2
-rw-r--r--ydb/tests/oss_canonical/oss_canonical.py1
18 files changed, 103 insertions, 13 deletions
diff --git a/ydb/tests/functional/README.md b/ydb/tests/functional/README.md
new file mode 100644
index 0000000000..e2ad851d34
--- /dev/null
+++ b/ydb/tests/functional/README.md
@@ -0,0 +1,29 @@
+# How to run YDB functional tests
+
+YDB function tests can be run via pytest. To launch them, complete the following steps:
+
+1. Build YDB. You can use [this guide](https://github.com/ydb-platform/ydb/blob/main/BUILD.md).
+2. Install `grpc-tools` package. You can use [this guide](https://grpc.io/docs/languages/python/quickstart).
+3. Initialize the following enviroment variables:
+ - `source_root` should match the root of YDB GitHub repo. If you did not change any of the commands from YDB
+ build guide, then you should export the variable via
+ ```
+ export source_root=~/ydbwork/ydb
+ ```
+ - `build_root` should match the directory, where YDB was built. If you did not change any of the commands from YDB
+ build guide, then you should export the variable via
+ ```
+ export build_root=~/ydbwork/build
+ ```
+ - `test_target` should match the suite from functional tests, which you wish to run. For example, you can export this variable via
+ ```
+ export test_target=ydb_cli
+ ```
+4. Launch the script, which prepares the environment for YDB tests:
+ ```
+ source ${source_root}/ydb/tests/oss/prepare/prepare.sh
+ ```
+5. The script will put you inside directory with test sources, and you can run them:
+ ```
+ pytest -s
+ ```
diff --git a/ydb/tests/functional/canonical/test_sql.py b/ydb/tests/functional/canonical/test_sql.py
index c749d78601..d418c7566d 100644
--- a/ydb/tests/functional/canonical/test_sql.py
+++ b/ydb/tests/functional/canonical/test_sql.py
@@ -9,7 +9,7 @@ import uuid
from ydb.tests.library.common import yatest_common
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
-from ydb.tests.oss_canonical import set_canondata_root, is_oss
+from ydb.tests.oss.canonical import set_canondata_root, is_oss
import ydb
import ydb.issues
from ydb.public.api.protos import ydb_table_pb2
diff --git a/ydb/tests/functional/ydb_cli/test_ydb_backup.py b/ydb/tests/functional/ydb_cli/test_ydb_backup.py
index c6d9b5872c..0aa23cba49 100644
--- a/ydb/tests/functional/ydb_cli/test_ydb_backup.py
+++ b/ydb/tests/functional/ydb_cli/test_ydb_backup.py
@@ -2,7 +2,7 @@
from ydb.tests.library.common import yatest_common
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
-from ydb.tests.ydb_sdk_import import ydb
+from ydb.tests.oss.ydb_sdk_import import ydb
from hamcrest import assert_that, is_, is_not, contains_inanyorder, has_item, has_items
import os
diff --git a/ydb/tests/functional/ydb_cli/test_ydb_impex.py b/ydb/tests/functional/ydb_cli/test_ydb_impex.py
index e602fde93a..75a7e16c4d 100644
--- a/ydb/tests/functional/ydb_cli/test_ydb_impex.py
+++ b/ydb/tests/functional/ydb_cli/test_ydb_impex.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from ydb.tests.library.common import yatest_common
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
-from ydb.tests.oss_canonical import set_canondata_root
-from ydb.tests.ydb_sdk_import import ydb
+from ydb.tests.oss.canonical import set_canondata_root
+from ydb.tests.oss.ydb_sdk_import import ydb
import pytest
import logging
diff --git a/ydb/tests/functional/ydb_cli/test_ydb_scripting.py b/ydb/tests/functional/ydb_cli/test_ydb_scripting.py
index 8e148fe21e..674e3bfc6d 100644
--- a/ydb/tests/functional/ydb_cli/test_ydb_scripting.py
+++ b/ydb/tests/functional/ydb_cli/test_ydb_scripting.py
@@ -2,8 +2,8 @@
from ydb.tests.library.common import yatest_common
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
-from ydb.tests.oss_canonical import set_canondata_root
-from ydb.tests.ydb_sdk_import import ydb
+from ydb.tests.oss.canonical import set_canondata_root
+from ydb.tests.oss.ydb_sdk_import import ydb
import os
import logging
diff --git a/ydb/tests/functional/ydb_cli/test_ydb_table.py b/ydb/tests/functional/ydb_cli/test_ydb_table.py
index 47e4225a57..edefde725d 100644
--- a/ydb/tests/functional/ydb_cli/test_ydb_table.py
+++ b/ydb/tests/functional/ydb_cli/test_ydb_table.py
@@ -2,8 +2,8 @@
from ydb.tests.library.common import yatest_common
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
-from ydb.tests.oss_canonical import set_canondata_root
-from ydb.tests.ydb_sdk_import import ydb
+from ydb.tests.oss.canonical import set_canondata_root
+from ydb.tests.oss.ydb_sdk_import import ydb
import os
import logging
diff --git a/ydb/tests/library/common/yatest_common.py b/ydb/tests/library/common/yatest_common.py
index 378c62ff89..8f44af987f 100644
--- a/ydb/tests/library/common/yatest_common.py
+++ b/ydb/tests/library/common/yatest_common.py
@@ -3,7 +3,7 @@ import os
import yatest.common as ya_common
import yatest.common.network as ya_common_network
-import ydb.tests.oss_canonical as oss_canonical
+import ydb.tests.oss.canonical as oss_canonical
"""
For yatest.common package see file
library/python/testing/yatest_common/yatest/common/__init__.py
diff --git a/ydb/tests/library/harness/kikimr_cluster_interface.py b/ydb/tests/library/harness/kikimr_cluster_interface.py
index 08a6f93dfd..1bdadc8a83 100644
--- a/ydb/tests/library/harness/kikimr_cluster_interface.py
+++ b/ydb/tests/library/harness/kikimr_cluster_interface.py
@@ -11,7 +11,7 @@ from ydb.tests.library.common.protobuf_console import (
RemoveTenantRequest, GetOperationRequest)
import ydb.public.api.protos.ydb_cms_pb2 as cms_tenants_pb
from ydb.public.api.protos.ydb_status_codes_pb2 import StatusIds
-from ydb.tests.ydb_sdk_import import ydb
+from ydb.tests.oss.ydb_sdk_import import ydb
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
diff --git a/ydb/tests/oss_canonical/__init__.py b/ydb/tests/oss/canonical/__init__.py
index 5524959ca0..5524959ca0 100644
--- a/ydb/tests/oss_canonical/__init__.py
+++ b/ydb/tests/oss/canonical/__init__.py
diff --git a/ydb/tests/oss/canonical/canonical.py b/ydb/tests/oss/canonical/canonical.py
new file mode 100644
index 0000000000..4442dcda35
--- /dev/null
+++ b/ydb/tests/oss/canonical/canonical.py
@@ -0,0 +1 @@
+from ydb.tests.oss.canonical.conftest import * # noqa
diff --git a/ydb/tests/oss_canonical/conftest.py b/ydb/tests/oss/canonical/conftest.py
index a232a503a0..8d1626c29a 100644
--- a/ydb/tests/oss_canonical/conftest.py
+++ b/ydb/tests/oss/canonical/conftest.py
@@ -1,5 +1,5 @@
import pytest
-from ydb.tests.oss_canonical import canons_meta, is_oss
+from ydb.tests.oss.canonical import canons_meta, is_oss
@pytest.fixture(scope='function', autouse=is_oss)
diff --git a/ydb/tests/oss/prepare/__init__.py b/ydb/tests/oss/prepare/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/ydb/tests/oss/prepare/__init__.py
diff --git a/ydb/tests/oss/prepare/compile_protos.py b/ydb/tests/oss/prepare/compile_protos.py
new file mode 100644
index 0000000000..2c21ad7613
--- /dev/null
+++ b/ydb/tests/oss/prepare/compile_protos.py
@@ -0,0 +1,10 @@
+from argparse import ArgumentParser
+from grpc_tools import command
+
+
+if __name__ == '__main__':
+ parser = ArgumentParser()
+ parser.add_argument('--source-root', required=True, help='YDB source directory')
+ args = parser.parse_args()
+
+ command.build_package_protos(args.source_root)
diff --git a/ydb/tests/oss/prepare/generate_test_context.py b/ydb/tests/oss/prepare/generate_test_context.py
new file mode 100644
index 0000000000..7d23d53a9f
--- /dev/null
+++ b/ydb/tests/oss/prepare/generate_test_context.py
@@ -0,0 +1,32 @@
+from argparse import ArgumentParser
+import os
+import json
+
+test_context = {
+ 'runtime': {
+ 'build_root': '',
+ 'output_path': '',
+ 'project_path': 'ydb/tests/functional/ydb_cli',
+ 'source_root': '',
+ 'work_path': ''
+ }
+}
+
+if __name__ == '__main__':
+ parser = ArgumentParser()
+ parser.add_argument('--build-root', required=True, help='YDB build directory')
+ parser.add_argument('--source-root', type=str, required=True, help='YDB root directory')
+ args = parser.parse_args()
+ test_context['runtime']['build_root'] = args.build_root
+ test_context['runtime']['output_path'] = os.path.join(
+ args.source_root,
+ 'ydb/tests/functional/ydb_cli/test-results/py3test/testing_out_stuff'
+ )
+ test_context['runtime']['source_root'] = args.source_root
+ test_context['runtime']['work_path'] = os.path.join(
+ args.source_root,
+ 'ydb/tests/functional/ydb_cli/test-results/py3test'
+ )
+ strdata = json.dumps(test_context, indent=4)
+ with open("test.context", "w") as outfile:
+ outfile.write(strdata)
diff --git a/ydb/tests/oss/prepare/prepare.sh b/ydb/tests/oss/prepare/prepare.sh
new file mode 100755
index 0000000000..82bdc35d7c
--- /dev/null
+++ b/ydb/tests/oss/prepare/prepare.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+python ${source_root}/ydb/tests/oss/prepare/compile_protos.py --source-root ${source_root}
+
+cd ${source_root}/ydb/tests/functional/${test_target}
+mkdir test-results
+mkdir test-results/py3test
+mkdir test-results/py3test/testing_out_stuff
+
+cd test-results
+python ${source_root}/ydb/tests/oss/prepare/generate_test_context.py --build-root ${build_root} --source-root ${source_root}
+cd ..
+
+export PYTHONPATH=${source_root}:${source_root}/library/python/testing/yatest_common:${source_root}/library/python/testing:${source_root}/library/python/pytest/plugins:${source_root}/ydb/tests/oss/canonical
+
+export YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd"
+export PYTEST_PLUGINS=ya,conftests,canonical
+export YA_TEST_CONTEXT_FILE=${source_root}/ydb/tests/functional/${test_target}/test-results/test.context
+export YDB_OPENSOURCE=yes
diff --git a/ydb/tests/ydb_sdk_import/README.md b/ydb/tests/oss/ydb_sdk_import/README.md
index a31e24384a..a31e24384a 100644
--- a/ydb/tests/ydb_sdk_import/README.md
+++ b/ydb/tests/oss/ydb_sdk_import/README.md
diff --git a/ydb/tests/ydb_sdk_import/__init__.py b/ydb/tests/oss/ydb_sdk_import/__init__.py
index 6aaa8211d3..9a5f412784 100644
--- a/ydb/tests/ydb_sdk_import/__init__.py
+++ b/ydb/tests/oss/ydb_sdk_import/__init__.py
@@ -1,4 +1,4 @@
-from ydb.tests.oss_canonical import is_oss
+from ydb.tests.oss.canonical import is_oss
if is_oss:
from ydb.public.sdk.python import ydb # noqa
diff --git a/ydb/tests/oss_canonical/oss_canonical.py b/ydb/tests/oss_canonical/oss_canonical.py
deleted file mode 100644
index 5c3acfb2ed..0000000000
--- a/ydb/tests/oss_canonical/oss_canonical.py
+++ /dev/null
@@ -1 +0,0 @@
-from ydb.tests.oss_canonical.conftest import * # noqa