1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-27 22:49:15 +02:00
Files
opentelemetry-go/log
Robert Pająk bf7ffa3900 log/logtest: Add AssertEqual and remove AssertRecordEqual (#6662)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6487
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6488

Towards https://github.com/open-telemetry/opentelemetry-go/issues/6341

Prior-art: https://github.com/open-telemetry/opentelemetry-go/pull/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:
- https://github.com/open-telemetry/opentelemetry-go-contrib/pull/6953
2025-05-13 21:13:59 +02:00
..
2025-03-05 22:23:10 -08:00
2024-03-26 20:13:54 +01:00
2025-01-22 15:02:47 +01:00
2025-01-22 17:46:47 +01:00