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

Function TestUpdateCmd_UpdatePortRepo_CircularDependency

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

Source from the content-addressed store, hash-verified

505}
506
507func TestUpdateCmd_UpdatePortRepo_CircularDependency(t *testing.T) {
508 // Cleanup.
509 dirs.RemoveAllForTest()
510
511 // Check error.
512 var check = func(err error) {
513 t.Helper()
514 if err != nil {
515 t.Fatal(err)
516 }
517 }
518
519 // Init celer.
520 var (
521 windowsPlatform = expr.If(os.Getenv("GITHUB_ACTIONS") == "true", "x86_64-windows-msvc-enterprise-14", "x86_64-windows-msvc-community-14")
522 platform = expr.If(runtime.GOOS == "windows", windowsPlatform, "x86_64-linux-ubuntu-22.04-gcc-11.5.0")
523 project = "project_test_update"
524 )
525
526 celer := configs.NewCeler()
527 check(celer.Init())
528 check(celer.CloneConf(test_conf_repo_url, test_conf_repo_branch, true))
529 check(celer.SetBuildType("Release"))
530 check(celer.SetPlatform(platform))
531 check(celer.SetProject(project))
532
533 // Test circular dependency detection.
534 t.Run("circular dependency prevention", func(t *testing.T) {
535 visited := make(map[string]bool)
536
537 // Simulate visiting the same port twice.
538 visited["test-port@1.0.0"] = true
539
540 updateCmd := updateCmd{
541 celer: celer,
542 recursive: true,
543 force: false,
544 }
545
546 // This should return nil immediately due to visited check.
547 if err := updateCmd.updatePortRepo("test-port@1.0.0", visited); err != nil {
548 // If error occurs, it should not be about circular dependency,
549 // (the visited check should prevent that).
550 t.Logf("Got error (acceptable if not about infinite recursion): %v", err)
551 }
552 })
553}
554
555func TestUpdateCmd_UpdatePortRepo_WithGitRepo(t *testing.T) {
556 // Cleanup.

Callers

nothing calls this directly

Calls 10

InitMethod · 0.95
CloneConfMethod · 0.95
SetBuildTypeMethod · 0.95
SetPlatformMethod · 0.95
SetProjectMethod · 0.95
updatePortRepoMethod · 0.95
RemoveAllForTestFunction · 0.92
IfFunction · 0.92
NewCelerFunction · 0.92
checkFunction · 0.85

Tested by

no test coverage detected