Skip to content

Conversation

khushijain21
Copy link
Contributor

@khushijain21 khushijain21 commented Sep 25, 2025

What does this PR do?

This PR moves mock proxy server files from https://github.com/elastic/elastic-agent/blob/615190be3f6a28403883f6b4983764558173e0e7/testing/proxytest/proxytest.go

and https://github.com/elastic/elastic-agent/blob/615190be3f6a28403883f6b4983764558173e0e7/testing/proxytest/https.go

to elastic-agent-libs so that they can be used by beats as well.

It also makes a small change to the original code. proxy-server now writes the incoming headers first and then the status code.

Why is it important?

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

Related issues

@khushijain21 khushijain21 requested a review from a team as a code owner September 25, 2025 13:55
@khushijain21 khushijain21 requested review from belimawr and leehinman and removed request for a team September 25, 2025 13:55
@khushijain21 khushijain21 marked this pull request as draft September 25, 2025 13:55
@khushijain21 khushijain21 changed the title add proxy test Move mock proxy test server from elastic-agent to elastic-agent-libs for common use Sep 25, 2025
@khushijain21 khushijain21 changed the title Move mock proxy test server from elastic-agent to elastic-agent-libs for common use Move mock proxy test server from elastic-agent to elastic-agent-libs for common use Sep 25, 2025
@khushijain21 khushijain21 marked this pull request as ready for review September 25, 2025 15:38
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Sep 26, 2025
@AndersonQ AndersonQ self-requested a review September 26, 2025 09:06
Copy link
Member

@AndersonQ AndersonQ left a comment

Choose a reason for hiding this comment

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

@khushijain21, could you bring the whole proxytest package from the agent repo? On elastic-agent/testing/proxytest there are 2 important files which are not there, the tests for the proxy and an example of how to use it as a "cli" application.

Copy link
Contributor

@belimawr belimawr left a comment

Choose a reason for hiding this comment

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

I agree with @AndersonQ, it's better to bring the whole package, which includes the tests.

It also makes a small change to the original code. proxy-server now writes the incoming headers first and then the status code.

This is actually a bugfix. The headers should be fully set before calling WriteHeader. Thanks for fixing that!

@khushijain21
Copy link
Contributor Author

could you bring the whole proxytest package from the agent repo?

done

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

@khushijain21 khushijain21 merged commit 31afddc into elastic:main Sep 29, 2025
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants