Fixed exception handling in 00952 test

This commit is contained in:
Gleb Novikov 2019-05-27 02:57:18 +03:00
parent af50b1ff5c
commit 1aaab07459
3 changed files with 13 additions and 12 deletions

View File

@ -8,7 +8,7 @@ void CheckConstraintsBlockOutputStream::write(const Block & block)
{
for (auto & constraint_expr: expressions)
if (!checkConstraintOnBlock(block, constraint_expr))
throw Exception("Some constraints are not satisfied", ErrorCodes::QUERY_WAS_CANCELLED);
throw Exception{"Some constraints are not satisfied", ErrorCodes::QUERY_WAS_CANCELLED};
output->write(block);
}

View File

@ -1,10 +1,7 @@
1 2
Received exception from server (version 19.8.1):
Code: 394. DB::Exception: Received from localhost:9001, ::1. DB::Exception: Some constraints are not satisfied.
Exception ok
1 2
Received exception from server (version 19.8.1):
Code: 394. DB::Exception: Received from localhost:9001, ::1. DB::Exception: Some constraints are not satisfied.
Received exception from server (version 19.8.1):
Code: 394. DB::Exception: Received from localhost:9001, ::1. DB::Exception: Some constraints are not satisfied.
Exception ok
Exception ok
0 11
7 18

View File

@ -3,8 +3,6 @@
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
exec 2>&1
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test_constraints;"
$CLICKHOUSE_CLIENT --query="CREATE TABLE test_constraints
@ -20,7 +18,9 @@ $CLICKHOUSE_CLIENT --query="INSERT INTO test_constraints VALUES (1, 2);"
$CLICKHOUSE_CLIENT --query="SELECT * FROM test_constraints;"
# This one must throw and exception
$CLICKHOUSE_CLIENT --query="INSERT INTO test_constraints VALUES (3, 4), (1, 0);"
EXCEPTION_TEXT="Some constraints are not satisfied"
$CLICKHOUSE_CLIENT --query="INSERT INTO test_constraints VALUES (3, 4), (1, 0);" 2>&1 \
| grep -q "$EXCEPTION_TEXT" && echo "Exception ok" || echo "Did not thrown an exception"
$CLICKHOUSE_CLIENT --query="SELECT * FROM test_constraints;"
$CLICKHOUSE_CLIENT --query="DROP TABLE test_constraints;"
@ -36,11 +36,15 @@ $CLICKHOUSE_CLIENT --query="CREATE TABLE test_constraints
ENGINE = MergeTree ORDER BY (a);"
# This one must throw an exception
$CLICKHOUSE_CLIENT --query="INSERT INTO test_constraints VALUES (1, 2);"
EXCEPTION_TEXT="Some constraints are not satisfied"
$CLICKHOUSE_CLIENT --query="INSERT INTO test_constraints VALUES (1, 2);" 2>&1 \
| grep -q "$EXCEPTION_TEXT" && echo "Exception ok" || echo "Did not thrown an exception"
$CLICKHOUSE_CLIENT --query="SELECT * FROM test_constraints;"
# This one must throw an exception
$CLICKHOUSE_CLIENT --query="INSERT INTO test_constraints VALUES (5, 16), (10, 11);"
EXCEPTION_TEXT="Some constraints are not satisfied"
$CLICKHOUSE_CLIENT --query="INSERT INTO test_constraints VALUES (5, 16), (10, 11);" 2>&1 \
| grep -q "$EXCEPTION_TEXT" && echo "Exception ok" || echo "Did not thrown an exception"
$CLICKHOUSE_CLIENT --query="SELECT * FROM test_constraints;"
# This one must succeed