This commit is contained in:
Yarik Briukhovetskyi 2024-08-23 17:09:28 +02:00 committed by GitHub
parent c0b36c946d
commit 223de64072
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 23 additions and 74 deletions

View File

@ -1,11 +0,0 @@
<clickhouse>
<remote_servers>
<test_cluster>
<shard>
<replica>
<host>node</host>
</replica>
</shard>
</test_cluster>
</remote_servers>
</clickhouse>

View File

@ -1,9 +0,0 @@
<clickhouse>
<logger>
<level>information</level>
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
<size>1000M</size>
<count>10</count>
</logger>
</clickhouse>

View File

@ -1,54 +0,0 @@
import logging
import pytest
from helpers.cluster import ClickHouseCluster
@pytest.fixture(scope="module")
def cluster():
try:
cluster = ClickHouseCluster(__file__)
cluster.add_instance(
"node",
main_configs=[
"configs/config.d/cluster.xml",
],
)
logging.info("Starting cluster...")
cluster.start()
logging.info("Cluster started")
node = cluster.instances["node"]
node.query(
"""
CREATE TABLE tab
(
a DateTime,
pk String
) Engine = MergeTree() ORDER BY pk;
"""
)
yield cluster
finally:
cluster.shutdown()
def test_incorrect_datetime_format(cluster):
"""
Test for an MSan issue which is caused by parsing incorrect datetime string
"""
node = cluster.instances["node"]
res = node.query("SELECT count(*) FROM tab WHERE a = '2024-08-06 09:58:09'").strip()
assert res == "0"
error = node.query_and_get_error(
"SELECT count(*) FROM tab WHERE a = '2024-08-06 09:58:0'"
).strip()
assert "Cannot parse time component of DateTime 09:58:0" in error
error = node.query_and_get_error(
"SELECT count(*) FROM tab WHERE a = '2024-08-0 09:58:09'"
).strip()
assert "Cannot convert string '2024-08-0 09:58:09' to type DateTime" in error

View File

@ -0,0 +1,3 @@
0
OK
OK

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Tags: no-fasttest
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
${CLICKHOUSE_CLIENT} --query "
CREATE TABLE tab
(
a DateTime,
pk String
) Engine = MergeTree() ORDER BY pk;
"
${CLICKHOUSE_CLIENT} --query "SELECT count(*) FROM tab WHERE a = '2024-08-06 09:58:09'"
${CLICKHOUSE_CLIENT} --query "SELECT count(*) FROM tab WHERE a = '2024-08-06 09:58:0'" 2>&1 | grep -F -q "Cannot parse time component of DateTime 09:58:0" && echo "OK" || echo "FAIL";
${CLICKHOUSE_CLIENT} --query "SELECT count(*) FROM tab WHERE a = '2024-08-0 09:58:09'" 2>&1 | grep -F -q "Cannot convert string '2024-08-0 09:58:09" && echo "OK" || echo "FAIL";