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

Function TestErrorReadingNonFile

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

Source from the content-addressed store, hash-verified

125}
126
127func TestErrorReadingNonFile(t *testing.T) {
128 tmpdir, err := ioutil.TempDir("", "")
129 if err != nil {
130 t.Fatalf("Couldn't create tmpdir")
131 }
132 defer os.RemoveAll(tmpdir)
133
134 loadingRules := ClientConfigLoadingRules{
135 ExplicitPath: tmpdir,
136 }
137
138 _, err = loadingRules.Load()
139 if err == nil {
140 t.Fatalf("Expected error for non-file, got none")
141 }
142 if !strings.Contains(err.Error(), tmpdir) {
143 t.Fatalf("Expected error about '%s', got %s", tmpdir, err.Error())
144 }
145}
146
147func TestConflictingCurrentContext(t *testing.T) {
148 commandLineFile, _ := ioutil.TempFile("", "")

Callers

nothing calls this directly

Calls 2

LoadMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected