Skip to content

Commit 28da6bd

Browse files
Mikalai Radchukm1kola
authored andcommitted
Fixes replace based upgrades
Signed-off-by: Mikalai Radchuk <[email protected]>
1 parent dea70eb commit 28da6bd

File tree

11 files changed

+107
-96
lines changed

11 files changed

+107
-96
lines changed

internal/controllers/operator_controller_test.go

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,34 +1082,39 @@ func verifyConditionsInvariants(op *operatorsv1alpha1.Operator) {
10821082

10831083
var testEntitySource = input.NewCacheQuerier(map[deppy.Identifier]input.Entity{
10841084
"operatorhub/prometheus/0.37.0": *input.NewEntity("operatorhub/prometheus/0.37.0", map[string]string{
1085-
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:3e281e587de3d03011440685fc4fb782672beab044c1ebadc42788ce05a21c35"`,
1086-
"olm.channel": `{"channelName":"beta","priority":0}`,
1087-
"olm.package": `{"packageName":"prometheus","version":"0.37.0"}`,
1088-
"olm.gvk": `[]`,
1085+
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:3e281e587de3d03011440685fc4fb782672beab044c1ebadc42788ce05a21c35"`,
1086+
"olm.bundle.channelEntry": `{"name":"prometheus.0.37.0"}`,
1087+
"olm.channel": `{"channelName":"beta","priority":0}`,
1088+
"olm.package": `{"packageName":"prometheus","version":"0.37.0"}`,
1089+
"olm.gvk": `[]`,
10891090
}),
10901091
"operatorhub/prometheus/0.47.0": *input.NewEntity("operatorhub/prometheus/0.47.0", map[string]string{
1091-
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:5b04c49d8d3eff6a338b56ec90bdf491d501fe301c9cdfb740e5bff6769a21ed"`,
1092-
"olm.channel": `{"channelName":"beta","priority":0,"replaces":"prometheusoperator.0.37.0"}`,
1093-
"olm.package": `{"packageName":"prometheus","version":"0.47.0"}`,
1094-
"olm.gvk": `[]`,
1092+
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:5b04c49d8d3eff6a338b56ec90bdf491d501fe301c9cdfb740e5bff6769a21ed"`,
1093+
"olm.bundle.channelEntry": `{"name":"prometheus.0.47.0"}`,
1094+
"olm.channel": `{"channelName":"beta","priority":0,"replaces":"prometheusoperator.0.37.0"}`,
1095+
"olm.package": `{"packageName":"prometheus","version":"0.47.0"}`,
1096+
"olm.gvk": `[]`,
10951097
}),
10961098
"operatorhub/badimage/0.1.0": *input.NewEntity("operatorhub/badimage/0.1.0", map[string]string{
1097-
"olm.bundle.path": `{"name": "quay.io/operatorhubio/badimage:v0.1.0"}`,
1098-
"olm.package": `{"packageName":"badimage","version":"0.1.0"}`,
1099-
"olm.gvk": `[]`,
1099+
"olm.bundle.path": `{"name": "quay.io/operatorhubio/badimage:v0.1.0"}`,
1100+
"olm.bundle.channelEntry": `{"name":"badimage.0.1.0"}`,
1101+
"olm.package": `{"packageName":"badimage","version":"0.1.0"}`,
1102+
"olm.gvk": `[]`,
11001103
}),
11011104
"operatorhub/plain/0.1.0": *input.NewEntity("operatorhub/plain/0.1.0", map[string]string{
1102-
"olm.bundle.path": `"quay.io/operatorhub/plain@sha256:plain"`,
1103-
"olm.channel": `{"channelName":"beta","priority":0}`,
1104-
"olm.package": `{"packageName":"plain","version":"0.1.0"}`,
1105-
"olm.gvk": `[]`,
1106-
"olm.bundle.mediatype": `"plain+v0"`,
1105+
"olm.bundle.path": `"quay.io/operatorhub/plain@sha256:plain"`,
1106+
"olm.bundle.channelEntry": `{"name":"plain.0.1.0"}`,
1107+
"olm.channel": `{"channelName":"beta","priority":0}`,
1108+
"olm.package": `{"packageName":"plain","version":"0.1.0"}`,
1109+
"olm.gvk": `[]`,
1110+
"olm.bundle.mediatype": `"plain+v0"`,
11071111
}),
11081112
"operatorhub/badmedia/0.1.0": *input.NewEntity("operatorhub/badmedia/0.1.0", map[string]string{
1109-
"olm.bundle.path": `"quay.io/operatorhub/badmedia@sha256:badmedia"`,
1110-
"olm.channel": `{"channelName":"beta","priority":0}`,
1111-
"olm.package": `{"packageName":"badmedia","version":"0.1.0"}`,
1112-
"olm.gvk": `[]`,
1113-
"olm.bundle.mediatype": `"badmedia+v1"`,
1113+
"olm.bundle.path": `"quay.io/operatorhub/badmedia@sha256:badmedia"`,
1114+
"olm.bundle.channelEntry": `{"name":"badmedia.0.1.0"}`,
1115+
"olm.channel": `{"channelName":"beta","priority":0}`,
1116+
"olm.package": `{"packageName":"badmedia","version":"0.1.0"}`,
1117+
"olm.gvk": `[]`,
1118+
"olm.bundle.mediatype": `"badmedia+v1"`,
11141119
}),
11151120
})

internal/resolution/entities/bundle_entity.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ import (
1111
)
1212

1313
const PropertyBundlePath = "olm.bundle.path"
14-
15-
// TODO: Is this the right place for these?
16-
// ----
14+
const PropertyBundleChannelEntry = "olm.bundle.channelEntry"
1715
const PropertyBundleMediaType = "olm.bundle.mediatype"
1816

1917
type MediaType string
@@ -39,8 +37,10 @@ type PackageRequired struct {
3937

4038
type GVK property.GVK
4139

42-
type Replaces struct {
40+
type ChannelEntry struct {
41+
Name string `json:"name"`
4342
Replaces string `json:"replaces"`
43+
// Skips and skipRange will probably go here as well
4444
}
4545

4646
func (g GVK) String() string {
@@ -66,7 +66,7 @@ type BundleEntity struct {
6666
requiredGVKs []GVKRequired
6767
requiredPackages []PackageRequired
6868
channel *property.Channel
69-
replaces *Replaces
69+
channelEntry *ChannelEntry
7070
semVersion *semver.Version
7171
bundlePath string
7272
mediaType string
@@ -129,22 +129,22 @@ func (b *BundleEntity) Channel() (*property.Channel, error) {
129129
return b.channel, nil
130130
}
131131

132-
func (b *BundleEntity) Replaces() (string, error) {
133-
if err := b.loadReplaces(); err != nil {
134-
return "", err
132+
func (b *BundleEntity) BundleChannelEntry() (*ChannelEntry, error) {
133+
if err := b.loadBundleChannelEntry(); err != nil {
134+
return nil, err
135135
}
136-
return b.replaces.Replaces, nil
136+
return b.channelEntry, nil
137137
}
138138

139-
func (b *BundleEntity) loadReplaces() error {
139+
func (b *BundleEntity) loadBundleChannelEntry() error {
140140
b.mu.Lock()
141141
defer b.mu.Unlock()
142-
if b.replaces == nil {
143-
replaces, err := loadFromEntity[Replaces](b.Entity, "olm.replaces", optional)
144-
if err != nil {
142+
if b.channelEntry == nil {
143+
channelEntry, err := loadFromEntity[*ChannelEntry](b.Entity, PropertyBundleChannelEntry, optional)
144+
if err != nil || channelEntry == nil {
145145
return fmt.Errorf("error determining replaces for entity '%s': %w", b.ID, err)
146146
}
147-
b.replaces = &replaces
147+
b.channelEntry = channelEntry
148148
}
149149
return nil
150150
}

internal/resolution/entities/bundle_entity_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,24 +265,24 @@ var _ = Describe("BundleEntity", func() {
265265
})
266266
})
267267

268-
Describe("Replaces", func() {
269-
It("should return the replaces property if present", func() {
268+
Describe("ChannelEntry", func() {
269+
It("should return the channel entry property if present", func() {
270270
entity := input.NewEntity("test", map[string]string{
271-
"olm.replaces": `{"replaces": "test.v0.2.0"}`,
271+
"olm.bundle.channelEntry": `{"name":"test.v0.3.0","replaces": "test.v0.2.0"}`,
272272
})
273273
bundleEntity := olmentity.NewBundleEntity(entity)
274-
replaces, err := bundleEntity.Replaces()
274+
channelEntry, err := bundleEntity.BundleChannelEntry()
275275
Expect(err).ToNot(HaveOccurred())
276-
Expect(replaces).To(Equal("test.v0.2.0"))
276+
Expect(channelEntry).To(Equal(&olmentity.ChannelEntry{Name: "test.v0.3.0", Replaces: "test.v0.2.0"}))
277277
})
278278
It("should not return an error if the property is not found", func() {
279279
entity := input.NewEntity("test", map[string]string{
280280
"olm.thingy": `{"whatever":"this"}`,
281281
})
282282
bundleEntity := olmentity.NewBundleEntity(entity)
283-
replaces, err := bundleEntity.Replaces()
284-
Expect(replaces).To(BeEmpty())
285-
Expect(err).NotTo(HaveOccurred())
283+
channelEntry, err := bundleEntity.BundleChannelEntry()
284+
Expect(channelEntry).To(BeNil())
285+
Expect(err).To(HaveOccurred())
286286
})
287287
})
288288

internal/resolution/entitysources/catalogdsource.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ func (es *CatalogdEntitySource) Iterate(ctx context.Context, fn input.IteratorFu
7171
return nil
7272
}
7373

74-
type replacesProperty struct {
75-
Replaces string `json:"replaces"`
76-
}
77-
7874
func getEntities(ctx context.Context, client client.Client) (input.EntityList, error) {
7975
entityList := input.EntityList{}
8076
bundleMetadatas, packageMetdatas, err := fetchMetadata(ctx, client)
@@ -110,9 +106,11 @@ func getEntities(ctx context.Context, client client.Client) (input.EntityList, e
110106
if catalogScopedEntryName == bundle.Name {
111107
channelValue, _ := json.Marshal(property.Channel{ChannelName: ch.Name, Priority: 0})
112108
props[property.TypeChannel] = string(channelValue)
113-
// TODO(jmprusi): Add the proper PropertyType for this
114-
replacesValue, _ := json.Marshal(replacesProperty{Replaces: b.Replaces})
115-
props["olm.replaces"] = string(replacesValue)
109+
replacesValue, _ := json.Marshal(entities.ChannelEntry{
110+
Name: b.Name,
111+
Replaces: b.Replaces,
112+
})
113+
props[entities.PropertyBundleChannelEntry] = string(replacesValue)
116114
entity := input.Entity{
117115
ID: deppy.IdentifierFromString(fmt.Sprintf("%s%s%s", bundle.Name, bundle.Spec.Package, ch.Name)),
118116
Properties: props,

internal/resolution/util/predicates/predicates.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ func WithBundleImage(bundleImage string) input.Predicate {
7171
func Replaces(bundleID string) input.Predicate {
7272
return func(entity *input.Entity) bool {
7373
bundleEntity := olmentity.NewBundleEntity(entity)
74-
replaces, err := bundleEntity.Replaces()
74+
replaces, err := bundleEntity.BundleChannelEntry()
7575
if err != nil {
7676
return false
7777
}
78-
return replaces == bundleID
78+
return replaces.Replaces == bundleID
7979
}
8080
}

internal/resolution/util/predicates/predicates_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ var _ = Describe("Predicates", func() {
107107
Describe("Replaces", func() {
108108
It("should return true when the entity provides the replaces property", func() {
109109
entity := input.NewEntity("test", map[string]string{
110-
"olm.replaces": `{"replaces": "test.v0.2.0"}`,
110+
"olm.bundle.channelEntry": `{"replaces": "test.v0.2.0"}`,
111111
})
112112
Expect(predicates.Replaces("test.v0.2.0")(entity)).To(BeTrue())
113113
Expect(predicates.Replaces("test.v0.1.0")(entity)).To(BeFalse())
@@ -118,7 +118,7 @@ var _ = Describe("Predicates", func() {
118118
})
119119
It("should return false when the replace value is not a valid json", func() {
120120
entity := input.NewEntity("test", map[string]string{
121-
"olm.replaces": `{"replaces"}`,
121+
"olm.bundle.channelEntry": `{"replaces"}`,
122122
})
123123
Expect(predicates.Replaces("test.v0.2.0")(entity)).To(BeFalse())
124124
})

internal/resolution/variables/installed_package.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
olmentity "github.com/operator-framework/operator-controller/internal/resolution/entities"
1111
)
1212

13+
var _ deppy.Variable = &InstalledPackageVariable{}
14+
1315
type InstalledPackageVariable struct {
1416
*input.SimpleVariable
1517
bundleEntities []*olmentity.BundleEntity
@@ -19,8 +21,8 @@ func (r *InstalledPackageVariable) BundleEntities() []*olmentity.BundleEntity {
1921
return r.bundleEntities
2022
}
2123

22-
func NewInstalledPackageVariable(bundleImage string, bundleEntities []*olmentity.BundleEntity) *InstalledPackageVariable {
23-
id := deppy.IdentifierFromString(fmt.Sprintf("installed package %s", bundleImage))
24+
func NewInstalledPackageVariable(packageName string, bundleEntities []*olmentity.BundleEntity) *InstalledPackageVariable {
25+
id := deppy.IdentifierFromString(fmt.Sprintf("installed package %s", packageName))
2426
entityIDs := make([]deppy.Identifier, 0, len(bundleEntities))
2527
for _, bundle := range bundleEntities {
2628
entityIDs = append(entityIDs, bundle.ID)

internal/resolution/variablesources/bundle_deployment_test.go

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,25 @@ func bundleDeployment(name, image string) *rukpakv1alpha1.BundleDeployment {
4949

5050
var BundleDeploymentTestEntityCache = map[deppy.Identifier]input.Entity{
5151
"operatorhub/prometheus/0.37.0": *input.NewEntity("operatorhub/prometheus/0.37.0", map[string]string{
52-
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:3e281e587de3d03011440685fc4fb782672beab044c1ebadc42788ce05a21c35"`,
53-
"olm.channel": "{\"channelName\":\"beta\",\"priority\":0,\"replaces\":\"prometheusoperator.0.32.0\"}",
54-
"olm.gvk": "[{\"group\":\"monitoring.coreos.com\",\"kind\":\"Alertmanager\",\"version\":\"v1\"}, {\"group\":\"monitoring.coreos.com\",\"kind\":\"Prometheus\",\"version\":\"v1\"}]",
55-
"olm.package": "{\"packageName\":\"prometheus\",\"version\":\"0.37.0\"}",
52+
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:3e281e587de3d03011440685fc4fb782672beab044c1ebadc42788ce05a21c35"`,
53+
"olm.bundle.channelEntry": "{\"name\":\"prometheus.0.37.0\"}",
54+
"olm.channel": "{\"channelName\":\"beta\",\"priority\":0,\"replaces\":\"prometheusoperator.0.32.0\"}",
55+
"olm.gvk": "[{\"group\":\"monitoring.coreos.com\",\"kind\":\"Alertmanager\",\"version\":\"v1\"}, {\"group\":\"monitoring.coreos.com\",\"kind\":\"Prometheus\",\"version\":\"v1\"}]",
56+
"olm.package": "{\"packageName\":\"prometheus\",\"version\":\"0.37.0\"}",
5657
}),
5758
"operatorhub/prometheus/0.47.0": *input.NewEntity("operatorhub/prometheus/0.47.0", map[string]string{
58-
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:5b04c49d8d3eff6a338b56ec90bdf491d501fe301c9cdfb740e5bff6769a21ed"`,
59-
"olm.channel": "{\"channelName\":\"beta\",\"priority\":0,\"replaces\":\"prometheusoperator.0.37.0\"}",
60-
"olm.gvk": "[{\"group\":\"monitoring.coreos.com\",\"kind\":\"Alertmanager\",\"version\":\"v1\"}, {\"group\":\"monitoring.coreos.com\",\"kind\":\"Prometheus\",\"version\":\"v1alpha1\"}]",
61-
"olm.package": "{\"packageName\":\"prometheus\",\"version\":\"0.47.0\"}",
62-
"olm.replaces": "{\"replaces\":\"prometheus.0.37.0\"}",
59+
"olm.bundle.path": `"quay.io/operatorhubio/prometheus@sha256:5b04c49d8d3eff6a338b56ec90bdf491d501fe301c9cdfb740e5bff6769a21ed"`,
60+
"olm.bundle.channelEntry": "{\"replaces\":\"prometheus.0.37.0\", \"name\":\"prometheus.0.47.0\"}",
61+
"olm.channel": "{\"channelName\":\"beta\",\"priority\":0,\"replaces\":\"prometheusoperator.0.37.0\"}",
62+
"olm.gvk": "[{\"group\":\"monitoring.coreos.com\",\"kind\":\"Alertmanager\",\"version\":\"v1\"}, {\"group\":\"monitoring.coreos.com\",\"kind\":\"Prometheus\",\"version\":\"v1alpha1\"}]",
63+
"olm.package": "{\"packageName\":\"prometheus\",\"version\":\"0.47.0\"}",
6364
}),
6465
"operatorhub/packageA/2.0.0": *input.NewEntity("operatorhub/packageA/2.0.0", map[string]string{
65-
"olm.bundle.path": `"foo.io/packageA/packageA:v2.0.0"`,
66-
"olm.channel": "{\"channelName\":\"stable\",\"priority\":0}",
67-
"olm.gvk": "[{\"group\":\"foo.io\",\"kind\":\"Foo\",\"version\":\"v1\"}]",
68-
"olm.package": "{\"packageName\":\"packageA\",\"version\":\"2.0.0\"}",
66+
"olm.bundle.path": `"foo.io/packageA/packageA:v2.0.0"`,
67+
"olm.bundle.channelEntry": "{\"name\":\"packageA.2.0.0\"}",
68+
"olm.channel": "{\"channelName\":\"stable\",\"priority\":0}",
69+
"olm.gvk": "[{\"group\":\"foo.io\",\"kind\":\"Foo\",\"version\":\"v1\"}]",
70+
"olm.package": "{\"packageName\":\"packageA\",\"version\":\"2.0.0\"}",
6971
}),
7072
}
7173

@@ -92,7 +94,9 @@ var _ = Describe("BundleDeploymentVariableSource", func() {
9294
}
9395
return out
9496
}, Equal(map[deppy.Identifier]int{
95-
deppy.IdentifierFromString("installed package prometheus.v0.37.0"): 1,
97+
// Underlying `InstalledPackageVariableSource` returns current installed package
98+
// as a possible upgrade edge
99+
deppy.IdentifierFromString("installed package prometheus"): 2,
96100
})))
97101
})
98102
It("should return an error if the bundleDeployment image doesn't match any operator resource", func() {

internal/resolution/variablesources/installed_package.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ func (r *InstalledPackageVariableSource) GetVariables(ctx context.Context, entit
5050
if err != nil {
5151
return nil, err
5252
}
53-
version, err := installedBundle.Version()
53+
54+
channelEntry, err := installedBundle.BundleChannelEntry()
5455
if err != nil {
5556
return nil, err
5657
}
57-
bundleID := fmt.Sprintf("%s.v%s", packageName, version.String())
58-
resultSet, err = entitySource.Filter(ctx, predicates.Replaces(bundleID))
58+
59+
resultSet, err = entitySource.Filter(ctx, predicates.Replaces(channelEntry.Name))
5960
if err != nil {
6061
return nil, err
6162
}
@@ -68,7 +69,7 @@ func (r *InstalledPackageVariableSource) GetVariables(ctx context.Context, entit
6869
// you can always upgrade to yourself, i.e. not upgrade
6970
upgradeEdges = append(upgradeEdges, installedBundle)
7071
return []deppy.Variable{
71-
variables.NewInstalledPackageVariable(bundleID, upgradeEdges),
72+
variables.NewInstalledPackageVariable(packageName, upgradeEdges),
7273
}, nil
7374
}
7475

internal/resolution/variablesources/installed_package_test.go

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,34 @@ var _ = Describe("InstalledPackageVariableSource", func() {
2929

3030
mockEntitySource = input.NewCacheQuerier(map[deppy.Identifier]input.Entity{
3131
"test-package.v1.0.0": *input.NewEntity("test-package.v1.0.0test-packagestable", map[string]string{
32-
property.TypePackage: `{"packageName": "test-package", "version": "1.0.0"}`,
33-
olmentity.PropertyBundlePath: `"registry.io/repo/[email protected]"`,
34-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
32+
property.TypePackage: `{"packageName": "test-package", "version": "1.0.0"}`,
33+
property.TypeChannel: `{"channelName":"stable","priority":0}`,
34+
olmentity.PropertyBundlePath: `"registry.io/repo/[email protected]"`,
35+
olmentity.PropertyBundleChannelEntry: `{"name": "test-package.v1.0.0"}`,
3536
}),
3637
"test-package.v3.0.0": *input.NewEntity("test-package.v3.0.0test-packagestable", map[string]string{
37-
property.TypePackage: `{"packageName": "test-package", "version": "3.0.0"}`,
38-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
39-
olmentity.PropertyBundlePath: `"registry.io/repo/[email protected]"`,
40-
"olm.replaces": `{"replaces": "test-package.v2.0.0"}`,
38+
property.TypePackage: `{"packageName": "test-package", "version": "3.0.0"}`,
39+
property.TypeChannel: `{"channelName":"stable","priority":0}`,
40+
olmentity.PropertyBundlePath: `"registry.io/repo/[email protected]"`,
41+
olmentity.PropertyBundleChannelEntry: `{"name": "test-package.v3.0.0","replaces": "test-package.v2.0.0"}`,
4142
}),
4243
"test-package.v2.0.0": *input.NewEntity("test-package.v2.0.0test-packagestable", map[string]string{
43-
property.TypePackage: `{"packageName": "test-package", "version": "2.0.0"}`,
44-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
45-
olmentity.PropertyBundlePath: `"registry.io/repo/[email protected]"`,
46-
"olm.replaces": `{"replaces": "test-package.v1.0.0"}`,
44+
property.TypePackage: `{"packageName": "test-package", "version": "2.0.0"}`,
45+
property.TypeChannel: `{"channelName":"stable","priority":0}`,
46+
olmentity.PropertyBundlePath: `"registry.io/repo/[email protected]"`,
47+
olmentity.PropertyBundleChannelEntry: `{"name": "test-package.v2.0.0","replaces": "test-package.v1.0.0"}`,
4748
}),
4849
"test-package.4.0.0": *input.NewEntity("test-package.v4.0.0test-packagestable", map[string]string{
49-
property.TypePackage: `{"packageName": "test-package", "version": "4.0.0"}`,
50-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
51-
olmentity.PropertyBundlePath: `"registry.io/repo/[email protected]"`,
52-
"olm.replaces": `{"replaces": "test-package.v3.0.0"}`,
50+
property.TypePackage: `{"packageName": "test-package", "version": "4.0.0"}`,
51+
property.TypeChannel: `{"channelName":"stable","priority":0}`,
52+
olmentity.PropertyBundlePath: `"registry.io/repo/[email protected]"`,
53+
olmentity.PropertyBundleChannelEntry: `{"name": "test-package.v4.0.0","replaces": "test-package.v3.0.0"}`,
5354
}),
5455
"test-package.5.0.0": *input.NewEntity("test-package.v5.0.0test-packagestable", map[string]string{
55-
property.TypePackage: `{"packageName": "test-package", "version": "5-00"}`,
56-
property.TypeChannel: `{"channelName":"stable","priority":0}`,
57-
olmentity.PropertyBundlePath: `"registry.io/repo/[email protected]"`,
58-
"olm.replaces": `{"replaces": "test-package.v4.0.0"}`,
56+
property.TypePackage: `{"packageName": "test-package", "version": "5-00"}`,
57+
property.TypeChannel: `{"channelName":"stable","priority":0}`,
58+
olmentity.PropertyBundlePath: `"registry.io/repo/[email protected]"`,
59+
olmentity.PropertyBundleChannelEntry: `{"name": "test-package.v5.0.0","replaces": "test-package.v4.0.0"}`,
5960
}),
6061
})
6162
})
@@ -66,7 +67,7 @@ var _ = Describe("InstalledPackageVariableSource", func() {
6667
Expect(variables).To(HaveLen(1))
6768
reqPackageVar, ok := variables[0].(*olmvariables.InstalledPackageVariable)
6869
Expect(ok).To(BeTrue())
69-
Expect(reqPackageVar.Identifier()).To(Equal(deppy.IdentifierFromString("installed package test-package.v2.0.0")))
70+
Expect(reqPackageVar.Identifier()).To(Equal(deppy.IdentifierFromString("installed package test-package")))
7071

7172
// ensure bundle entities are in version order (high to low)
7273
Expect(reqPackageVar.BundleEntities()[0].ID).To(Equal(deppy.IdentifierFromString("test-package.v3.0.0test-packagestable")))

0 commit comments

Comments
 (0)