few more test cases

This commit is contained in:
Bharat Nallan Chakravarthy 2023-12-04 13:38:06 -08:00
parent 25d1d59c6d
commit 942802f308

View File

@ -61,6 +61,7 @@ def test_wrong_table_name(start):
node.query(
"""
CREATE DATABASE test;
CREATE DATABASE test2;
CREATE TABLE test.table_test (i Int64) ENGINE=Memory;
CREATE TABLE test.table_test2 (i Int64) ENGINE=Memory;
INSERT INTO test.table_test SELECT 1;
@ -76,11 +77,23 @@ def test_wrong_table_name(start):
"""
)
assert int(node.query("SELECT count() FROM test.table_test;")) == 1
with pytest.raises(
QueryRuntimeException,
match="DB::Exception: Table test2.table_test1 does not exist. Maybe you meant test.table_test?.",
):
node.query(
"""
SELECT * FROM test2.table_test1 LIMIT 1;
"""
)
node.query(
"""
DROP TABLE test.table_test;
DROP TABLE test.table_test2;
DROP DATABASE test;
DROP DATABASE test2;
"""
)
@ -89,6 +102,7 @@ def test_drop_wrong_table_name(start):
node.query(
"""
CREATE DATABASE test;
CREATE DATABASE test2;
CREATE TABLE test.table_test (i Int64) ENGINE=Memory;
INSERT INTO test.table_test SELECT 1;
"""
@ -96,13 +110,21 @@ def test_drop_wrong_table_name(start):
with pytest.raises(
QueryRuntimeException,
match="DB::Exception: Table test.table_tes does not exist. Maybe you meant test.table_test?.",
match="DB::Exception: Table test.table_test1 does not exist. Maybe you meant test.table_test?.",
):
node.query("DROP TABLE test.table_tes;")
node.query("DROP TABLE test.table_test1;")
assert int(node.query("SELECT count() FROM test.table_test;")) == 1
with pytest.raises(
QueryRuntimeException,
match="DB::Exception: Table test2.table_test does not exist. Maybe you meant test.table_test?.",
):
node.query("DROP TABLE test2.table_test;")
node.query(
"""
DROP TABLE test.table_test;
DROP DATABASE test;
DROP DATABASE test2;
"""
)