client-go/test: warning handler with contextual logging

The default handler now uses contextual logging. Instead of

     warnings.go:106] warning 1

it now logs the caller of client-go and uses structured, contextual
logging

     main.go:100] "Warning" message="warning 1"

Users of client-go have the choice whether the handler that they provide uses
the traditional API (no API break!) or contextual logging.

Kubernetes-commit: 48fb886325fce4b16e4067caadb7bcd3044d460f
This commit is contained in:
Patrick Ohly
2024-09-02 17:51:01 +02:00
committed by Kubernetes Publisher
parent 9897373fe6
commit 2b2015d460
8 changed files with 343 additions and 61 deletions

View File

@@ -242,6 +242,9 @@ func TestConfigToExecClusterRoundtrip(t *testing.T) {
func(h *WarningHandler, f fuzz.Continue) {
*h = &fakeWarningHandler{}
},
func(h *WarningHandlerWithContext, f fuzz.Continue) {
*h = &fakeWarningHandlerWithContext{}
},
// Authentication does not require fuzzer
func(r *AuthProviderConfigPersister, f fuzz.Continue) {},
func(r *clientcmdapi.AuthProviderConfig, f fuzz.Continue) {
@@ -289,6 +292,7 @@ func TestConfigToExecClusterRoundtrip(t *testing.T) {
expected.Burst = 0
expected.RateLimiter = nil
expected.WarningHandler = nil
expected.WarningHandlerWithContext = nil
expected.Timeout = 0
expected.Dial = nil