MCPcopy
hub / github.com/kubernetes/client-go / TestAnonymousConfig

Function TestAnonymousConfig

rest/config_test.go:226–301  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

224var fakeAuthProviderConfigPersisterError = errors.New("fakeAuthProviderConfigPersisterError")
225
226func TestAnonymousConfig(t *testing.T) {
227 f := fuzz.New().NilChance(0.0).NumElements(1, 1)
228 f.Funcs(
229 func(r *runtime.Codec, f fuzz.Continue) {
230 codec := &fakeCodec{}
231 f.Fuzz(codec)
232 *r = codec
233 },
234 func(r *http.RoundTripper, f fuzz.Continue) {
235 roundTripper := &fakeRoundTripper{}
236 f.Fuzz(roundTripper)
237 *r = roundTripper
238 },
239 func(fn *func(http.RoundTripper) http.RoundTripper, f fuzz.Continue) {
240 *fn = fakeWrapperFunc
241 },
242 func(fn *transport.WrapperFunc, f fuzz.Continue) {
243 *fn = fakeWrapperFunc
244 },
245 func(r *runtime.NegotiatedSerializer, f fuzz.Continue) {
246 serializer := &fakeNegotiatedSerializer{}
247 f.Fuzz(serializer)
248 *r = serializer
249 },
250 func(r *flowcontrol.RateLimiter, f fuzz.Continue) {
251 limiter := &fakeLimiter{}
252 f.Fuzz(limiter)
253 *r = limiter
254 },
255 // Authentication does not require fuzzer
256 func(r *AuthProviderConfigPersister, f fuzz.Continue) {},
257 func(r *clientcmdapi.AuthProviderConfig, f fuzz.Continue) {
258 r.Config = map[string]string{}
259 },
260 // Dial does not require fuzzer
261 func(r *func(ctx context.Context, network, addr string) (net.Conn, error), f fuzz.Continue) {},
262 )
263 for i := 0; i < 20; i++ {
264 original := &Config{}
265 f.Fuzz(original)
266 actual := AnonymousClientConfig(original)
267 expected := *original
268
269 // this is the list of known security related fields, add to this list if a new field
270 // is added to Config, update AnonymousClientConfig to preserve the field otherwise.
271 expected.Impersonate = ImpersonationConfig{}
272 expected.BearerToken = ""
273 expected.BearerTokenFile = ""
274 expected.Username = ""
275 expected.Password = ""
276 expected.AuthProvider = nil
277 expected.AuthConfigPersister = nil
278 expected.ExecProvider = nil
279 expected.TLSClientConfig.CertData = nil
280 expected.TLSClientConfig.CertFile = ""
281 expected.TLSClientConfig.KeyData = nil
282 expected.TLSClientConfig.KeyFile = ""
283 expected.Transport = nil

Callers

nothing calls this directly

Calls 2

AnonymousClientConfigFunction · 0.85
DialMethod · 0.45

Tested by

no test coverage detected