Skip to content

Commit 0ca2955

Browse files
authored
Add tpch upload test (#19695)
1 parent 4596875 commit 0ca2955

File tree

6 files changed

+66
-1
lines changed

6 files changed

+66
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import ydb.tests.olap.load.lib.upload as upload
2+
from ydb.tests.functional.tpc.lib.conftest import FunctionalTestBase
3+
4+
5+
class TestUploadTpchS1(upload.TestUploadTpch1, FunctionalTestBase):
6+
@classmethod
7+
def setup_class(cls) -> None:
8+
cls.setup_cluster()
9+
upload.TestUploadTpch1.setup_class()

ydb/tests/functional/tpc/medium/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ TEST_SRCS(
88
test_external.py
99
test_diff_processing.py
1010
test_tpch.py
11+
test_upload.py
1112
)
1213

1314
SIZE(MEDIUM)

ydb/tests/olap/load/lib/upload.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
from __future__ import annotations
2+
from .conftest import LoadSuiteBase
3+
from ydb.tests.olap.lib.ydb_cli import YdbCliHelper
4+
from ydb.tests.olap.lib.ydb_cluster import YdbCluster
5+
from time import time
6+
import yatest.common
7+
import allure
8+
9+
10+
class UploadSuiteBase(LoadSuiteBase):
11+
def init(self):
12+
pass
13+
14+
def import_data(self):
15+
pass
16+
17+
def test(self):
18+
query_name = 'Upload'
19+
start_time = time()
20+
result = YdbCliHelper.WorkloadRunResult()
21+
result.iterations[0] = YdbCliHelper.Iteration()
22+
result.traceback = None
23+
nodes_start_time = [n.start_time for n in YdbCluster.get_cluster_nodes(db_only=False)]
24+
first_node_start_time = min(nodes_start_time) if len(nodes_start_time) > 0 else 0
25+
result.start_time = max(start_time - 600, first_node_start_time)
26+
try:
27+
self.save_nodes_state()
28+
with allure.step("init"):
29+
self.init()
30+
start_time = time()
31+
with allure.step("import data"):
32+
self.import_data()
33+
except BaseException as e:
34+
result.add_error(str(e))
35+
result.traceback = e.__traceback__
36+
result.iterations[0].time = time() - start_time
37+
self.process_query_result(result, query_name, True)
38+
39+
40+
class UploadTpchBase(UploadSuiteBase):
41+
@classmethod
42+
def __get_path(cls):
43+
return f'{YdbCluster.tables_path}/upload/tpch/s{cls.scale}'
44+
45+
def init(self):
46+
yatest.common.execute(YdbCliHelper.get_cli_command() + ['workload', 'tpch', '-p', self.__get_path(), 'init', '--store=column'])
47+
48+
def import_data(self):
49+
yatest.common.execute(YdbCliHelper.get_cli_command() + ['workload', 'tpch', '-p', self.__get_path(), 'import', 'generator', '--scale', str(self.scale)])
50+
51+
52+
class TestUploadTpch1(UploadTpchBase):
53+
scale: int = 1

ydb/tests/olap/load/lib/ya.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ PY3_LIBRARY()
66
external.py
77
tpcds.py
88
tpch.py
9+
upload.py
910
workload_simple_queue.py
10-
1111
)
1212

1313
PEERDIR (

ydb/tests/olap/load/test_upload.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from ydb.tests.olap.load.lib.upload import * # noqa

ydb/tests/olap/load/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ PY3TEST()
1212
test_external.py
1313
test_tpcds.py
1414
test_tpch.py
15+
test_upload.py
1516
test_workload_simple_queue.py
1617
)
1718

0 commit comments

Comments
 (0)