Skip to content

Commit e1fd486

Browse files
committed
fixup! ✨ util: Warning handler that discards messages that match a regular expression
Fix the test of an uninitialized handler, so that the logger is exercised.
1 parent 8aea874 commit e1fd486

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

util/apiwarnings/handler_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,11 @@ func TestDiscardMatchingHandler(t *testing.T) {
8080
}
8181
}
8282

83-
func TestDiscardMatchingHandler_NilLogger(t *testing.T) {
83+
func TestDiscardMatchingHandler_uninitialized(t *testing.T) {
8484
g := NewWithT(t)
85-
h := DiscardMatchingHandler{
86-
// Logger is nil
87-
}
85+
h := DiscardMatchingHandler{}
8886
g.Expect(func() {
89-
h.HandleWarningHeader(0, "", "")
87+
// Together, the code and message value ensure that the handler logs the message.
88+
h.HandleWarningHeader(299, "", "example")
9089
}).ToNot(Panic())
9190
}

0 commit comments

Comments
 (0)