-
Notifications
You must be signed in to change notification settings - Fork 69
✨use legacy successors, support skips and skipRange #743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
joelanford
merged 1 commit into
operator-framework:main
from
joelanford:support-skips-skipRange
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -306,6 +306,20 @@ func TestMakeInstalledPackageVariablesWithForceSemverUpgradeConstraintsDisabled( | |
| Name: "test-package.v2.2.0", | ||
| Replaces: "test-package.v2.1.0", | ||
| }, | ||
| { | ||
| Name: "test-package.v2.2.1", | ||
| }, | ||
| { | ||
| Name: "test-package.v2.3.0", | ||
| Replaces: "test-package.v2.2.0", | ||
| Skips: []string{ | ||
| "test-package.v2.2.1", | ||
| }, | ||
| }, | ||
| { | ||
| Name: "test-package.v2.4.0", | ||
| SkipRange: ">=2.3.0 <2.4.0", | ||
| }, | ||
| }, | ||
| }} | ||
| bundleSet := map[string]*catalogmetadata.Bundle{ | ||
|
|
@@ -342,6 +356,39 @@ func TestMakeInstalledPackageVariablesWithForceSemverUpgradeConstraintsDisabled( | |
| }, | ||
| InChannels: []*catalogmetadata.Channel{&testPackageChannel}, | ||
| }, | ||
| "test-package.v2.2.1": { | ||
| Bundle: declcfg.Bundle{ | ||
| Name: "test-package.v2.2.1", | ||
| Package: testPackageName, | ||
| Image: "registry.io/repo/[email protected]", | ||
| Properties: []property.Property{ | ||
| {Type: property.TypePackage, Value: json.RawMessage(`{"packageName": "test-package", "version": "2.2.1"}`)}, | ||
| }, | ||
| }, | ||
| InChannels: []*catalogmetadata.Channel{&testPackageChannel}, | ||
| }, | ||
| "test-package.v2.3.0": { | ||
| Bundle: declcfg.Bundle{ | ||
| Name: "test-package.v2.3.0", | ||
| Package: testPackageName, | ||
| Image: "registry.io/repo/[email protected]", | ||
| Properties: []property.Property{ | ||
| {Type: property.TypePackage, Value: json.RawMessage(`{"packageName": "test-package", "version": "2.3.0"}`)}, | ||
| }, | ||
| }, | ||
| InChannels: []*catalogmetadata.Channel{&testPackageChannel}, | ||
| }, | ||
| "test-package.v2.4.0": { | ||
| Bundle: declcfg.Bundle{ | ||
| Name: "test-package.v2.4.0", | ||
| Package: testPackageName, | ||
| Image: "registry.io/repo/[email protected]", | ||
| Properties: []property.Property{ | ||
| {Type: property.TypePackage, Value: json.RawMessage(`{"packageName": "test-package", "version": "2.4.0"}`)}, | ||
| }, | ||
| }, | ||
| InChannels: []*catalogmetadata.Channel{&testPackageChannel}, | ||
| }, | ||
| // We need a bundle from different package to ensure that | ||
| // we filter out bundles certain bundle image | ||
| "some-other-package.v2.3.0": { | ||
|
|
@@ -382,6 +429,34 @@ func TestMakeInstalledPackageVariablesWithForceSemverUpgradeConstraintsDisabled( | |
| }), | ||
| }, | ||
| }, | ||
| { | ||
| name: "respect skips directive from catalog", | ||
| upgradeConstraintPolicy: ocv1alpha1.UpgradeConstraintPolicyEnforce, | ||
| installedBundle: bundleSet["test-package.v2.2.1"], | ||
| expectedResult: []*olmvariables.InstalledPackageVariable{ | ||
| olmvariables.NewInstalledPackageVariable(testPackageName, []*catalogmetadata.Bundle{ | ||
| // Must only have two bundle: | ||
| // - the one which skips the current version | ||
| // - the current version (to allow to stay on the current version) | ||
| bundleSet["test-package.v2.3.0"], | ||
| bundleSet["test-package.v2.2.1"], | ||
| }), | ||
| }, | ||
| }, | ||
| { | ||
| name: "respect skipRange directive from catalog", | ||
| upgradeConstraintPolicy: ocv1alpha1.UpgradeConstraintPolicyEnforce, | ||
| installedBundle: bundleSet["test-package.v2.3.0"], | ||
| expectedResult: []*olmvariables.InstalledPackageVariable{ | ||
| olmvariables.NewInstalledPackageVariable(testPackageName, []*catalogmetadata.Bundle{ | ||
| // Must only have two bundle: | ||
| // - the one which is skipRanges the current version | ||
| // - the current version (to allow to stay on the current version) | ||
| bundleSet["test-package.v2.4.0"], | ||
| bundleSet["test-package.v2.3.0"], | ||
| }), | ||
| }, | ||
| }, | ||
| { | ||
| name: "UpgradeConstraintPolicy is set to Ignore", | ||
| upgradeConstraintPolicy: ocv1alpha1.UpgradeConstraintPolicyIgnore, | ||
|
|
@@ -409,6 +484,22 @@ func TestMakeInstalledPackageVariablesWithForceSemverUpgradeConstraintsDisabled( | |
| }, | ||
| expectedError: `bundle with image "registry.io/repo/[email protected]" for package "test-package" not found in available catalogs but is currently installed via BundleDeployment "test-package-bd"`, | ||
| }, | ||
| { | ||
| name: "installed bundle not found, but UpgradeConstraintPolicy is set to Ignore", | ||
| upgradeConstraintPolicy: ocv1alpha1.UpgradeConstraintPolicyIgnore, | ||
| installedBundle: &catalogmetadata.Bundle{ | ||
| Bundle: declcfg.Bundle{ | ||
| Name: "test-package.v9.0.0", | ||
| Package: testPackageName, | ||
| Image: "registry.io/repo/[email protected]", | ||
| Properties: []property.Property{ | ||
| {Type: property.TypePackage, Value: json.RawMessage(`{"packageName": "test-package", "version": "9.0.0"}`)}, | ||
| }, | ||
| }, | ||
| InChannels: []*catalogmetadata.Channel{&testPackageChannel}, | ||
| }, | ||
| expectedResult: []*olmvariables.InstalledPackageVariable{}, | ||
| }, | ||
| } { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| fakeOwnerClusterExtension := fakeClusterExtension("test-extension-legacy", testPackageName, tt.upgradeConstraintPolicy) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference between blang semver and masterminds semver import aliases is so little that overlooking the subtlety is really easy to do.
Your code is fine, though I can't help but wonder though when someone will 'cross the streams' and we'll miss it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah agreed. Perhaps we should think about adding some wrappers that obviate the subtlety?