(t *testing.T)
| 252 | } |
| 253 | |
| 254 | func TestUpdateCmd_UpdateConfRepo(t *testing.T) { |
| 255 | // Cleanup. |
| 256 | dirs.RemoveAllForTest() |
| 257 | |
| 258 | // Check error. |
| 259 | var check = func(err error) { |
| 260 | t.Helper() |
| 261 | if err != nil { |
| 262 | t.Fatal(err) |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | // Init celer. |
| 267 | celer := configs.NewCeler() |
| 268 | check(celer.Init()) |
| 269 | check(celer.CloneConf(test_conf_repo_url, test_conf_repo_branch, true)) |
| 270 | check(celer.SetBuildType("Release")) |
| 271 | |
| 272 | // Create update command |
| 273 | updateCmd := updateCmd{ |
| 274 | celer: celer, |
| 275 | confRepo: true, |
| 276 | force: false, |
| 277 | } |
| 278 | |
| 279 | // Test updating conf repo |
| 280 | confDir := filepath.Join(dirs.WorkspaceDir, "conf") |
| 281 | if !fileio.PathExists(confDir) { |
| 282 | t.Fatal("conf directory should exist before update") |
| 283 | } |
| 284 | |
| 285 | // Update conf repo (without force) |
| 286 | if err := updateCmd.updateConfRepo(); err != nil { |
| 287 | // Error is expected if there are local modifications |
| 288 | if !strings.Contains(err.Error(), "modified") { |
| 289 | t.Fatalf("Unexpected error: %v", err) |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | func TestUpdateCmd_UpdateConfRepo_Force(t *testing.T) { |
| 295 | // Cleanup. |
nothing calls this directly
no test coverage detected