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

Function TestMigratingFileSourceMissingSkip

tools/clientcmd/loader_test.go:544–561  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

542}
543
544func TestMigratingFileSourceMissingSkip(t *testing.T) {
545 sourceFilename := "some-missing-file"
546 destinationFile, _ := ioutil.TempFile("", "")
547 // delete the file so that we'll write to it
548 os.Remove(destinationFile.Name())
549
550 loadingRules := ClientConfigLoadingRules{
551 MigrationRules: map[string]string{destinationFile.Name(): sourceFilename},
552 }
553
554 if _, err := loadingRules.Load(); err != nil {
555 t.Errorf("unexpected error %v", err)
556 }
557
558 if _, err := os.Stat(destinationFile.Name()); !os.IsNotExist(err) {
559 t.Errorf("destination should not exist")
560 }
561}
562
563func TestFileLocking(t *testing.T) {
564 f, _ := ioutil.TempFile("", "")

Callers

nothing calls this directly

Calls 3

LoadMethod · 0.95
ErrorfMethod · 0.65
NameMethod · 0.45

Tested by

no test coverage detected