Skip to content

refactor(log/logtest): update AssertEqual to accept TestingT for benchmark support #6908

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

flc1125
Copy link
Member

@flc1125 flc1125 commented Jun 17, 2025

This might just be a minor optimization, a non-functional change. Perhaps it can skip the CHANGELOG.

Copy link

codecov bot commented Jun 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.9%. Comparing base (2cce189) to head (77236b9).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #6908     +/-   ##
=======================================
+ Coverage   82.3%   82.9%   +0.6%     
=======================================
  Files        263     261      -2     
  Lines      24476   24259    -217     
=======================================
- Hits       20151   20122     -29     
+ Misses      3942    3760    -182     
+ Partials     383     377      -6     
Files with missing lines Coverage Δ
log/logtest/assert.go 100.0% <100.0%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmathieu dmathieu added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jun 17, 2025
Copy link
Member

@dmathieu dmathieu left a comment

Choose a reason for hiding this comment

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

Skipping changelog, as this module isn't released yet.

@pellared
Copy link
Member

pellared commented Jun 17, 2025

I am not sure we are inn favor of this change.

Please see the conversation here: See: #6662 (comment)

My initial proposal was to expose TestingT interface to make it even easier to reuse as this would be a "thinner" interface (so that e.g. https://pkg.go.dev/github.com/goyek/goyek/v2#A would implement this interface).

// TestingT reports failure messages.
// *testing.T, *testing.B, *testing.F  implement this interface.
type TestingT interface {
	Errorf(format string, args ...any)
}

What are the benefits of using testing.TB over exposing our own interface?
How this change addresses concerns from the original proposal.

@flc1125
Copy link
Member Author

flc1125 commented Jun 17, 2025

TestingT

I also agree with exposing the TestingT interface. Apply the principle of least privilege. This way, control can be higher.

@pellared pellared changed the title refactor(log/logtest): update AssertEqual to accept testing.TB for benchmark support refactor(log/logtest): update AssertEqual to accept TestingT for benchmark support Jun 17, 2025
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