(t *testing.T)
| 260 | } |
| 261 | |
| 262 | func TestSetDevSpaceRoot(t *testing.T) { |
| 263 | dir := t.TempDir() |
| 264 | |
| 265 | wdBackup, err := os.Getwd() |
| 266 | if err != nil { |
| 267 | t.Fatalf("Error getting current working directory: %v", err) |
| 268 | } |
| 269 | err = os.Chdir(dir) |
| 270 | if err != nil { |
| 271 | t.Fatalf("Error changing working directory: %v", err) |
| 272 | } |
| 273 | |
| 274 | defer func() { |
| 275 | //Delete temp folder |
| 276 | err = os.Chdir(wdBackup) |
| 277 | if err != nil { |
| 278 | t.Fatalf("Error changing dir back: %v", err) |
| 279 | } |
| 280 | }() |
| 281 | |
| 282 | testCases := []setDevSpaceRootTestCase{ |
| 283 | { |
| 284 | name: "No custom.yaml", |
| 285 | configPath: "custom.yaml", |
| 286 | files: map[string]interface{}{ |
| 287 | "devspace.yaml": "", |
| 288 | }, |
| 289 | expectedExists: false, |
| 290 | expectedWorkDir: dir, |
| 291 | expectedConfigPath: "custom.yaml", |
| 292 | }, |
| 293 | { |
| 294 | name: "No devspace.yaml", |
| 295 | expectedExists: false, |
| 296 | expectedWorkDir: dir, |
| 297 | }, |
| 298 | { |
| 299 | name: "Config exists", |
| 300 | files: map[string]interface{}{ |
| 301 | "devspace.yaml": "", |
| 302 | }, |
| 303 | startDir: "subDir", |
| 304 | expectedExists: true, |
| 305 | expectedWorkDir: dir, |
| 306 | }, |
| 307 | { |
| 308 | name: "Custom config in subdir exists", |
| 309 | configPath: "subdir/custom.yaml", |
| 310 | files: map[string]interface{}{ |
| 311 | "subdir/custom.yaml": "", |
| 312 | }, |
| 313 | expectedExists: true, |
| 314 | expectedWorkDir: func() string { |
| 315 | if runtime.GOOS == "darwin" { |
| 316 | return filepath.Join(dir, "subDir") |
| 317 | } |
| 318 | return filepath.Join(dir, "subdir") |
| 319 | }(), |
nothing calls this directly
no test coverage detected