chore: refactor set in collection package (#5016)

This commit is contained in:
Kevin Wan
2025-07-18 21:25:40 +08:00
committed by GitHub
parent bf6ef5f033
commit 3c9b6335fb
5 changed files with 74 additions and 441 deletions

View File

@@ -88,7 +88,7 @@ func TestLogDuration(t *testing.T) {
assert.NotPanics(t, func() {
logDuration(test.ctx, "foo", test.req, test.duration,
collection.NewSet(), test.durationThreshold)
collection.NewSet[string](), test.durationThreshold)
})
})
}
@@ -150,7 +150,7 @@ func TestLogDurationWithoutContent(t *testing.T) {
assert.NotPanics(t, func() {
logDuration(test.ctx, "foo", test.req, test.duration,
collection.NewSet(), test.durationThreshold)
collection.NewSet[string](), test.durationThreshold)
})
})
}
@@ -206,9 +206,10 @@ func Test_shouldLogContent(t *testing.T) {
t.Cleanup(func() {
ignoreContentMethods = sync.Map{}
})
set := collection.NewSet()
set.AddStr(tt.args.staticNotLoggingContentMethods...)
assert.Equalf(t, tt.want, shouldLogContent(tt.args.method, set), "shouldLogContent(%v, %v)", tt.args.method, tt.args.staticNotLoggingContentMethods)
set := collection.NewSet[string]()
set.Add(tt.args.staticNotLoggingContentMethods...)
assert.Equalf(t, tt.want, shouldLogContent(tt.args.method, set),
"shouldLogContent(%v, %v)", tt.args.method, tt.args.staticNotLoggingContentMethods)
})
}
}