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

[Python] Tests that init OTel with otel-instrument script should not use TestBase setup method. #168

Closed
NathanielRN opened this issue Oct 27, 2021 · 3 comments
Labels

Comments

@NathanielRN
Copy link
Contributor

Description

As is common with all instrumentations upstream, AWS Lambda instrumentation testing involves using TestBase. TestBase has a default implementation of super().setUpClass() which initializes OTel Python with a TracerProvider.

This is a problem because we want the tests to test the otel-instrument command which ALSO sets the TracerProvider. But setting the TracerProvider a 2nd time is not allowed so the effects of otel-instrument are ignored. What's more, otel-instrument runs as a subshell as of #164 so we'll have to be more clever as to how we propagate its changes to the parent process while also making sure we do NOT prematurely init OTel's TracerProvider with the TestBase default methods.

One solution is to call the upstream opentelemetry-instrumentation auto initialization script ourselves in the test.

@anuraaga
Copy link
Contributor

anuraaga commented Oct 28, 2021

I guess the actual test business logic would best be in the subprocess (currently we just print os.environ but that could be any logic, like a test file including and calling the lambda handler) - having a runner that spawns the function in a subprocess nicely models the lambda execution itself better. Test failure reporting may not be as nice because of the subprocess but these are more like integration tests anyways.

Copy link

github-actions bot commented Aug 4, 2024

This issue was marked stale. It will be closed in 30 days without additional activity.

@github-actions github-actions bot added the Stale label Aug 4, 2024
Copy link

github-actions bot commented Sep 7, 2024

Closed as inactive. Feel free to reopen if this issue is still relevant.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants