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

Function TestLoadingEmptyMaps

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

Source from the content-addressed store, hash-verified

176}
177
178func TestLoadingEmptyMaps(t *testing.T) {
179 configFile, _ := ioutil.TempFile("", "")
180 defer os.Remove(configFile.Name())
181
182 mockConfig := clientcmdapi.Config{
183 CurrentContext: "any-context-value",
184 }
185
186 WriteToFile(mockConfig, configFile.Name())
187
188 config, err := LoadFromFile(configFile.Name())
189 if err != nil {
190 t.Errorf("Unexpected error: %v", err)
191 }
192
193 if config.Clusters == nil {
194 t.Error("expected config.Clusters to be non-nil")
195 }
196 if config.AuthInfos == nil {
197 t.Error("expected config.AuthInfos to be non-nil")
198 }
199 if config.Contexts == nil {
200 t.Error("expected config.Contexts to be non-nil")
201 }
202}
203
204func TestDuplicateClusterName(t *testing.T) {
205 configFile, _ := ioutil.TempFile("", "")

Callers

nothing calls this directly

Calls 5

WriteToFileFunction · 0.85
LoadFromFileFunction · 0.70
ErrorfMethod · 0.65
ErrorMethod · 0.65
NameMethod · 0.45

Tested by

no test coverage detected