Skip to content

Commit 586450e

Browse files
committed
Improve waiting for specific line in logs in integration tests
Recently CI found the failure of test_postgresql_replica_database_engine [1], but, according to logs: - the grep executed **before** the log entry appeared in logs - the log entry appeared **before** timeout expired <details> <summary>logs</summary> ``` 2025-08-21 16:45:14.632000 [ 683 ] DEBUG : Command:[docker exec roottestpostgresqlreplicadatabaseengine0-gw0-instance-1 bash -c timeout 30 tail -Fn100 "/var/log/clickhouse-server/clickhouse-server.log" | grep -Em 1 'Table postgresql_replica_2 is skipped from replication stream'] (cluster.py:159, run_and_check) 2025-08-21 16:45:44.679000 [ 683 ] DEBUG : Exitcode:1 (cluster.py:187, run_and_check) ``` ``` 2025.08.21 16:45:14.638793 [ 962 ] {BgSchPool::8d13df61-833b-4141-83e2-0e8e1c30d1c9} <Information> PostgreSQLReplicaConsumer(postgres_database): Table structure of the table postgresql_replica_2 changed (column value2 was not found), will mark it as skipped from replication. Please perform manual DETACH and ATTACH of the table to bring it back 2025.08.21 16:45:14.638813 [ 962 ] {BgSchPool::8d13df61-833b-4141-83e2-0e8e1c30d1c9} <Warning> PostgreSQLReplicaConsumer(postgres_database): Table postgresql_replica_2 is skipped from replication stream because its structure has changes. Please detach this table and reattach to resume the replication (relation id: 16583) ``` </details> But the test was not succeeded in locating this line. [1]: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=85765&sha=d9c83add6087386351df45010de71b027af87a76&name_0=PR&name_1=Integration%20tests%20%28amd_binary%2C%204%2F5%29 I don't see any other reason except for line buffer for this to happen, so let's disable it with `stdbuf`. Also I've added some introspection with `tee /dev/stderr`, so that now we will see all entries that the `grep` received.
1 parent bbf79e9 commit 586450e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/integration/helpers/cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4741,7 +4741,7 @@ def wait_for_log_line(
47414741
[
47424742
"bash",
47434743
"-c",
4744-
'timeout {} tail -Fn{} "{}" | grep -Em {} {}'.format(
4744+
'timeout {} stdbuf -o0 -e0 tail -Fn{} "{}" | stdbuf -o0 -e0 tee /dev/stderr | grep -Em {} {}'.format(
47454745
timeout,
47464746
look_behind_lines,
47474747
filename,

0 commit comments

Comments
 (0)