Skip to content

Commit e37a2e6

Browse files
authored
⚠️ Remove Deppy solver (#758)
* Replace solver with simple catalog filtering Signed-off-by: Mikalai Radchuk <[email protected]> * Remove solver leftovers Signed-off-by: Mikalai Radchuk <[email protected]> --------- Signed-off-by: Mikalai Radchuk <[email protected]>
1 parent 79d64e8 commit e37a2e6

25 files changed

+260
-1758
lines changed

cmd/manager/main.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ import (
3030
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3131
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
3232

33-
"github.com/operator-framework/deppy/pkg/deppy/solver"
34-
3533
"github.com/operator-framework/operator-controller/internal/catalogmetadata/cache"
3634
catalogclient "github.com/operator-framework/operator-controller/internal/catalogmetadata/client"
3735
"github.com/operator-framework/operator-controller/internal/controllers"
@@ -93,17 +91,10 @@ func main() {
9391
cl := mgr.GetClient()
9492
catalogClient := catalogclient.New(cl, cache.NewFilesystemCache(cachePath, &http.Client{Timeout: 10 * time.Second}))
9593

96-
resolver, err := solver.New()
97-
if err != nil {
98-
setupLog.Error(err, "unable to create a solver")
99-
os.Exit(1)
100-
}
101-
10294
if err = (&controllers.ClusterExtensionReconciler{
10395
Client: cl,
10496
BundleProvider: catalogClient,
10597
Scheme: mgr.GetScheme(),
106-
Resolver: resolver,
10798
}).SetupWithManager(mgr); err != nil {
10899
setupLog.Error(err, "unable to create controller", "controller", "ClusterExtension")
109100
os.Exit(1)

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ require (
1010
github.com/go-logr/logr v1.4.1
1111
github.com/google/go-cmp v0.6.0
1212
github.com/operator-framework/catalogd v0.12.0
13-
github.com/operator-framework/deppy v0.3.0
1413
github.com/operator-framework/operator-registry v1.40.0
1514
github.com/operator-framework/rukpak v0.19.0
1615
github.com/spf13/pflag v1.0.5
@@ -36,7 +35,6 @@ require (
3635
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
3736
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
3837
github.com/fsnotify/fsnotify v1.7.0 // indirect
39-
github.com/go-air/gini v1.0.4 // indirect
4038
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
4139
github.com/go-git/go-billy/v5 v5.5.0 // indirect
4240
github.com/go-git/go-git/v5 v5.11.0 // indirect

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1
2424
github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
2525
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
2626
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
27-
github.com/go-air/gini v1.0.4 h1:lteMAxHKNOAjIqazL/klOJJmxq6YxxSuJ17MnMXny+s=
28-
github.com/go-air/gini v1.0.4/go.mod h1:dd8RvT1xcv6N1da33okvBd8DhMh1/A4siGy6ErjTljs=
2927
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
3028
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
3129
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
@@ -105,8 +103,6 @@ github.com/operator-framework/api v0.23.0 h1:kHymOwcHBpBVujT49SKOCd4EVG7Odwj4wl3
105103
github.com/operator-framework/api v0.23.0/go.mod h1:oKcFOz+Xc1UhMi2Pzcp6qsO7wjS4r+yP7EQprQBXrfM=
106104
github.com/operator-framework/catalogd v0.12.0 h1:Cww+CyowkfTFugB9ZjUDpKvumh2vPe/TjCUpMHDmVBM=
107105
github.com/operator-framework/catalogd v0.12.0/go.mod h1:4lryGtBTVOdqlKR0MaVYnlsSOc7HiagVRVo3J4uIo7E=
108-
github.com/operator-framework/deppy v0.3.0 h1:W8wpF0ehcTAdH2WfMyqMPI5Ja0Qv8M5FMO5cXgJvEQ8=
109-
github.com/operator-framework/deppy v0.3.0/go.mod h1:EHDxZz8fKGvuymCng3G/Ou7wuX14GaLr0cmf2u29Oog=
110106
github.com/operator-framework/operator-registry v1.40.0 h1:CaYNE4F/jzahpC7UCILItaIHmB5/oE0sS066nK+5Glw=
111107
github.com/operator-framework/operator-registry v1.40.0/go.mod h1:D2YxapkfRDgjqNTO9d3h3v0DeREbV+8utCLG52zrOy4=
112108
github.com/operator-framework/rukpak v0.19.0 h1:8cW43z4jsvARlsmj2eum5bAsZEvSxqDwfMW3dSq1zq8=

internal/controllers/clusterextension_controller.go

Lines changed: 96 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ package controllers
1919
import (
2020
"context"
2121
"fmt"
22+
"sort"
2223
"strings"
2324

25+
mmsemver "github.com/Masterminds/semver/v3"
2426
"github.com/go-logr/logr"
2527
"k8s.io/apimachinery/pkg/api/equality"
2628
apimeta "k8s.io/apimachinery/pkg/api/meta"
@@ -37,22 +39,20 @@ import (
3739
"sigs.k8s.io/controller-runtime/pkg/reconcile"
3840

3941
catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1"
40-
"github.com/operator-framework/deppy/pkg/deppy"
41-
"github.com/operator-framework/deppy/pkg/deppy/solver"
4242
"github.com/operator-framework/operator-registry/alpha/declcfg"
4343
rukpakv1alpha2 "github.com/operator-framework/rukpak/api/v1alpha2"
4444

4545
ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
4646
"github.com/operator-framework/operator-controller/internal/catalogmetadata"
47-
olmvariables "github.com/operator-framework/operator-controller/internal/resolution/variables"
47+
catalogfilter "github.com/operator-framework/operator-controller/internal/catalogmetadata/filter"
48+
catalogsort "github.com/operator-framework/operator-controller/internal/catalogmetadata/sort"
4849
)
4950

5051
// ClusterExtensionReconciler reconciles a ClusterExtension object
5152
type ClusterExtensionReconciler struct {
5253
client.Client
5354
BundleProvider BundleProvider
5455
Scheme *runtime.Scheme
55-
Resolver *solver.Solver
5656
}
5757

5858
//+kubebuilder:rbac:groups=olm.operatorframework.io,resources=clusterextensions,verbs=get;list;watch
@@ -116,33 +116,8 @@ func checkForUnexpectedFieldChange(a, b ocv1alpha1.ClusterExtension) bool {
116116
//
117117
//nolint:unparam
118118
func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alpha1.ClusterExtension) (ctrl.Result, error) {
119-
// gather vars for resolution
120-
vars, err := r.variables(ctx)
121-
if err != nil {
122-
ext.Status.InstalledBundle = nil
123-
setInstalledStatusConditionUnknown(&ext.Status.Conditions, "installation has not been attempted due to failure to gather data for resolution", ext.GetGeneration())
124-
ext.Status.ResolvedBundle = nil
125-
setResolvedStatusConditionFailed(&ext.Status.Conditions, err.Error(), ext.GetGeneration())
126-
127-
setDeprecationStatusesUnknown(&ext.Status.Conditions, "deprecation checks have not been attempted due to failure to gather data for resolution", ext.GetGeneration())
128-
return ctrl.Result{}, err
129-
}
130-
131-
// run resolution
132-
selection, err := r.Resolver.Solve(vars)
133-
if err != nil {
134-
ext.Status.InstalledBundle = nil
135-
setInstalledStatusConditionUnknown(&ext.Status.Conditions, "installation has not been attempted as resolution failed", ext.GetGeneration())
136-
ext.Status.ResolvedBundle = nil
137-
setResolvedStatusConditionFailed(&ext.Status.Conditions, err.Error(), ext.GetGeneration())
138-
139-
setDeprecationStatusesUnknown(&ext.Status.Conditions, "deprecation checks have not been attempted as resolution failed", ext.GetGeneration())
140-
return ctrl.Result{}, err
141-
}
142-
143-
// lookup the bundle in the solution that corresponds to the
144-
// ClusterExtension's desired package name.
145-
bundle, err := r.bundleFromSolution(selection, ext.Spec.PackageName)
119+
// Lookup the bundle that corresponds to the ClusterExtension's desired package.
120+
bundle, err := r.resolve(ctx, ext)
146121
if err != nil {
147122
ext.Status.InstalledBundle = nil
148123
setInstalledStatusConditionUnknown(&ext.Status.Conditions, "installation has not been attempted as resolution failed", ext.GetGeneration())
@@ -202,21 +177,105 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
202177
return ctrl.Result{}, nil
203178
}
204179

205-
func (r *ClusterExtensionReconciler) variables(ctx context.Context) ([]deppy.Variable, error) {
180+
func (r *ClusterExtensionReconciler) resolve(ctx context.Context, ext *ocv1alpha1.ClusterExtension) (*catalogmetadata.Bundle, error) {
206181
allBundles, err := r.BundleProvider.Bundles(ctx)
207182
if err != nil {
208183
return nil, err
209184
}
210-
clusterExtensionList := ocv1alpha1.ClusterExtensionList{}
211-
if err := r.Client.List(ctx, &clusterExtensionList); err != nil {
185+
186+
installedBundle, err := r.installedBundle(ctx, allBundles, ext)
187+
if err != nil {
212188
return nil, err
213189
}
214-
bundleDeploymentList := rukpakv1alpha2.BundleDeploymentList{}
215-
if err := r.Client.List(ctx, &bundleDeploymentList); err != nil {
190+
191+
packageName := ext.Spec.PackageName
192+
channelName := ext.Spec.Channel
193+
versionRange := ext.Spec.Version
194+
195+
predicates := []catalogfilter.Predicate[catalogmetadata.Bundle]{
196+
catalogfilter.WithPackageName(packageName),
197+
}
198+
199+
if channelName != "" {
200+
predicates = append(predicates, catalogfilter.InChannel(channelName))
201+
}
202+
203+
if versionRange != "" {
204+
vr, err := mmsemver.NewConstraint(versionRange)
205+
if err != nil {
206+
return nil, fmt.Errorf("invalid version range %q: %w", versionRange, err)
207+
}
208+
predicates = append(predicates, catalogfilter.InMastermindsSemverRange(vr))
209+
}
210+
211+
if ext.Spec.UpgradeConstraintPolicy != ocv1alpha1.UpgradeConstraintPolicyIgnore && installedBundle != nil {
212+
upgradePredicate, err := SuccessorsPredicate(installedBundle)
213+
if err != nil {
214+
return nil, err
215+
}
216+
217+
predicates = append(predicates, upgradePredicate)
218+
}
219+
220+
resultSet := catalogfilter.Filter(allBundles, catalogfilter.And(predicates...))
221+
222+
var upgradeErrorPrefix string
223+
if installedBundle != nil {
224+
installedBundleVersion, err := installedBundle.Version()
225+
if err != nil {
226+
return nil, err
227+
}
228+
upgradeErrorPrefix = fmt.Sprintf("error upgrading from currently installed version %q: ", installedBundleVersion.String())
229+
}
230+
if len(resultSet) == 0 {
231+
if versionRange != "" && channelName != "" {
232+
return nil, fmt.Errorf("%sno package %q matching version %q found in channel %q", upgradeErrorPrefix, packageName, versionRange, channelName)
233+
}
234+
if versionRange != "" {
235+
return nil, fmt.Errorf("%sno package %q matching version %q found", upgradeErrorPrefix, packageName, versionRange)
236+
}
237+
if channelName != "" {
238+
return nil, fmt.Errorf("%sno package %q found in channel %q", upgradeErrorPrefix, packageName, channelName)
239+
}
240+
return nil, fmt.Errorf("%sno package %q found", upgradeErrorPrefix, packageName)
241+
}
242+
sort.SliceStable(resultSet, func(i, j int) bool {
243+
return catalogsort.ByVersion(resultSet[i], resultSet[j])
244+
})
245+
sort.SliceStable(resultSet, func(i, j int) bool {
246+
return catalogsort.ByDeprecated(resultSet[i], resultSet[j])
247+
})
248+
249+
return resultSet[0], nil
250+
}
251+
252+
func (r *ClusterExtensionReconciler) installedBundle(ctx context.Context, allBundles []*catalogmetadata.Bundle, ext *ocv1alpha1.ClusterExtension) (*catalogmetadata.Bundle, error) {
253+
bd := &rukpakv1alpha2.BundleDeployment{}
254+
err := r.Client.Get(ctx, types.NamespacedName{Name: ext.GetName()}, bd)
255+
if client.IgnoreNotFound(err) != nil {
216256
return nil, err
217257
}
218258

219-
return GenerateVariables(allBundles, clusterExtensionList.Items, bundleDeploymentList.Items)
259+
if bd.Spec.Source.Image == nil || bd.Spec.Source.Image.Ref == "" {
260+
// Bundle not yet installed
261+
return nil, nil
262+
}
263+
264+
bundleImage := bd.Spec.Source.Image.Ref
265+
// find corresponding bundle for the installed content
266+
resultSet := catalogfilter.Filter(allBundles, catalogfilter.And(
267+
catalogfilter.WithPackageName(ext.Spec.PackageName),
268+
catalogfilter.WithBundleImage(bundleImage),
269+
))
270+
if len(resultSet) == 0 {
271+
return nil, fmt.Errorf("bundle with image %q for package %q not found in available catalogs but is currently installed via BundleDeployment %q", bundleImage, ext.Spec.PackageName, bd.Name)
272+
}
273+
274+
sort.SliceStable(resultSet, func(i, j int) bool {
275+
return catalogsort.ByVersion(resultSet[i], resultSet[j])
276+
})
277+
278+
return resultSet[0], nil
220279
}
221280

222281
func mapBDStatusToInstalledCondition(existingTypedBundleDeployment *rukpakv1alpha2.BundleDeployment, ext *ocv1alpha1.ClusterExtension, bundle *catalogmetadata.Bundle) {
@@ -346,19 +405,6 @@ func SetDeprecationStatus(ext *ocv1alpha1.ClusterExtension, bundle *catalogmetad
346405
}
347406
}
348407

349-
func (r *ClusterExtensionReconciler) bundleFromSolution(selection []deppy.Variable, packageName string) (*catalogmetadata.Bundle, error) {
350-
for _, variable := range selection {
351-
switch v := variable.(type) {
352-
case *olmvariables.BundleVariable:
353-
bundlePkgName := v.Bundle().Package
354-
if packageName == bundlePkgName {
355-
return v.Bundle(), nil
356-
}
357-
}
358-
}
359-
return nil, fmt.Errorf("bundle for package %q not found in solution", packageName)
360-
}
361-
362408
func (r *ClusterExtensionReconciler) GenerateExpectedBundleDeployment(o ocv1alpha1.ClusterExtension, bundlePath string, bundleProvisioner string) *unstructured.Unstructured {
363409
// We use unstructured here to avoid problems of serializing default values when sending patches to the apiserver.
364410
// If you use a typed object, any default values from that struct get serialized into the JSON patch, which could

internal/controllers/clusterextension_controller_test.go

Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func TestClusterExtensionNonExistentVersion(t *testing.T) {
122122
require.NotNil(t, cond)
123123
require.Equal(t, metav1.ConditionUnknown, cond.Status)
124124
require.Equal(t, ocv1alpha1.ReasonInstallationStatusUnknown, cond.Reason)
125-
require.Equal(t, "installation has not been attempted due to failure to gather data for resolution", cond.Message)
125+
require.Equal(t, "installation has not been attempted as resolution failed", cond.Message)
126126

127127
verifyInvariants(ctx, t, reconciler.Client, clusterExtension)
128128
require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{}))
@@ -608,57 +608,6 @@ func TestClusterExtensionExpectedBundleDeployment(t *testing.T) {
608608
require.NoError(t, cl.DeleteAllOf(ctx, &rukpakv1alpha2.BundleDeployment{}))
609609
}
610610

611-
func TestClusterExtensionDuplicatePackage(t *testing.T) {
612-
cl, reconciler := newClientAndReconciler(t)
613-
ctx := context.Background()
614-
extKey := types.NamespacedName{Name: fmt.Sprintf("cluster-extension-test-%s", rand.String(8))}
615-
const pkgName = "prometheus"
616-
617-
t.Log("When the cluster extension specifies a duplicate package")
618-
t.Log("By initializing cluster state")
619-
dupClusterExtension := &ocv1alpha1.ClusterExtension{
620-
ObjectMeta: metav1.ObjectMeta{Name: fmt.Sprintf("orig-%s", extKey.Name)},
621-
Spec: ocv1alpha1.ClusterExtensionSpec{PackageName: pkgName},
622-
}
623-
require.NoError(t, cl.Create(ctx, dupClusterExtension))
624-
625-
clusterExtension := &ocv1alpha1.ClusterExtension{
626-
ObjectMeta: metav1.ObjectMeta{Name: extKey.Name},
627-
Spec: ocv1alpha1.ClusterExtensionSpec{PackageName: pkgName},
628-
}
629-
require.NoError(t, cl.Create(ctx, clusterExtension))
630-
631-
t.Log("It sets resolution failure status")
632-
t.Log("By running reconcile")
633-
res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: extKey})
634-
require.Equal(t, ctrl.Result{}, res)
635-
require.EqualError(t, err, `duplicate identifier "required package prometheus" in input`)
636-
637-
t.Log("By fetching updated cluster extension after reconcile")
638-
require.NoError(t, cl.Get(ctx, extKey, clusterExtension))
639-
640-
t.Log("By checking the status fields")
641-
require.Empty(t, clusterExtension.Status.ResolvedBundle)
642-
require.Empty(t, clusterExtension.Status.InstalledBundle)
643-
644-
t.Log("By checking the expected conditions")
645-
cond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeResolved)
646-
require.NotNil(t, cond)
647-
require.Equal(t, metav1.ConditionFalse, cond.Status)
648-
require.Equal(t, ocv1alpha1.ReasonResolutionFailed, cond.Reason)
649-
require.Equal(t, `duplicate identifier "required package prometheus" in input`, cond.Message)
650-
651-
cond = apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1alpha1.TypeInstalled)
652-
require.NotNil(t, cond)
653-
require.Equal(t, metav1.ConditionUnknown, cond.Status)
654-
require.Equal(t, ocv1alpha1.ReasonInstallationStatusUnknown, cond.Reason)
655-
require.Equal(t, "installation has not been attempted as resolution failed", cond.Message)
656-
657-
verifyInvariants(ctx, t, reconciler.Client, clusterExtension)
658-
require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{}))
659-
require.NoError(t, cl.DeleteAllOf(ctx, &rukpakv1alpha2.BundleDeployment{}))
660-
}
661-
662611
func TestClusterExtensionChannelVersionExists(t *testing.T) {
663612
cl, reconciler := newClientAndReconciler(t)
664613
ctx := context.Background()
@@ -819,7 +768,7 @@ func TestClusterExtensionVersionNoChannel(t *testing.T) {
819768
require.NotNil(t, cond)
820769
require.Equal(t, metav1.ConditionUnknown, cond.Status)
821770
require.Equal(t, ocv1alpha1.ReasonInstallationStatusUnknown, cond.Reason)
822-
require.Equal(t, "installation has not been attempted due to failure to gather data for resolution", cond.Message)
771+
require.Equal(t, "installation has not been attempted as resolution failed", cond.Message)
823772

824773
verifyInvariants(ctx, t, reconciler.Client, clusterExtension)
825774
require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{}))
@@ -867,7 +816,7 @@ func TestClusterExtensionNoChannel(t *testing.T) {
867816
require.NotNil(t, cond)
868817
require.Equal(t, metav1.ConditionUnknown, cond.Status)
869818
require.Equal(t, ocv1alpha1.ReasonInstallationStatusUnknown, cond.Reason)
870-
require.Equal(t, "installation has not been attempted due to failure to gather data for resolution", cond.Message)
819+
require.Equal(t, "installation has not been attempted as resolution failed", cond.Message)
871820

872821
verifyInvariants(ctx, t, reconciler.Client, clusterExtension)
873822
require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{}))
@@ -917,7 +866,7 @@ func TestClusterExtensionNoVersion(t *testing.T) {
917866
require.NotNil(t, cond)
918867
require.Equal(t, metav1.ConditionUnknown, cond.Status)
919868
require.Equal(t, ocv1alpha1.ReasonInstallationStatusUnknown, cond.Reason)
920-
require.Equal(t, "installation has not been attempted due to failure to gather data for resolution", cond.Message)
869+
require.Equal(t, "installation has not been attempted as resolution failed", cond.Message)
921870

922871
verifyInvariants(ctx, t, reconciler.Client, clusterExtension)
923872
require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{}))
@@ -1173,8 +1122,7 @@ func TestClusterExtensionUpgrade(t *testing.T) {
11731122
require.NotNil(t, cond)
11741123
assert.Equal(t, metav1.ConditionFalse, cond.Status)
11751124
assert.Equal(t, ocv1alpha1.ReasonResolutionFailed, cond.Reason)
1176-
assert.Contains(t, cond.Message, "constraints not satisfiable")
1177-
assert.Regexp(t, "installed package prometheus requires at least one of fake-catalog-prometheus-operatorhub/prometheus/beta/1.2.0, fake-catalog-prometheus-operatorhub/prometheus/beta/1.0.1, fake-catalog-prometheus-operatorhub/prometheus/beta/1.0.0$", cond.Message)
1125+
assert.Equal(t, "error upgrading from currently installed version \"1.0.0\": no package \"prometheus\" matching version \"2.0.0\" found in channel \"beta\"", cond.Message)
11781126

11791127
// Valid update skipping one version
11801128
clusterExtension.Spec.Version = "1.2.0"
@@ -1266,8 +1214,7 @@ func TestClusterExtensionUpgrade(t *testing.T) {
12661214
require.NotNil(t, cond)
12671215
assert.Equal(t, metav1.ConditionFalse, cond.Status)
12681216
assert.Equal(t, ocv1alpha1.ReasonResolutionFailed, cond.Reason)
1269-
assert.Contains(t, cond.Message, "constraints not satisfiable")
1270-
assert.Contains(t, cond.Message, "installed package prometheus requires at least one of fake-catalog-prometheus-operatorhub/prometheus/beta/1.0.1, fake-catalog-prometheus-operatorhub/prometheus/beta/1.0.0\n")
1217+
assert.Equal(t, "error upgrading from currently installed version \"1.0.0\": no package \"prometheus\" matching version \"1.2.0\" found in channel \"beta\"", cond.Message)
12711218

12721219
// Valid update skipping one version
12731220
clusterExtension.Spec.Version = "1.0.1"
@@ -1458,8 +1405,7 @@ func TestClusterExtensionDowngrade(t *testing.T) {
14581405
require.NotNil(t, cond)
14591406
assert.Equal(t, metav1.ConditionFalse, cond.Status)
14601407
assert.Equal(t, ocv1alpha1.ReasonResolutionFailed, cond.Reason)
1461-
assert.Contains(t, cond.Message, "constraints not satisfiable")
1462-
assert.Contains(t, cond.Message, "installed package prometheus requires at least one of fake-catalog-prometheus-operatorhub/prometheus/beta/1.2.0, fake-catalog-prometheus-operatorhub/prometheus/beta/1.0.1\n")
1408+
assert.Equal(t, "error upgrading from currently installed version \"1.0.1\": no package \"prometheus\" matching version \"1.0.0\" found in channel \"beta\"", cond.Message)
14631409
})
14641410
}
14651411
})

0 commit comments

Comments
 (0)