Skip to content

stale_response.test.py: address log wait flakiness#13323

Open
bneradt wants to merge 1 commit into
apache:masterfrom
bneradt:fix-stale-response-log-wait
Open

stale_response.test.py: address log wait flakiness#13323
bneradt wants to merge 1 commit into
apache:masterfrom
bneradt:fix-stale-response-log-wait

Conversation

@bneradt

@bneradt bneradt commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

The stale_response log checks can run before every directive that
they later assert has been written. Waiting for one marker with a
sleep-based process leaves the final content checks exposed to ATS log
flush timing when both stale directives are expected.

This replaces the sleep-based watcher with explicit await runs for each
directive being asserted. The test now waits for the matching
stale-while-revalidate and stale-if-error entries before performing the
final log content checks.

Fixes: #13301

Copilot AI review requested due to automatic review settings June 24, 2026 20:43
@bneradt bneradt added this to the 11.0.0 milestone Jun 24, 2026
@bneradt bneradt self-assigned this Jun 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bneradt bneradt force-pushed the fix-stale-response-log-wait branch from c71c621 to 3826654 Compare June 24, 2026 20:52
@maskit maskit requested a review from Copilot June 24, 2026 21:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread tests/gold_tests/pluginTest/stale_response/stale_response.test.py Outdated
@bneradt bneradt force-pushed the fix-stale-response-log-wait branch from 3826654 to 4437425 Compare June 24, 2026 21:41
The stale_response log checks can run before every directive that
they later assert has been written. Waiting for one marker with a
sleep-based process leaves the final content checks exposed to ATS log
flush timing when both stale directives are expected.

This replaces the sleep-based watcher with explicit await runs for each
directive being asserted. The test now waits for the matching
stale-while-revalidate and stale-if-error entries before performing the
final log content checks.

Fixes: apache#13301
@bneradt bneradt force-pushed the fix-stale-response-log-wait branch from 4437425 to 86d058e Compare June 25, 2026 18:45
Copilot AI review requested due to automatic review settings June 25, 2026 18:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bryancall bryancall requested a review from moonchen June 29, 2026 22:34

@moonchen moonchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good. One optional suggestion below.

Comment on lines +146 to +151
def expect_log_entry(pattern: str, description: str, still_running_after: bool = False) -> None:
tr = Test.AddAwaitFileContainsTestRun(f"Await {description}", self._ts.Disk.stale_responses_log.AbsPath, pattern)
tr.StillRunningBefore = self._ts
if still_running_after:
tr.StillRunningAfter = self._ts
self._ts.Disk.stale_responses_log.Content += Testers.ContainsExpression(pattern, f"Verify {description}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old waiter run set StillRunningAfter = self._ts in every branch; with the flag, the FORCE_SWR/FORCE_SIE variants no longer check that ATS is still alive after the directive is flushed. Setting it unconditionally restores that and removes the asymmetry.

Suggested change
def expect_log_entry(pattern: str, description: str, still_running_after: bool = False) -> None:
tr = Test.AddAwaitFileContainsTestRun(f"Await {description}", self._ts.Disk.stale_responses_log.AbsPath, pattern)
tr.StillRunningBefore = self._ts
if still_running_after:
tr.StillRunningAfter = self._ts
self._ts.Disk.stale_responses_log.Content += Testers.ContainsExpression(pattern, f"Verify {description}")
def expect_log_entry(pattern: str, description: str) -> None:
tr = Test.AddAwaitFileContainsTestRun(f"Await {description}", self._ts.Disk.stale_responses_log.AbsPath, pattern)
tr.StillRunningBefore = self._ts
tr.StillRunningAfter = self._ts
self._ts.Disk.stale_responses_log.Content += Testers.ContainsExpression(pattern, f"Verify {description}")

p.Command = 'echo "Waiting upon the stale response log."'
p.StartBefore(log_waiter)
p.StillRunningAfter = self._ts
expect_log_entry(swr_log_pattern, "stale-while-revalidate directive is logged", still_running_after=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(goes with the helper change above)

Suggested change
expect_log_entry(swr_log_pattern, "stale-while-revalidate directive is logged", still_running_after=True)
expect_log_entry(swr_log_pattern, "stale-while-revalidate directive is logged")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status
Status: No status

Development

Successfully merging this pull request may close these issues.

Intermittent AuTest failure: stale_response (directive missing from stale_responses.log)

3 participants