Skip to content

[ForReview] Refactor otelzap tests 2nd edition #6953

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

Closed
wants to merge 16 commits into from

Conversation

pellared
Copy link
Member

@github-actions github-actions bot requested a review from khushijain21 March 18, 2025 10:28
pellared added a commit to open-telemetry/opentelemetry-go that referenced this pull request May 13, 2025
Fixes #6487
Fixes #6488

Towards #6341

Prior-art: #6464

Replace `AssertRecordEqual` with `AssertEqual` which accepts options and
can work not only with `Record` but most importantly, whole `Recording`.

The changes between the previous approach are inspired by the design of
https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest.
Thanks to it we continue to use the "assert" pattern, but are not
impacted by downsides of `testify`. The main issue is that with
`testify` we cannot force `[]log.KeyValue` to sort slices before
comparing (unordered collection equality). This can make the tests too
much "white-boxed" and can easy break during refactoring. Moreover,
empty and nil slices are seen not equal which in this case is not
relevant.

Here is an example of how the current tests of log bridges can be
improved:
- open-telemetry/opentelemetry-go-contrib#6953
@pellared pellared closed this May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant