(t *testing.T)
| 331 | } |
| 332 | |
| 333 | func TestUpdateCmd_UpdatePortsRepo(t *testing.T) { |
| 334 | // Cleanup. |
| 335 | dirs.RemoveAllForTest() |
| 336 | |
| 337 | // Check error. |
| 338 | var check = func(err error) { |
| 339 | t.Helper() |
| 340 | if err != nil { |
| 341 | t.Fatal(err) |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | // Init celer. |
| 346 | celer := configs.NewCeler() |
| 347 | check(celer.Init()) |
| 348 | check(celer.CloneConf(test_conf_repo_url, test_conf_repo_branch, true)) |
| 349 | check(celer.SetBuildType("Release")) |
| 350 | |
| 351 | // Create update command. |
| 352 | updateCmd := updateCmd{ |
| 353 | celer: celer, |
| 354 | portsRepo: true, |
| 355 | force: false, |
| 356 | } |
| 357 | |
| 358 | // Test updating ports repo. |
| 359 | portsDir := filepath.Join(dirs.WorkspaceDir, "ports") |
| 360 | if !fileio.PathExists(portsDir) { |
| 361 | t.Fatal("ports directory should exist before update") |
| 362 | } |
| 363 | |
| 364 | // Update ports repo. |
| 365 | if err := updateCmd.updatePortsRepo(); err != nil { |
| 366 | if !strings.Contains(err.Error(), "modified") { |
| 367 | t.Fatalf("Unexpected error: %v", err) |
| 368 | } |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | func TestUpdateCmd_UpdateProjectRepos_NoTargets(t *testing.T) { |
| 373 | // Cleanup. |
nothing calls this directly
no test coverage detected