Skip to content

Add tests for beatsauth extension 1/2#46723

Merged
khushijain21 merged 18 commits into
elastic:mainfrom
khushijain21:addtlstest
Sep 25, 2025
Merged

Add tests for beatsauth extension 1/2#46723
khushijain21 merged 18 commits into
elastic:mainfrom
khushijain21:addtlstest

Conversation

@khushijain21
Copy link
Copy Markdown
Contributor

@khushijain21 khushijain21 commented Sep 22, 2025

Proposed commit message

This PR adds test for translated Elasticsearch exporter configurations works with: mTLS, ca_trusted_fingerprint and verififcation_mode

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
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@khushijain21 khushijain21 requested review from a team as code owners September 22, 2025 10:33
@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 22, 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!)

@khushijain21 khushijain21 changed the title add beatsauth test Add tests for beatsauth extension Sep 22, 2025
@khushijain21 khushijain21 changed the title Add tests for beatsauth extension Add tests for beatsauth extension 1/2 Sep 22, 2025
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Sep 22, 2025

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

@khushijain21 khushijain21 added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Sep 22, 2025
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 22, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@khushijain21 khushijain21 added backport-8.19 Automated backport to the 8.19 branch backport-9.1 Automated backport to the 9.1 branch labels Sep 22, 2025
Copy link
Copy Markdown
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

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

I like this tests but I think they are in the wrong place. As is, they could live with the beatsauth extension itself because they don't depend on anything in Beats.

However, the best version of these tests uses the configuration translation in agent to generate the auth extension configuration and the exporter configuration (I think you'd want the client configuration part of the exporter only to verify there are no TLS parameter conflicts that cause problems).

So I think these tests should move to Elastic Agent. Probably all the configuration translation code should be moved to Elastic Agent but you don't need to do that here.

Comment thread libbeat/otelbeat/oteltest/beatsauth_test.go Outdated
@cmacknz
Copy link
Copy Markdown
Member

cmacknz commented Sep 22, 2025

However, the best version of these tests uses the configuration translation in agent to generate the auth extension configuration and the exporter configuration (I think you'd want the client configuration part of the exporter only to verify there are no TLS parameter conflicts that cause problems).

Now that I've read #46428, you can get pretty close to this once that PR is merged into this one, if you were able to use the translation output for the extension and exporter as the base for the collector component configuration in the tests.

Also since this says 1/2 in the description I assume there are more tests coming for things like proxies which are as critical as TLS, possibly in a separate PR.

@khushijain21
Copy link
Copy Markdown
Contributor Author

Modified the tests to use translated output here 1f76ec0

Copy link
Copy Markdown
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

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

Let's log the translated configuration we generated in each test, and fix the lint errors, then LGTM.

I ran the tests locally and confirmed removing things from the auth extension config broke things in the expected way, and was a really nice way to see the errors the exporter gives us when there are TLS failures.

Comment thread libbeat/otelbeat/oteltest/beatsauth_test.go
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Sep 23, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b addtlstest upstream/addtlstest
git merge upstream/main
git push upstream addtlstest

Copy link
Copy Markdown
Contributor

@andrzej-stencel andrzej-stencel left a comment

Choose a reason for hiding this comment

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

Please make sure to not downgrade the Beats Auth extension - it is v0.3.0 on main.

Good to go when CI is fixed.

Comment thread go.mod Outdated
khushijain21 and others added 3 commits September 24, 2025 13:14
Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
@khushijain21 khushijain21 enabled auto-merge (squash) September 24, 2025 08:12
@cmacknz
Copy link
Copy Markdown
Member

cmacknz commented Sep 24, 2025

LGTM, please silence the lint warnings

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Sep 25, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b addtlstest upstream/addtlstest
git merge upstream/main
git push upstream addtlstest

@khushijain21
Copy link
Copy Markdown
Contributor Author

/test

@khushijain21 khushijain21 merged commit e9bfa88 into elastic:main Sep 25, 2025
207 checks passed
mergify Bot pushed a commit that referenced this pull request Sep 25, 2025
* add beatsauth test for ca_trusted_fingerprint, verification_modes

(cherry picked from commit e9bfa88)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	libbeat/otelbeat/beatconverter/beatconverter_test.go
mergify Bot pushed a commit that referenced this pull request Sep 25, 2025
* add beatsauth test for ca_trusted_fingerprint, verification_modes

(cherry picked from commit e9bfa88)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
#	libbeat/otelbeat/beatconverter/beatconverter_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch backport-9.1 Automated backport to the 9.1 branch 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.

4 participants