Skip to content

Commit

Permalink
Improve error about a missing installed bundle (#514)
Browse files Browse the repository at this point in the history
Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
  • Loading branch information
m1kola authored Nov 7, 2023
1 parent 8c59a33 commit e07bea0
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 @@ -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)
}

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"`)
})
}

0 comments on commit e07bea0

Please sign in to comment.