tests: fix HTTP JSON stream runtime assertions by cosmo0920 · Pull Request #12582 · fluent/fluent-bit · GitHub
Skip to content

tests: fix HTTP JSON stream runtime assertions - #12582

Open
cosmo0920 wants to merge 1 commit into
masterfrom
cosmo0920-mitigate-frequently-out_http-runtime-tests-failures
Open

cosmo0920 wants to merge 1 commit into
masterfrom
cosmo0920-mitigate-frequently-out_http-runtime-tests-failures

Conversation

@cosmo0920

@cosmo0920 cosmo0920 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

The format_json_stream failure was a timing sensitive test assertion: it expected both records in one formatter callback, although valid flushes can deliver them separately. I updated out_http.c to check complete records across callbacks. I found no memory error in the focused case.

Verification passed:

  • ctest --test-dir build -R '^flb-rt-out_http$' --output-on-failure
  • build/bin/flb-rt-out_http format_json_stream under Valgrind: 0 errors, no definite or possible leaks
  • tests/integration/.venv/bin/python -m pytest tests/integration/scenarios/out_http/tests/test_out_http_001.py::test_out_http_sends_json_payload -q
  • The same integration command with VALGRIND=1 VALGRIND_STRICT=1: passed, 0 Valgrind errors

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 validation of JSON-stream HTTP output across callback flushes. The test now checks that expected records are received exactly once, handles records arriving separately or together, and reports unexpected output or callback errors. It also allows additional time for both records to arrive, reducing reliance on a fixed delay.

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0b14d2af-741c-485c-893e-6d4116176e0f
📥 Commits

Reviewing files that changed from the base of the PR and between 54b97f8 and ec94647.

📒 Files selected for processing: 1
  • tests/runtime/out_http.c

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

📝 Walkthrough

The JSON-stream HTTP formatter test now validates each complete JSON record separately. It polls for up to five seconds and checks that both expected records appear exactly once.

Changes: JSON-stream validation

Layer / File(s) Summary
Record validation and polling
tests/runtime/out_http.c
The callback matches complete expected records, tracks each record separately, and reports unexpected output or callback errors. The test polls every 100 ms for up to 50 iterations and asserts that both expected records appear exactly once.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to ec946

The updated JSON-stream test checks complete records across callbacks and rejects unexpected output. No actionable merge risk was established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 clearly and concisely describes the main change: fixing HTTP JSON stream runtime test assertions.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

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.

1 participant