MCPcopy Create free account
hub / github.com/celer-pkg/celer / TestUpdateCmd_UpdateConfRepo_Force

Function TestUpdateCmd_UpdateConfRepo_Force

cmds/cmd_update_test.go:294–331  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

292}
293
294func 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
333func TestUpdateCmd_UpdatePortsRepo(t *testing.T) {
334 // Cleanup.

Callers

nothing calls this directly

Calls 9

InitMethod · 0.95
CloneConfMethod · 0.95
SetBuildTypeMethod · 0.95
updateConfRepoMethod · 0.95
RemoveAllForTestFunction · 0.92
NewCelerFunction · 0.92
PathExistsFunction · 0.92
checkFunction · 0.85
WriteFileMethod · 0.80

Tested by

no test coverage detected