Skip to content

tests: runtime: Stabilize out_lib test case#11888

Merged
edsiper merged 1 commit into
masterfrom
cosmo0920-stabilize-out_lib-test
Jun 1, 2026
Merged

tests: runtime: Stabilize out_lib test case#11888
edsiper merged 1 commit into
masterfrom
cosmo0920-stabilize-out_lib-test

Conversation

@cosmo0920
Copy link
Copy Markdown
Contributor

@cosmo0920 cosmo0920 commented Jun 1, 2026

In our CI environments, some of the out_lib tests are flaky. So, we need to stabilize it.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • Tests
    • Improved timeout measurement and polling logic in testing suite for more robust timeout validation.

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fda56e0e-f7e0-4ff1-b02c-c4800e7c9251

📥 Commits

Reviewing files that changed from the base of the PR and between 19cc8f9 and b61608e.

📒 Files selected for processing (1)
  • tests/runtime/out_lib.c

📝 Walkthrough

Walkthrough

The PR refines timeout handling in the test_max_records() runtime test by replacing a generic timeout helper with an explicit polling loop that uses precise time measurement via flb_time_* functions to reliably detect when the output count reaches the expected max_records value or when 1000ms elapses.

Changes

Explicit Polling Timeout in test_max_records

Layer / File(s) Summary
Explicit polling loop with precise time measurement
tests/runtime/out_lib.c
test_max_records() declares flb_time variables to track elapsed time and replaces wait_with_timeout() with an inline polling loop that calls get_output_num() every 100ms, measures elapsed nanoseconds using flb_time_diff() and flb_time_to_nanosec(), and breaks when num >= expected or timeout exceeds 1000ms. Comment style in wait_with_timeout() updated to block comment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • fluent/fluent-bit#11810: Both PRs update runtime test timeout/wait logic to poll get_output_num() until an expected output count is reached before timing out.

Suggested labels

docs-required

Suggested reviewers

  • edsiper

Poem

🐰 A timeout loop hops through the test,
Measuring time with flb_time's quest,
Polling for output with patience so keen,
Till records arrive or milliseconds gleam,
The test now waits with precision refined! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically relates to the main change: stabilizing a flaky test case in out_lib by improving timeout handling logic.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cosmo0920-stabilize-out_lib-test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@edsiper edsiper merged commit 909efc4 into master Jun 1, 2026
53 of 54 checks passed
@edsiper edsiper deleted the cosmo0920-stabilize-out_lib-test branch June 1, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants