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

[TEST] See if contrib tests break with a panic on configopaque fmt.Stringer impl #9268

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/configopaque/opaque.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ func (s String) MarshalText() ([]byte, error) {
}

func (s String) String() string {
go func() { panic("testing if this is called somewhere else") }()
return maskedString
}
2 changes: 1 addition & 1 deletion config/configopaque/opaque_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestStringFmt(t *testing.T) {
examples := []String{"opaque", "s", "veryveryveryveryveryveryveryveryveryverylong"}
for _, example := range examples {
// nolint S1025
assert.Equal(t, "[REDACTED]", fmt.Sprintf("%s", example))
assert.Panics(t, func() { fmt.Sprintf("%s", example) })
// converting to a string allows to output as an unredacted string still:
// nolint S1025
assert.Equal(t, string(example), fmt.Sprintf("%s", string(example)))
Expand Down
Loading