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

Method testContext

tools/clientcmd/validation_test.go:473–491  ·  view source on GitHub ↗
(contextName string, t *testing.T)

Source from the content-addressed store, hash-verified

471}
472
473func (c configValidationTest) testContext(contextName string, t *testing.T) {
474 errs := validateContext(contextName, *c.config.Contexts[contextName], *c.config)
475
476 if len(c.expectedErrorSubstring) != 0 {
477 if len(errs) == 0 {
478 t.Errorf("Expected error containing: %v", c.expectedErrorSubstring)
479 }
480 for _, curr := range c.expectedErrorSubstring {
481 if len(errs) != 0 && !strings.Contains(utilerrors.NewAggregate(errs).Error(), curr) {
482 t.Errorf("Expected error containing: %v, but got %v", c.expectedErrorSubstring, utilerrors.NewAggregate(errs))
483 }
484 }
485
486 } else {
487 if len(errs) != 0 {
488 t.Errorf("Unexpected error: %v", utilerrors.NewAggregate(errs))
489 }
490 }
491}
492
493func (c configValidationTest) testConfirmUsable(contextName string, t *testing.T) {
494 err := ConfirmUsable(*c.config, contextName)

Calls 3

validateContextFunction · 0.85
ErrorfMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected