diff --git a/tests/integration/test_grpc_protocol/test.py b/tests/integration/test_grpc_protocol/test.py index 8c7e958bbd9..a1bc0d42a46 100644 --- a/tests/integration/test_grpc_protocol/test.py +++ b/tests/integration/test_grpc_protocol/test.py @@ -362,44 +362,46 @@ def test_progress(): "SELECT number, sleep(0.31) FROM numbers(8) SETTINGS max_block_size=2, interactive_delay=100000", stream_output=True, ) + results = list(results) for result in results: result.time_zone = "" result.query_id = "" # print(results) - assert ( - str(results) - == """[output_format: "TabSeparated" -progress { - read_rows: 2 - read_bytes: 16 - total_rows_to_read: 8 -} -, output: "0\\t0\\n1\\t0" -, progress { - read_rows: 2 - read_bytes: 16 -} -, output: "\\n2\\t0\\n3\\t0" -, progress { - read_rows: 2 - read_bytes: 16 -} -, output: "\\n4\\t0\\n5\\t0" -, progress { - read_rows: 2 - read_bytes: 16 -} -, output: "\\n6\\t0\\n7\\t0" -, output: "\\n" -stats { - rows: 8 - blocks: 4 - allocated_bytes: 1092 - applied_limit: true - rows_before_limit: 8 -} -]""" - ) + + # Note: We can't convert those messages to string like `results = str(results)` and then compare it as a string + # because str() can serialize a protobuf message with any order of fields. + expected_results = [ + clickhouse_grpc_pb2.Result( + output_format="TabSeparated", + progress=clickhouse_grpc_pb2.Progress( + read_rows=2, read_bytes=16, total_rows_to_read=8 + ), + ), + clickhouse_grpc_pb2.Result(output=b"0\t0\n1\t0\n"), + clickhouse_grpc_pb2.Result( + progress=clickhouse_grpc_pb2.Progress(read_rows=2, read_bytes=16) + ), + clickhouse_grpc_pb2.Result(output=b"2\t0\n3\t0\n"), + clickhouse_grpc_pb2.Result( + progress=clickhouse_grpc_pb2.Progress(read_rows=2, read_bytes=16) + ), + clickhouse_grpc_pb2.Result(output=b"4\t0\n5\t0\n"), + clickhouse_grpc_pb2.Result( + progress=clickhouse_grpc_pb2.Progress(read_rows=2, read_bytes=16) + ), + clickhouse_grpc_pb2.Result(output=b"6\t0\n7\t0\n"), + clickhouse_grpc_pb2.Result( + stats=clickhouse_grpc_pb2.Stats( + rows=8, + blocks=4, + allocated_bytes=1092, + applied_limit=True, + rows_before_limit=8, + ) + ), + ] + + assert results == expected_results def test_session_settings():