Skip to content

Commit 361d5e6

Browse files
committed
fixup! Use a catalog's priority to as a bundle selection tie-breaker
Signed-off-by: Todd Short <tshort@redhat.com>
1 parent 5637978 commit 361d5e6

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

internal/resolve/catalog_test.go

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -859,17 +859,40 @@ func TestUnequalPriority(t *testing.T) {
859859
pkgName := randPkg()
860860
w := staticCatalogWalker{
861861
"a": func() (*declcfg.DeclarativeConfig, *catalogd.ClusterCatalogSpec, error) {
862-
return genPackage(pkgName), &catalogd.ClusterCatalogSpec{Priority: 1}, nil
862+
return &declcfg.DeclarativeConfig{
863+
Packages: []declcfg.Package{{Name: pkgName}},
864+
Channels: []declcfg.Channel{
865+
{Package: pkgName, Name: "alpha", Entries: []declcfg.ChannelEntry{
866+
{Name: bundleName(pkgName, "1.0.0")},
867+
}},
868+
},
869+
Bundles: []declcfg.Bundle{
870+
genBundle(pkgName, "1.0.0"),
871+
},
872+
Deprecations: []declcfg.Deprecation{},
873+
}, &catalogd.ClusterCatalogSpec{Priority: 1}, nil
863874
},
864875
"b": func() (*declcfg.DeclarativeConfig, *catalogd.ClusterCatalogSpec, error) {
865-
return genPackage(pkgName), &catalogd.ClusterCatalogSpec{Priority: 0}, nil
876+
return &declcfg.DeclarativeConfig{
877+
Packages: []declcfg.Package{{Name: pkgName}},
878+
Channels: []declcfg.Channel{
879+
{Package: pkgName, Name: "alpha", Entries: []declcfg.ChannelEntry{
880+
{Name: bundleName(pkgName, "1.1.0")},
881+
}},
882+
},
883+
Bundles: []declcfg.Bundle{
884+
genBundle(pkgName, "1.1.0"),
885+
},
886+
Deprecations: []declcfg.Deprecation{},
887+
}, &catalogd.ClusterCatalogSpec{Priority: 0}, nil
866888
},
867889
}
868890
r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs}
869891

870-
ce := buildFooClusterExtension(pkgName, "", ">=1.0.0 <=1.0.1", ocv1alpha1.UpgradeConstraintPolicyEnforce)
871-
_, _, _, err := r.Resolve(context.Background(), ce, nil)
892+
ce := buildFooClusterExtension(pkgName, "", "", ocv1alpha1.UpgradeConstraintPolicyEnforce)
893+
_, gotVersion, _, err := r.Resolve(context.Background(), ce, nil)
872894
require.NoError(t, err)
895+
require.Equal(t, bsemver.MustParse("1.0.0"), *gotVersion)
873896
}
874897

875898
func TestMultiplePriority(t *testing.T) {

0 commit comments

Comments
 (0)