ClickHouse/tests/queries/0_stateless/02050_client_profile_events.sh
Azat Khuzhin b7f18e2333 tests: add more information for 02050_client_profile_events in case of failure
Sometimes [1] the test fails like this:

    2021-12-10 03:41:19 --- /usr/share/clickhouse-test/queries/0_stateless/02050_client_profile_events.reference	2021-12-10 03:23:43.000000000 -0500
    2021-12-10 03:41:19 +++ /tmp/clickhouse-test/0_stateless/02050_client_profile_events.617.stdout	2021-12-10 03:41:19.509611205 -0500
    2021-12-10 03:41:19 @@ -1,4 +1,3 @@
    2021-12-10 03:41:19  0
    2021-12-10 03:41:19 -SelectedRows: 131010 (increment)
    2021-12-10 03:41:19  OK
    2021-12-10 03:41:19  OK
    2021-12-10 03:41:19
    2021-12-10 03:41:19
    2021-12-10 03:41:19 Database: test_73d5o0

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/32493/703213a6444f8014e3324df4b6e44d03fa351294/stateless_tests_flaky_check__address__actions_.html

And I did not find anything strange in server logs (and there was 0
exceptions).
2021-12-19 23:43:05 +03:00

17 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
# do not print any ProfileEvents packets
$CLICKHOUSE_CLIENT -q 'select * from numbers(1e5) format Null' |& grep -c 'SelectedRows'
# print only last (and also number of rows to provide more info in case of failures)
$CLICKHOUSE_CLIENT --print-profile-events --profile-events-delay-ms=-1 -q 'select * from numbers(1e5)' 2> >(grep -o -e 'SelectedRows: .*$' -e Exception) 1> >(wc -l)
# print everything
profile_events="$($CLICKHOUSE_CLIENT --max_block_size 1 --print-profile-events -q 'select sleep(1) from numbers(2) format Null' |& grep -c 'SelectedRows')"
test "$profile_events" -gt 1 && echo OK || echo "FAIL ($profile_events)"
# print each 100 ms
profile_events="$($CLICKHOUSE_CLIENT --max_block_size 1 --print-profile-events --profile-events-delay-ms=100 -q 'select sleep(1) from numbers(2) format Null' |& grep -c 'SelectedRows')"
test "$profile_events" -gt 1 && echo OK || echo "FAIL ($profile_events)"