Fix extension install error message showing raw struct instead of owner/repo (#12836)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: williammartin <1611510+williammartin@users.noreply.github.com>
This commit is contained in:
parent
d594c5e918
commit
ff8873da07
2 changed files with 34 additions and 1 deletions
|
|
@ -268,7 +268,7 @@ func (m *Manager) Install(repo ghrepo.Interface, target string) error {
|
|||
return err
|
||||
}
|
||||
if !hs {
|
||||
return fmt.Errorf("extension is not installable: no usable release artifact or script found in %s", repo)
|
||||
return fmt.Errorf("extension is not installable: no usable release artifact or script found in %s", ghrepo.FullName(repo))
|
||||
}
|
||||
|
||||
return m.installGit(repo, target)
|
||||
|
|
|
|||
|
|
@ -867,6 +867,39 @@ func TestManager_Install_git(t *testing.T) {
|
|||
assert.NoDirExistsf(t, extensionUpdatePath, "update directory should be removed")
|
||||
}
|
||||
|
||||
func TestManager_Install_not_installable(t *testing.T) {
|
||||
dataDir := t.TempDir()
|
||||
updateDir := t.TempDir()
|
||||
|
||||
reg := httpmock.Registry{}
|
||||
defer reg.Verify(t)
|
||||
client := http.Client{Transport: ®}
|
||||
|
||||
ios, _, _, _ := iostreams.Test()
|
||||
|
||||
m := newTestManager(dataDir, updateDir, &client, nil, ios)
|
||||
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/owner/gh-some-ext/releases/latest"),
|
||||
httpmock.JSONResponse(
|
||||
release{
|
||||
Assets: []releaseAsset{
|
||||
{
|
||||
Name: "not-a-binary",
|
||||
APIURL: "https://example.com/release/cool",
|
||||
},
|
||||
},
|
||||
}))
|
||||
reg.Register(
|
||||
httpmock.REST("GET", "repos/owner/gh-some-ext/contents/gh-some-ext"),
|
||||
httpmock.StatusStringResponse(404, "not found"))
|
||||
|
||||
repo := ghrepo.New("owner", "gh-some-ext")
|
||||
|
||||
err := m.Install(repo, "")
|
||||
assert.EqualError(t, err, "extension is not installable: no usable release artifact or script found in owner/gh-some-ext")
|
||||
}
|
||||
|
||||
func TestManager_Install_git_pinned(t *testing.T) {
|
||||
dataDir := t.TempDir()
|
||||
updateDir := t.TempDir()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue