Skip to content

Conversation

khushijain21
Copy link
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
Copy link
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
Copy link
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
Collaborator

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
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.

for _, m := range sm.Metrics {
switch d := m.Data.(type) {
case metricdata.Sum[int64]:
if len(d.DataPoints) >= 1 {
Copy link
Member

Choose a reason for hiding this comment

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

These should be looking at one of the specific metrics, probably bulk.index.total or bulk.create.total depending on which on increments on an initial write.

Copy link
Member

Choose a reason for hiding this comment

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

Same comment in the other locations.

One of the metrics incrementing indicating indexing actually failed shouldn't allow the test to pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

using "bulk.create.ok" metric now - since this is incremented only when the the event is successfully indexed

https://github.com/elastic/mock-es/blob/main/pkg/api/api.go#L328

@cmacknz
Copy link
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.

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.

3 participants