Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Improve installed package error when bundle can not be found #514

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@ var _ = Describe("BundleDeploymentVariableSource", func() {

bdVariableSource := variablesources.NewBundleDeploymentVariableSource(operators, bundleDeployments, testBundleList, &MockRequiredPackageSource{})
_, err := bdVariableSource.GetVariables(context.Background())
Expect(err.Error()).To(Equal("bundleImage \"quay.io/operatorhubio/prometheus@sha256:nonexistent\" not found"))
Expect(err.Error()).To(Equal(`bundle with image "quay.io/operatorhubio/prometheus@sha256:nonexistent" not found in available catalogs but is currently installed via BundleDeployment "prometheus"`))
})
})
2 changes: 1 addition & 1 deletion internal/resolution/variablesources/installed_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func MakeInstalledPackageVariables(
// find corresponding bundle for the installed content
resultSet := catalogfilter.Filter(allBundles, catalogfilter.WithBundleImage(bundleImage))
if len(resultSet) == 0 {
return nil, fmt.Errorf("bundleImage %q not found", bundleImage)
return nil, fmt.Errorf("bundle with image %q not found in available catalogs but is currently installed via BundleDeployment %q", bundleImage, bundleDeployment.Name)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@everettraven this is basically what you suggested here but with a slighlty modified message.

I'm trying to make an emphasis on the fact that the bundle is not fund in the currently available catalogs.

Let me know what you think.

P.S.: this PR will need a rebase after we merge #499.

}

sort.SliceStable(resultSet, func(i, j int) bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,6 @@ func TestMakeInstalledPackageVariables(t *testing.T) {
},
)
assert.Nil(t, installedPackages)
assert.ErrorContains(t, err, `bundleImage "registry.io/repo/test-package@v9.0.0" not found`)
assert.ErrorContains(t, err, `bundle with image "registry.io/repo/test-package@v9.0.0" not found in available catalogs but is currently installed via BundleDeployment "test-package-bd"`)
})
}