Fix flaky test by ignoring progress lines when comparing output

This commit is contained in:
Alexey Korepanov 2024-07-24 17:56:14 +01:00
parent b0ec8c92fc
commit caaf14a0a9
2 changed files with 11 additions and 13 deletions

View File

@ -1,15 +1,13 @@
1
{"meta": [{"name":"value", "type":"UInt8"}, {"name":"name", "type":"String"}, {"name":"sleep(0.1)", "type":"UInt8"}]}}
{"progress":{"read_rows":"3","read_bytes":"33","written_rows":"0","written_bytes":"0","total_rows_to_read":"3","result_rows":"0","result_bytes":"0","elapsed_ns":"ELAPSED_NS"}}
{"data":[1, "a", 0]}
{"data":[2, "b", 0]}
{"data":[3, "c", 0]}
{"meta": [{"name":"value", "type":"UInt8"}, {"name":"name", "type":"String"}]}}
{"data":[1, "a"]}
{"data":[2, "b"]}
{"data":[3, "c"]}
{"statistics": {"rows":3, "elapsed":ELAPSED, "rows_read":3, "bytes_read":33}}
2
{"meta": [{"name":"name", "type":"String"}, {"name":"count()", "type":"UInt64"}, {"name":"c", "type":"UInt8"}]}}
{"progress":{"read_rows":"3","read_bytes":"30","written_rows":"0","written_bytes":"0","total_rows_to_read":"3","result_rows":"0","result_bytes":"0","elapsed_ns":"ELAPSED_NS"}}
{"data":["a", "1", 0]}
{"data":["b", "1", 0]}
{"data":["c", "1", 0]}
{"totals": ["", "3", 0]}}
{"meta": [{"name":"name", "type":"String"}, {"name":"c", "type":"UInt64"}]}}
{"data":["a", "1"]}
{"data":["b", "1"]}
{"data":["c", "1"]}
{"totals": ["", "3"]}
{"statistics": {"rows":3, "elapsed":ELAPSED, "rows_read":3, "bytes_read":30}}

View File

@ -11,10 +11,10 @@ $CLICKHOUSE_CLIENT -q "SELECT 1;"
# Check JSONCompactWithProgress Output
$CLICKHOUSE_CLIENT -q "CREATE TABLE test_table (value UInt8, name String) ENGINE = MergeTree() ORDER BY value;"
$CLICKHOUSE_CLIENT -q "INSERT INTO test_table VALUES (1, 'a'), (2, 'b'), (3, 'c');"
$CLICKHOUSE_CLIENT -q "SELECT *, sleep(0.1) FROM test_table FORMAT JSONCompactWithProgress settings max_block_size=2;" | sed -E 's/"elapsed_ns":"[0-9]+"/"elapsed_ns":"ELAPSED_NS"/g; s/"elapsed":[0-9]+\.[0-9]+/"elapsed":ELAPSED/g'
$CLICKHOUSE_CLIENT -q "SELECT * FROM test_table FORMAT JSONCompactWithProgress settings max_block_size=2;" | grep -v --text "progress" | sed -E 's/"elapsed":[0-9]+\.[0-9]+/"elapsed":ELAPSED/g'
$CLICKHOUSE_CLIENT -q "SELECT 2;"
# Check Totals
$CLICKHOUSE_CLIENT -q "SELECT name, count(), sleep(0.1) AS c FROM test_table GROUP BY name WITH TOTALS ORDER BY name FORMAT JSONCompactWithProgress settings max_block_size=2;" | sed -E 's/"elapsed_ns":"[0-9]+"/"elapsed_ns":"ELAPSED_NS"/g; s/"elapsed":[0-9]+\.[0-9]+/"elapsed":ELAPSED/g'
$CLICKHOUSE_CLIENT -q "SELECT name, count() AS c FROM test_table GROUP BY name WITH TOTALS ORDER BY name FORMAT JSONCompactWithProgress settings max_block_size=2;" | grep -v --text "progress" | sed -E 's/"elapsed":[0-9]+\.[0-9]+/"elapsed":ELAPSED/g'
$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test_table;"