Replaced third test, fixed reference

This commit is contained in:
BoloniniD 2021-07-15 11:24:45 +03:00
parent 3be17d0639
commit 5a15266d55
2 changed files with 29 additions and 23 deletions

View File

@ -1,21 +1,31 @@
File generated: File generated:
0,BBB 0,"BBB"
1,BBB 1,"BBB"
2,BBB 2,"BBB"
3,BBB 3,"BBB"
4,AAA 4,"AAA"
5,BBB 5,"BBB"
6,AAA 6,"AAA"
****************** ******************
Attempt to read twice from a pipeline Attempt to read twice from a pipeline
Return code: 0 foo
OK foo
****************** ******************
Attempt to read twice from a regular file Attempt to read twice from a regular file
Return code: 0 0,"BBB"
OK 1,"BBB"
2,"BBB"
3,"BBB"
4,"AAA"
5,"BBB"
6,"AAA"
0,"BBB"
1,"BBB"
2,"BBB"
3,"BBB"
4,"AAA"
5,"BBB"
6,"AAA"
****************** ******************
Attempt to read twice from a pipe Attempt to read twice from a pipe
Return code: 0 OK: stderr contains a message
OK: cannot read from pipe twice

View File

@ -4,8 +4,7 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CURDIR"/../shell_config.sh . "$CURDIR"/../shell_config.sh
SAMPLE_FILE="$CURDIR/01941_sample_data.csv" SAMPLE_FILE="$CURDIR/01941_sample_data.csv"
STD_ERROR_CAPTURED="$CURDIR/01941_std_error_captured.log"
set -e
echo 'File generated:' echo 'File generated:'
${CLICKHOUSE_LOCAL} -q "SELECT number, if(number in (4,6), 'AAA', 'BBB') from numbers(7) FORMAT CSV" --format_csv_delimiter=, >"$SAMPLE_FILE" ${CLICKHOUSE_LOCAL} -q "SELECT number, if(number in (4,6), 'AAA', 'BBB') from numbers(7) FORMAT CSV" --format_csv_delimiter=, >"$SAMPLE_FILE"
@ -21,11 +20,8 @@ ${CLICKHOUSE_LOCAL} --structure 'key String' -q 'select * from table; select * f
echo '******************' echo '******************'
echo 'Attempt to read twice from a pipe' echo 'Attempt to read twice from a pipe'
tpipe=$(mktemp -u) echo 1 | ${CLICKHOUSE_LOCAL} --structure "a int" --query "select a from table where a in (select a from table)" 2>"$STD_ERROR_CAPTURED"
mkfifo "$tpipe" expected_error_message='Cannot read from a pipeline twice'
echo "$SAMPLE_FILE" > /tmp/pipe & cat "$STD_ERROR_CAPTURED" | grep -q "$expected_error_message" && echo "OK: stderr contains a message '$expected_error_message'" || echo "FAILED: Error message is wrong"
${CLICKHOUSE_LOCAL} --structure 'key String' -q 'select * from table; select * from table;' --file /tmp/pipe
rm "$SAMPLE_FILE"
rm "$SAMPLE_FILE" "$STD_ERROR_CAPTURED"