1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00
Commit Graph

6 Commits

Author SHA1 Message Date
Robert Pająk 99b2206d11 log/logtest: add Error field to Record type (#8148)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/8147
2026-04-08 09:41:26 +02:00
Flc゛ 80cb909774 refactor: replace context.Background() with t.Context()/b.Context() in tests (#7352)
Based on the Go version we currently use, the dependency already
supports 1.24+, which allows using `t.Context()` and `b.Context()` in
unit tests and benchmarks respectively.

- Enable `context-background` and `context-todo` in
[`usetesting`](https://golangci-lint.run/docs/linters/configuration/#usetesting)
- Adjust the code to support linter detection

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
2025-09-23 09:52:45 +02:00
Flc゛ 186bd18db4 log/logtest: change AssertEqual to accept TestingT for benchmark support (#6908) 2025-07-07 12:13:53 +02:00
Robert Pająk 3f85c35038 logtest: add Desc (#6796)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6490

Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6341
2025-05-21 09:15:30 +02:00
Robert Pająk fe523bd15a logtest: add Transform (#6794)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6491
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/6489

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

Per
https://github.com/open-telemetry/opentelemetry-go/pull/6774#discussion_r2091424563
2025-05-20 10:54:48 +02:00
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