(t *testing.T)
| 292 | } |
| 293 | |
| 294 | func TestUpdateCmd_UpdateConfRepo_Force(t *testing.T) { |
| 295 | // Cleanup. |
| 296 | dirs.RemoveAllForTest() |
| 297 | |
| 298 | // Check error. |
| 299 | var check = func(err error) { |
| 300 | t.Helper() |
| 301 | if err != nil { |
| 302 | t.Fatal(err) |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | // Init celer. |
| 307 | celer := configs.NewCeler() |
| 308 | check(celer.Init()) |
| 309 | check(celer.CloneConf(test_conf_repo_url, test_conf_repo_branch, true)) |
| 310 | check(celer.SetBuildType("Release")) |
| 311 | |
| 312 | // Create update command with force |
| 313 | updateCmd := updateCmd{ |
| 314 | celer: celer, |
| 315 | confRepo: true, |
| 316 | force: true, |
| 317 | } |
| 318 | |
| 319 | // Test updating conf repo with force |
| 320 | confDir := filepath.Join(dirs.WorkspaceDir, "conf") |
| 321 | if !fileio.PathExists(confDir) { |
| 322 | t.Fatal("conf directory should exist before update") |
| 323 | } |
| 324 | // Make a local modification to test force update. |
| 325 | check(os.WriteFile(filepath.Join(confDir, "hello.txt"), []byte("test"), os.ModePerm)) |
| 326 | |
| 327 | // Update conf repo (with force) |
| 328 | if err := updateCmd.updateConfRepo(); err != nil { |
| 329 | t.Fatalf("Update with force should succeed: %v", err) |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | func TestUpdateCmd_UpdatePortsRepo(t *testing.T) { |
| 334 | // Cleanup. |
nothing calls this directly
no test coverage detected