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

Function TestUpdateCmd_UpdateConfRepo

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

Source from the content-addressed store, hash-verified

252}
253
254func 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
294func TestUpdateCmd_UpdateConfRepo_Force(t *testing.T) {
295 // 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
ErrorMethod · 0.80

Tested by

no test coverage detected