test is added

This commit is contained in:
Yakov Olkhovskiy 2022-05-28 12:30:05 -04:00
parent 41ef0044f0
commit 3ff32fe81d
3 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<clickhouse>
<named_collections>
<urldb>
<url>http://nginx:80/test_dict</url>
<method>PUT</method>
<format>TSV</format>
<structure>k String, v String</structure>
</urldb>
<urldict>
<url>http://nginx:80/</url>
<endpoint>/test_dict</endpoint>
<format>TabSeparated</format>
</urldict>
</named_collections>
</clickhouse>

View File

@ -0,0 +1,40 @@
import pytest
from helpers.cluster import ClickHouseCluster
uuids = []
@pytest.fixture(scope="module")
def cluster():
try:
cluster = ClickHouseCluster(__file__)
cluster.add_instance(
"node1", main_configs=["configs/conf.xml"], with_nginx=True
)
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_storage_dict(cluster):
node1 = cluster.instances["node1"]
node1.query(
f"insert into table function url(urldb) values ('foo', 'bar')"
)
result = node1.query(
f"select * from url(urldb)"
)
assert result.strip() == "foo\tbar"
node1.query(
f"create dictionary dict (k String, v String) primary key k source(http(name urldict)) layout(complex_key_hashed()) lifetime(min 0 max 100)"
)
result = node1.query(
f"select * from dict"
)
assert result.strip() == "foo\tbar"