Add tests.

This commit is contained in:
Vitaly Baranov 2020-12-11 23:48:27 +03:00
parent af3ccb49f1
commit 72df75fc50
4 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,5 @@
CREATE TEMPORARY TABLE tmptable (`x` UInt32) ENGINE = Memory
CREATE TEMPORARY TABLE tmptable (`y` Float64, `z` String) ENGINE = Memory
x UInt32 1
y Float64 1
z String 2

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CURDIR"/../shell_config.sh
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=DROP+TEMPORARY+TABLE+IF+EXISTS+tmptable&session_id=session_1601a"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=DROP+TEMPORARY+TABLE+IF+EXISTS+tmptable&session_id=session_1601b"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=CREATE+TEMPORARY+TABLE+tmptable(x+UInt32)&session_id=session_1601a"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=CREATE+TEMPORARY+TABLE+tmptable(y+Float64,+z+String)&session_id=session_1601b"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=SELECT+create_table_query+FROM+system.tables+WHERE+database=''+AND+name='tmptable'&session_id=session_1601a"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=SELECT+create_table_query+FROM+system.tables+WHERE+database=''+AND+name='tmptable'&session_id=session_1601b"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=SELECT+name,type,position+FROM+system.columns+WHERE+database=''+AND+table='tmptable'&session_id=session_1601a"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=SELECT+name,type,position+FROM+system.columns+WHERE+database=''+AND+table='tmptable'&session_id=session_1601b"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=DROP+TEMPORARY+TABLE+tmptable&session_id=session_1601a"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=DROP+TEMPORARY+TABLE+tmptable&session_id=session_1601b"

View File

@ -0,0 +1,10 @@
test_01602a CREATE TEMPORARY TABLE test_01602a (`x` UInt32) ENGINE = Memory Memory Memory 1
test_01602b CREATE TEMPORARY TABLE test_01602b (`y` Float64, `z` String) ENGINE = Memory Memory Memory 1
test_01602a x UInt32 1 0 0 0 0 0 0 0
test_01602b y Float64 1 0 0 0 0 0 0 0
test_01602b z String 2 0 0 0 0 0 0 0
CREATE TEMPORARY TABLE test_01602a\n(\n `x` UInt32\n)\nENGINE = Memory
CREATE TEMPORARY TABLE test_01602b\n(\n `y` Float64,\n `z` String\n)\nENGINE = Memory
0
0
0

View File

@ -0,0 +1,18 @@
DROP TEMPORARY TABLE IF EXISTS test_01602a;
DROP TEMPORARY TABLE IF EXISTS test_01602b;
CREATE TEMPORARY TABLE test_01602a(x UInt32);
CREATE TEMPORARY TABLE test_01602b(y Float64, z String);
SELECT database, name, create_table_query, engine, engine_full, is_temporary FROM system.tables WHERE name LIKE 'test_01602%' ORDER BY name;
SELECT * FROM system.columns WHERE table LIKE 'test_01602%' ORDER BY table, name;
SHOW CREATE TEMPORARY TABLE test_01602a;
SHOW CREATE TEMPORARY TABLE test_01602b;
SELECT COUNT() FROM system.databases WHERE name='_temporary_and_external_tables';
SELECT COUNT() FROM system.tables WHERE database='_temporary_and_external_tables';
SELECT COUNT() FROM system.columns WHERE database='_temporary_and_external_tables';
DROP TEMPORARY TABLE test_01602a;
DROP TEMPORARY TABLE test_01602b;