Commit 76817ec
authored
fix(podlogs): follow mode exit bug and test improvements (cloudnative-pg#9599)
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>1 parent 59db511 commit 76817ec
2 files changed
+27
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
| 223 | + | |
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
153 | 152 | | |
154 | 153 | | |
155 | 154 | | |
156 | | - | |
| 155 | + | |
157 | 156 | | |
158 | | - | |
159 | | - | |
| 157 | + | |
160 | 158 | | |
161 | 159 | | |
| 160 | + | |
| 161 | + | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 163 | | |
168 | | - | |
169 | 164 | | |
170 | 165 | | |
171 | 166 | | |
172 | 167 | | |
173 | 168 | | |
174 | 169 | | |
175 | 170 | | |
176 | | - | |
| 171 | + | |
177 | 172 | | |
178 | 173 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
| 174 | + | |
| 175 | + | |
183 | 176 | | |
184 | 177 | | |
185 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
186 | 193 | | |
187 | 194 | | |
188 | 195 | | |
189 | | - | |
190 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
191 | 200 | | |
192 | 201 | | |
0 commit comments