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

Function TestUpdateCmd_UpdatePortsRepo

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

Source from the content-addressed store, hash-verified

331}
332
333func 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
372func TestUpdateCmd_UpdateProjectRepos_NoTargets(t *testing.T) {
373 // Cleanup.

Callers

nothing calls this directly

Calls 9

InitMethod · 0.95
CloneConfMethod · 0.95
SetBuildTypeMethod · 0.95
updatePortsRepoMethod · 0.95
RemoveAllForTestFunction · 0.92
NewCelerFunction · 0.92
PathExistsFunction · 0.92
checkFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected