MCPcopy Create free account
hub / github.com/ddev/ddev / TestAddonGetWithDefaultBranchFlag

Function TestAddonGetWithDefaultBranchFlag

cmd/ddev/cmd/addon-get_test.go:680–701  ·  view source on GitHub ↗

TestAddonGetWithDefaultBranchFlag tests the --default-branch flag functionality

(t *testing.T)

Source from the content-addressed store, hash-verified

678
679// TestAddonGetWithDefaultBranchFlag tests the --default-branch flag functionality
680func TestAddonGetWithDefaultBranchFlag(t *testing.T) {
681 if !github.HasGitHubToken() {
682 t.Skip("Skipping because DDEV_GITHUB_TOKEN is not set")
683 }
684 origDir, _ := os.Getwd()
685 site := TestSites[0]
686 err := os.Chdir(site.Dir)
687 require.NoError(t, err)
688
689 t.Cleanup(func() {
690 assert := asrt.New(t)
691 _, _ = exec.RunHostCommand(DdevBin, "add-on", "remove", "ddev-redis")
692 err = os.Chdir(origDir)
693 assert.NoError(err)
694 })
695
696 // Test that --default-branch flag works and installs from default branch
697 out, err := exec.RunHostCommand(DdevBin, "add-on", "get", "ddev/ddev-redis", "--default-branch")
698 require.NoError(t, err, "Should succeed with --default-branch, out=%s", out)
699 // Should install from main branch (default_branch for ddev-redis)
700 require.Contains(t, out, "Installing ddev/ddev-redis:main")
701}

Callers

nothing calls this directly

Calls 4

HasGitHubTokenFunction · 0.92
RunHostCommandFunction · 0.92
ChdirMethod · 0.80
CleanupMethod · 0.80

Tested by

no test coverage detected