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

Function TestUpdateCmd_UpdatePortRepo_WithGitRepo

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

Source from the content-addressed store, hash-verified

553}
554
555func TestUpdateCmd_UpdatePortRepo_WithGitRepo(t *testing.T) {
556 // Cleanup.
557 dirs.RemoveAllForTest()
558
559 // Check error.
560 var check = func(err error) {
561 t.Helper()
562 if err != nil {
563 t.Fatal(err)
564 }
565 }
566
567 // Init celer.
568 var (
569 windowsPlatform = expr.If(os.Getenv("GITHUB_ACTIONS") == "true", "x86_64-windows-msvc-enterprise-14", "x86_64-windows-msvc-community-14")
570 platform = expr.If(runtime.GOOS == "windows", windowsPlatform, "x86_64-linux-ubuntu-22.04-gcc-11.5.0")
571 project = "project_test_update"
572 )
573
574 celer := configs.NewCeler()
575 check(celer.Init())
576 check(celer.CloneConf(test_conf_repo_url, test_conf_repo_branch, true))
577 check(celer.SetBuildType("Release"))
578 check(celer.SetPlatform(platform))
579 check(celer.SetProject(project))
580 check(buildtools.CheckTools(celer, "git"))
581
582 // Install a simple git-based port.
583 nameVersion := "zlib@1.3.1"
584
585 var port configs.Port
586 check(port.Init(celer, nameVersion))
587
588 if !strings.HasSuffix(port.Package.Url, ".git") {
589 t.Skip("Port is not a git repository")
590 }
591
592 buildConfig := port.MatchedConfig
593 if buildConfig == nil {
594 t.Fatal("Build config should not be nil")
595 }
596 check(buildConfig.Clone(
597 port.Package.Url,
598 port.Package.Ref,
599 port.Package.Archive,
600 port.Package.Depth,
601 ))
602
603 // Test update with force.
604 updateCmd := updateCmd{
605 celer: celer,
606 force: true,
607 }
608
609 visited := make(map[string]bool)
610 updateErr := updateCmd.updatePortRepo(nameVersion, visited)
611 if updateErr != nil {
612 t.Logf("Update returned: %v", updateErr)

Callers

nothing calls this directly

Calls 15

InitMethod · 0.95
CloneConfMethod · 0.95
SetBuildTypeMethod · 0.95
SetPlatformMethod · 0.95
SetProjectMethod · 0.95
InitMethod · 0.95
updatePortRepoMethod · 0.95
RemoveAllForTestFunction · 0.92
IfFunction · 0.92
NewCelerFunction · 0.92
CheckToolsFunction · 0.92
PathExistsFunction · 0.92

Tested by

no test coverage detected