aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-12-24 15:17:01 +0000
committerGitHub <noreply@github.com>2024-12-24 18:17:01 +0300
commited24bb6783d10889818c5c69c59de5caf50f375f (patch)
tree0b557e77d3284bda0dae1a0f7b1b45165cbc5df4
parent3096657831a636dcd1403e1d6f98a8dc284e6353 (diff)
downloadydb-ed24bb6783d10889818c5c69c59de5caf50f375f.tar.gz
Move dynamber to sql tests (#12932)
-rw-r--r--ydb/tests/functional/dynumber/test_dynumber.py28
-rw-r--r--ydb/tests/functional/dynumber/ya.make15
-rw-r--r--ydb/tests/functional/ya.make1
-rw-r--r--ydb/tests/sql/test_sql.py31
4 files changed, 30 insertions, 45 deletions
diff --git a/ydb/tests/functional/dynumber/test_dynumber.py b/ydb/tests/functional/dynumber/test_dynumber.py
deleted file mode 100644
index deb742b923..0000000000
--- a/ydb/tests/functional/dynumber/test_dynumber.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- coding: utf-8 -*-
-import os
-from ydb.tests.oss.ydb_sdk_import import ydb
-
-
-def test_dynumber():
- config = ydb.DriverConfig(database=os.getenv("YDB_DATABASE"), endpoint=os.getenv("YDB_ENDPOINT"))
- table_name = os.path.join("/", os.getenv("YDB_DATABASE"), "table")
- with ydb.Driver(config) as driver:
- driver.wait(timeout=5)
- session = ydb.retry_operation_sync(lambda: driver.table_client.session().create())
- session.create_table(
- table_name,
- ydb.TableDescription()
- .with_primary_key('key')
- .with_columns(
- ydb.Column('key', ydb.OptionalType(ydb.PrimitiveType.DyNumber)),
- )
- )
-
- for value in ["DyNumber(\".149e4\")", "DyNumber(\"15e2\")", "DyNumber(\"150e1\")", "DyNumber(\".151e4\")", "DyNumber(\"1500.1\")"]:
- session.transaction().execute(
- "upsert into `%s` (key ) values (%s );" % (table_name, value),
- commit_tx=True,
- )
-
- result = session.transaction().execute("select count(*) cnt from `%s`" % table_name, commit_tx=True)
- assert result[0].rows[0].cnt == 4
diff --git a/ydb/tests/functional/dynumber/ya.make b/ydb/tests/functional/dynumber/ya.make
deleted file mode 100644
index 4b19c88db6..0000000000
--- a/ydb/tests/functional/dynumber/ya.make
+++ /dev/null
@@ -1,15 +0,0 @@
-PY3TEST()
-
-INCLUDE(${ARCADIA_ROOT}/ydb/public/tools/ydb_recipe/recipe.inc)
-SIZE(MEDIUM)
-
-TEST_SRCS(
- test_dynumber.py
-)
-
-PEERDIR(
- ydb/tests/oss/ydb_sdk_import
- ydb/public/sdk/python
-)
-
-END()
diff --git a/ydb/tests/functional/ya.make b/ydb/tests/functional/ya.make
index b1e60c8039..19cce7680f 100644
--- a/ydb/tests/functional/ya.make
+++ b/ydb/tests/functional/ya.make
@@ -10,7 +10,6 @@ RECURSE(
cms
compatibility
config
- dynumber
encryption
hive
kqp
diff --git a/ydb/tests/sql/test_sql.py b/ydb/tests/sql/test_sql.py
index 9a0347bcdb..cc7501f0b2 100644
--- a/ydb/tests/sql/test_sql.py
+++ b/ydb/tests/sql/test_sql.py
@@ -33,7 +33,6 @@ class TestYdbKvWorkload(object):
def setup(self):
current_test_full_name = os.environ.get("PYTEST_CURRENT_TEST")
self.table_path = "table_" + current_test_full_name.replace("::", ".").removesuffix(" (setup)")
- print(self.table_path)
def test_minimal_maximal_values(self):
"""
@@ -76,3 +75,33 @@ class TestYdbKvWorkload(object):
assert len(rows) == 1, "Expected one row"
assert rows[0].id == 1, "ID does not match"
assert rows[0].value == value, "Value does not match"
+
+ def test_dynumber(self):
+ table_name = "{}/{}".format(self.table_path, "dynamber")
+ self.pool.execute_with_retries(
+ f"""
+ CREATE TABLE `{table_name}` (
+ id DyNumber,
+ PRIMARY KEY (id)
+ );"""
+ )
+
+ self.pool.execute_with_retries(
+ f"""
+ UPSERT INTO `{table_name}` (id)
+ VALUES
+ (DyNumber(".149e4")),
+ (DyNumber("15e2")),
+ (DyNumber("150e1")), -- same as 15e2
+ (DyNumber("151e4")),
+ (DyNumber("1500.1"));
+ """
+ )
+
+ result = self.pool.execute_with_retries(
+ f"""
+ SELECT count(*) FROM `{table_name}`;
+ """
+ )
+
+ assert result[0].rows[0][0] == 4