Merge pull request #51914 from ClickHouse/fix-flaky-test-02360_send_logs_level_colors

Fix flaky test 02360_send_logs_level_colors: avoid usage of `file` tool
This commit is contained in:
Alexey Milovidov 2023-07-07 19:45:04 +03:00 committed by GitHub
commit ca455b62fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,12 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL=trace
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
file_name="${CLICKHOUSE_TMP}/res_${CLICKHOUSE_DATABASE}.log"
CLICKHOUSE_CLIENT=$(echo ${CLICKHOUSE_CLIENT} | sed 's/'"--send_logs_level=${CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL}"'/--send_logs_level=trace/g')
# Run query via expect to make isatty() return true
function run()
@ -20,8 +21,7 @@ spawn bash -c "$command"
expect 1
EOF
file "$file_name" | grep -o "ASCII text"
file "$file_name" | grep -o "with escape sequences"
grep -F $'\x1b' "$file_name" && cat "$file_name" || echo "ASCII text"
}
run "$CLICKHOUSE_CLIENT -q 'SELECT 1' 2>$file_name"