Skip to content

Use logp.NewNopLogger for TestGenerateProcessorList#47316

Merged
belimawr merged 1 commit into
elastic:mainfrom
belimawr:fix-TestGenerateProcessorList
Oct 24, 2025
Merged

Use logp.NewNopLogger for TestGenerateProcessorList#47316
belimawr merged 1 commit into
elastic:mainfrom
belimawr:fix-TestGenerateProcessorList

Conversation

@belimawr
Copy link
Copy Markdown
Member

Proposed commit message

Because logptest.NewTestingLogger uses the testing.T as the output for the logger, it could happen that the processors would log after the test had ended, leading to a panic.

This commit fixes it by using a no-op logger instead.

Example of the test failing: https://buildkite.com/elastic/beats-libbeat/builds/22486/steps/canvas?jid=019a1301-63ab-498b-b294-88e04f93bd9d#019a1301-63ab-498b-b294-88e04f93bd9d/210-617

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

## Disruptive User Impact
## Author's Checklist

How to test this PR locally

cd libbeat/publisher/processing
go test -v -count=1 -run=TestGenerateProcessorList .

## Related issues
## Use cases
## Screenshots
## Logs

Because logptest.NewTestingLogger uses the testing.T as the output for
the logger, it could happen that the processors would log after the
test had ended, leading to a panic.

This commit fixes it by using a no-op logger instead.
@belimawr belimawr self-assigned this Oct 23, 2025
@belimawr belimawr requested a review from a team as a code owner October 23, 2025 22:14
@belimawr belimawr added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team skip-changelog labels Oct 23, 2025
@belimawr belimawr requested review from faec and leehinman October 23, 2025 22:14
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic Bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Oct 23, 2025
@github-actions
Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Oct 23, 2025

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @belimawr? 🙏.
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.

@belimawr belimawr added backport-9.1 Automated backport to the 9.1 branch backport-9.2 Automated backport to the 9.2 branch labels Oct 23, 2025
@belimawr belimawr merged commit 34f3c91 into elastic:main Oct 24, 2025
217 of 219 checks passed
mergify Bot pushed a commit that referenced this pull request Oct 24, 2025
Because logptest.NewTestingLogger uses the testing.T as the output for
the logger, it could happen that the processors would log after the
test had ended, leading to a panic.

This commit fixes it by using a no-op logger instead.

(cherry picked from commit 34f3c91)
mergify Bot pushed a commit that referenced this pull request Oct 24, 2025
Because logptest.NewTestingLogger uses the testing.T as the output for
the logger, it could happen that the processors would log after the
test had ended, leading to a panic.

This commit fixes it by using a no-op logger instead.

(cherry picked from commit 34f3c91)
belimawr added a commit that referenced this pull request Oct 24, 2025
Because logptest.NewTestingLogger uses the testing.T as the output for
the logger, it could happen that the processors would log after the
test had ended, leading to a panic.

This commit fixes it by using a no-op logger instead.

(cherry picked from commit 34f3c91)

Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co>
belimawr added a commit that referenced this pull request Oct 24, 2025
Because logptest.NewTestingLogger uses the testing.T as the output for
the logger, it could happen that the processors would log after the
test had ended, leading to a panic.

This commit fixes it by using a no-op logger instead.

(cherry picked from commit 34f3c91)

Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co>
andrzej-stencel pushed a commit to andrzej-stencel/beats that referenced this pull request Dec 1, 2025
Because logptest.NewTestingLogger uses the testing.T as the output for
the logger, it could happen that the processors would log after the
test had ended, leading to a panic.

This commit fixes it by using a no-op logger instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-9.1 Automated backport to the 9.1 branch backport-9.2 Automated backport to the 9.2 branch skip-changelog Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants