| 125 | } |
| 126 | |
| 127 | func 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 | |
| 147 | func TestConflictingCurrentContext(t *testing.T) { |
| 148 | commandLineFile, _ := ioutil.TempFile("", "") |