Skip to content

Commit

Permalink
Improve error about a missing installed bundle
Browse files Browse the repository at this point in the history
Signed-off-by: Mikalai Radchuk <[email protected]>
  • Loading branch information
m1kola committed Nov 7, 2023
1 parent 774ab74 commit 004a748
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ var _ = Describe("BundleDeploymentVariableSource", func() {

bdVariableSource := variablesources.NewBundleDeploymentVariableSource(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 @@ -50,7 +50,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)
}

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

0 comments on commit 004a748

Please sign in to comment.