Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[internal/common/testutil] Add support for testing listening udp ports #12888

Merged
merged 2 commits into from
Aug 2, 2022

Conversation

jspaleta
Copy link
Contributor

@jspaleta jspaleta commented Aug 2, 2022

Description:
Refactored the internal testutil functions for available port discovery used in component service mocking to be able to support udp ports similarly to existing tcp port functionality. Once this is merged, this should provide a path forward to fixing racy tests for all UDP listening components (ex: statsd and carbon receivers), where the tests are currently marked to be skipped.

Summary of changes:

  • Extended the internal testutil functions to make it possible to mock listening UDP ports for components that make use of udp listening servers (ex: statsd receiver).

  • The existing findAvailableAddress function was refactored to support both net.Listen and net.ListenPacket supported network types. net.ListenPacket is needed for udp available port discovery.

  • A new testutil function GetAvailableLocalNetworkAddress was added that exposes the network string argument needed for net.Listen and net.ListenPacket used in findAvailableAddress.

  • The existing GetAvailableLocalAddress function is refactored as a wrapper around GetAvailableLocalNetworkAddress to provide backwards compatible behavior for all existing functional mock tcp listening test.

Ref Issue:
#10916

Link to tracking Issue:

Testing:
Added new test for finding free UDP listening port.

Documentation:
No additional documentation added.

@jspaleta jspaleta requested review from a team and dmitryax August 2, 2022 07:20
@djaglowski djaglowski changed the title Add support for testing listening udp ports [internal/common/testutil] Add support for testing listening udp ports Aug 2, 2022
@djaglowski djaglowski added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Aug 2, 2022
Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @jspaleta!

@djaglowski djaglowski merged commit d00fbea into open-telemetry:main Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants