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

chore(otlp-exporter-*-grpc): clean up tests #5196

Conversation

pichlermarc
Copy link
Member

@pichlermarc pichlermarc commented Nov 25, 2024

Which problem is this PR solving?

All the functionality that's duplicate-tested in all the gRPC exporters is now tested in the exporter base packages as well as in @opentelemetry/otlp-transformer for serialization.

This PR removes the tests from the individual exporters and replaces them with a simple check that tests if

  • gRPC is indeed used
  • using an address connects to the correct address
  • the export succeeds and nothing additional is sent

The previous implementation was heavily relying on constructing export data and asserting the data that is sent, which makes changes to the SDK's internal structure very difficult. This testing is now all handled in @opentelemetry/otlp-transformer so there should be no need to test this again in every individual exporter. The tests had an additional check that ensured that the export also works via Unix domain sockets, so I added another test in the @opentelemtry/otlp-grpc-exporter base package to avoid loosing coverage there.

I also added a comment for future contributors that this tests file is not where they should add any tests that concern base components.

Partially enables #4583 (types exported from @opentelemetry/otlp-transformer are used in testing, by removing test usages, we can remove types that were only used in tests from the public API)

Type of change

  • Internal test update

How Has This Been Tested?

  • Changed tests

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.59%. Comparing base (e35f3d6) to head (c5304c6).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5196   +/-   ##
=======================================
  Coverage   94.59%   94.59%           
=======================================
  Files         314      314           
  Lines        7993     7993           
  Branches     1611     1611           
=======================================
  Hits         7561     7561           
  Misses        432      432           

@pichlermarc pichlermarc added this pull request to the merge queue Nov 26, 2024
Merged via the queue into open-telemetry:main with commit c9fa209 Nov 26, 2024
21 checks passed
@pichlermarc pichlermarc deleted the chore/cleanup-otlp-grpc-exporter-tests branch November 26, 2024 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants