Skip to content

tests: runtime: Use more concrete matchers for assertions#12014

Open
cosmo0920 wants to merge 1 commit into
masterfrom
cosmo0920-plug-duplicated-result-on-out_tcp-test
Open

tests: runtime: Use more concrete matchers for assertions#12014
cosmo0920 wants to merge 1 commit into
masterfrom
cosmo0920-plug-duplicated-result-on-out_tcp-test

Conversation

@cosmo0920

@cosmo0920 cosmo0920 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

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 TCP JSON/msgpack output validation to support deferred “expected substring” checks, including optional JSON-array structure requirements.
    • Added post-validation to ensure every expected output fragment was observed after flushing.
    • Corrected negative-integer string comparison behavior to match parsed signed values more accurately.
    • Refined one JSON output expectation by splitting it into multiple fragments for more reliable matching.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

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: 8ccff5f9-02e0-4c38-b90d-a295894ff1ba

📥 Commits

Reviewing files that changed from the base of the PR and between 004a3de and 6ab83c1.

📒 Files selected for processing (1)
  • tests/runtime/out_tcp.c
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/runtime/out_tcp.c

📝 Walkthrough

Walkthrough

tests/runtime/out_tcp.c adds deferred match tracking to str_list, validates JSON-array payloads, fixes negative integer comparison in msgpack_strncmp, and updates flb_test_format_json to check two JSON fragments after flushing.

Changes

TCP Output Test Match Tracking

Layer / File(s) Summary
str_list match tracking infrastructure
tests/runtime/out_tcp.c
Adds deferred match fields and JSON-array validation helpers to str_list, updates cb_check_str_list to record matches, and adds check_str_list_matches() for later completeness checks.
msgpack negative integer comparison
tests/runtime/out_tcp.c
msgpack_strncmp compares parsed negative values directly against obj.via.i64.
format_json expectation update
tests/runtime/out_tcp.c
Splits the expected JSON into two fragments, wires in matches[] plus JSON-array flags, and validates that both fragments were observed after flush.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop, hop, the tests align,
Two JSON bits now match in line.
A rabbit checks each count with care,
And negative numbers compare fair.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.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 accurately reflects the test-suite change toward more concrete assertion matching in runtime tests.
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.
✨ 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-plug-duplicated-result-on-out_tcp-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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 004a3deaa8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/runtime/out_tcp.c
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@cosmo0920 cosmo0920 force-pushed the cosmo0920-plug-duplicated-result-on-out_tcp-test branch from 004a3de to 6ab83c1 Compare June 29, 2026 07:49
@cosmo0920 cosmo0920 changed the title tests: runtime: Use more concrete matcher for assertions tests: runtime: Use more concrete matchers for assertions Jun 29, 2026
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