diff --git a/tests/queries/0_stateless/01941_multiple_pipe_read.reference b/tests/queries/0_stateless/01941_multiple_pipe_read.reference index 77fd0948fc4..f346f4edd68 100644 --- a/tests/queries/0_stateless/01941_multiple_pipe_read.reference +++ b/tests/queries/0_stateless/01941_multiple_pipe_read.reference @@ -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 \ No newline at end of file diff --git a/tests/queries/0_stateless/01941_multiple_pipe_read.sh b/tests/queries/0_stateless/01941_multiple_pipe_read.sh index 8b9f59aa3b0..f497b76a4c9 100755 --- a/tests/queries/0_stateless/01941_multiple_pipe_read.sh +++ b/tests/queries/0_stateless/01941_multiple_pipe_read.sh @@ -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"