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

Add unit tests to instrumentation webhook #3840

Merged

Conversation

shuheiktgw
Copy link
Contributor

Description:

I've added missing unit tests to apis/v1alpha1/instrumentation_webhook_test.go. Thanks for the review!

Link to tracking Issue(s):

N/A

Testing:

Documentation:

Do I need to create a changelog for this change? 🤔

@shuheiktgw shuheiktgw requested a review from a team as a code owner March 22, 2025 08:18
@swiatekm swiatekm added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Mar 22, 2025
assert.Equal(t, "dotnet-img:1", inst.Spec.DotNet.Image)
assert.Equal(t, "apache-httpd-img:1", inst.Spec.ApacheHttpd.Image)
assert.Equal(t, "nginx-img:1", inst.Spec.Nginx.Image)
tests := []struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I preferred the way this test was written previously. You're right to want to add tests for other cases, but I'd prefer these to be plain subtests with unique assertions. Then you can have a test to check the resource override, and only assert that the override applies, instead of needing to include the whole instrumentation spec as an expected return value. Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@swiatekm Thank you for your feedback! I've fixed the PR so could you take a look at it again when you have time?

Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for the contribution!

@swiatekm swiatekm merged commit cbf875b into open-telemetry:main Mar 25, 2025
39 checks passed
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