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:
0,BBB
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 pipeline
Return code: 0
OK
foo
foo
******************
Attempt to read twice from a regular file
Return code: 0
OK
0,"BBB"
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
Return code: 0
OK: cannot read from pipe twice
OK: stderr contains a message

View File

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