fix(podlogs): Follow mode exit bug and test improvements#9599
fix(podlogs): Follow mode exit bug and test improvements#9599leonardoce merged 2 commits intomainfrom
Conversation
|
❗ By default, the pull request is configured to backport to all release branches.
|
d6cc96d to
027c158
Compare
|
/ok-to-merge test only change |
027c158 to
2bda92a
Compare
2bda92a to
73a08a5
Compare
|
One of the executions of the improved test failed in CI: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/20791171388/job/59713483662?pr=9599 The failure exposed a bug in The race occurred because log streams could complete before the main loop checked for active streams, causing premature exit. Fixed by adding |
3203816 to
a48a08c
Compare
|
/test |
|
@mnencia, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/20885430224 |
a48a08c to
22baf8e
Compare
The Follow=true test was flaky in CI because it tested implementation details (counting loop iterations with tight timing) rather than actual behavior. Redesigned the test to verify what Follow=true actually does: it keeps streaming until the context is cancelled, rather than exiting after one read. The test now checks that streaming starts, continues running without exiting on its own, and only stops when we cancel the context. This approach uses Eventually/Consistently patterns that handle timing variations gracefully, making it robust across different environments. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Fixed a bug where Follow=true would exit prematurely when all current log streams completed, instead of continuing to poll for new or restarted pods. Changed the exit condition on zero active streams to only apply when Follow=false, allowing Follow mode to keep looping as intended. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
22baf8e to
53265c6
Compare
The test "should catch extra logs if given the follow option" was flaky in CI because it tested implementation details (counting loop iterations with tight timing) rather than actual behavior. Redesigned the test to verify what Follow=true actually does: it keeps streaming until the context is cancelled. The test now uses Eventually/Consistently patterns that handle timing variations gracefully, making it robust across different environments. The improved test exposed a bug in the production code: the streaming function would exit when all current log streams completed, even when Follow=true was set. This caused premature exit instead of continuing to poll for new or restarted pods. Fixed by changing the exit condition to only apply when Follow=false. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> (cherry picked from commit 76817ec)
The test "should catch extra logs if given the follow option" was flaky in CI because it tested implementation details (counting loop iterations with tight timing) rather than actual behavior. Redesigned the test to verify what Follow=true actually does: it keeps streaming until the context is cancelled. The test now uses Eventually/Consistently patterns that handle timing variations gracefully, making it robust across different environments. The improved test exposed a bug in the production code: the streaming function would exit when all current log streams completed, even when Follow=true was set. This caused premature exit instead of continuing to poll for new or restarted pods. Fixed by changing the exit condition to only apply when Follow=false. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> (cherry picked from commit 76817ec)
The test "should catch extra logs if given the follow option" was flaky in CI because it tested implementation details (counting loop iterations with tight timing) rather than actual behavior. Redesigned the test to verify what Follow=true actually does: it keeps streaming until the context is cancelled. The test now uses Eventually/Consistently patterns that handle timing variations gracefully, making it robust across different environments. The improved test exposed a bug in the production code: the streaming function would exit when all current log streams completed, even when Follow=true was set. This caused premature exit instead of continuing to poll for new or restarted pods. Fixed by changing the exit condition to only apply when Follow=false. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> (cherry picked from commit 76817ec)
The test "should catch extra logs if given the follow option" was flaky in CI because it tested implementation details (counting loop iterations with tight timing) rather than actual behavior. Redesigned the test to verify what Follow=true actually does: it keeps streaming until the context is cancelled. The test now uses Eventually/Consistently patterns that handle timing variations gracefully, making it robust across different environments. The improved test exposed a bug in the production code: the streaming function would exit when all current log streams completed, even when Follow=true was set. This caused premature exit instead of continuing to poll for new or restarted pods. Fixed by changing the exit condition to only apply when Follow=false. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> (cherry picked from commit 76817ec)
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
The test "should catch extra logs if given the follow option" was flaky in CI because it tested implementation details (counting loop iterations with tight timing) rather than actual behavior.
Redesigned the test to verify what Follow=true actually does: it keeps streaming until the context is cancelled. The test now uses Eventually/Consistently patterns that handle timing variations gracefully, making it robust across different environments.
The improved test exposed a bug in the production code: the streaming function would exit when all current log streams completed, even when Follow=true was set. This caused premature exit instead of continuing to poll for new or restarted pods. Fixed by changing the exit condition to only apply when Follow=false.