Skip to content

test: add discard output unit coverage#49596

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
test-improve-discard-output-20260323-319f4d6fe4803711
Draft

test: add discard output unit coverage#49596
github-actions[bot] wants to merge 1 commit intomainfrom
test-improve-discard-output-20260323-319f4d6fe4803711

Conversation

@github-actions
Copy link
Contributor

Summary

This PR adds focused unit tests for libbeat/outputs/discard to cover behavior that was previously untested:

  • Publish ACK behavior and observer accounting.
  • invalid queue configuration handling in makeDiscard.
  • bulk_max_size override behavior in makeDiscard.

User scenarios

  • When a user sets output.discard to benchmark or debug pipeline behavior, every emitted event must still be ACKed by the output path so the pipeline can progress correctly.
  • When a user configures output.discard.queue with an invalid queue type, startup should fail with a clear error instead of silently accepting invalid configuration.
  • When a user enables output.discard, the output must disable batching (bulk_max_size = -1) so publisher behavior is consistent with this sink.

Why these tests matter

  • They catch regressions where discard output stops ACKing batches or misreports metrics.
  • They guard config validation/error propagation during output initialization.
  • They protect a key runtime contract (bulk_max_size=-1) used by pipeline behavior.

Tests run

  • go test ./libbeat/outputs/discard
  • go test -count=5 ./libbeat/outputs/discard ✅ (stability/repeatability check)

Removed or merged tests

  • None.

What is this? | From workflow: Test Improver

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Add focused unit tests for discard output:
- Verify Publish ACKs batches and reports observer counters.
- Verify unknown queue config returns an error at output creation.
- Verify makeDiscard forces bulk_max_size to -1.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Mar 23, 2026
@botelastic
Copy link

botelastic bot commented Mar 23, 2026

This pull request doesn't have a Team:<team> label.

@mergify
Copy link
Contributor

mergify bot commented Mar 23, 2026

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @github-actions[bot]? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

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

Labels

needs_team Indicates that the issue/PR needs a Team:* label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants