Skip to content
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

Incorrect filtering of bundles for semver upgrades #477

Closed
m1kola opened this issue Oct 23, 2023 · 1 comment · Fixed by #480
Closed

Incorrect filtering of bundles for semver upgrades #477

m1kola opened this issue Oct 23, 2023 · 1 comment · Fixed by #480
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@m1kola
Copy link
Member

m1kola commented Oct 23, 2023

I just realised that #444 has insufficient filtering of bundles for semver based upgrades. Here we only filter all bundles based on version:

upgradeEdges := catalogfilter.Filter(allBundles, catalogfilter.InMastermindsSemverRange(wantedVersionRangeConstraint))

allBundles includes all bundles from all catalogs for all packages. This code must also filter by package name.

@m1kola m1kola added kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Oct 23, 2023
@m1kola m1kola self-assigned this Oct 23, 2023
@m1kola
Copy link
Member Author

m1kola commented Oct 23, 2023

Test case for this bug (can be applied on top of 3fc434d):

diff --git a/internal/resolution/variablesources/installed_package_test.go b/internal/resolution/variablesources/installed_package_test.go
index 1accbb8..f01fce7 100644
--- a/internal/resolution/variablesources/installed_package_test.go
+++ b/internal/resolution/variablesources/installed_package_test.go
@@ -181,6 +181,15 @@ func TestInstalledPackageVariableSource(t *testing.T) {
                        }},
                        InChannels: []*catalogmetadata.Channel{&channel},
                },
+               {Bundle: declcfg.Bundle{
+                       Name:    "some-other-package.v2.3.0",
+                       Package: "some-other-package",
+                       Image:   "registry.io/repo/some-other-package@v2.3.0",
+                       Properties: []property.Property{
+                               {Type: property.TypePackage, Value: json.RawMessage(`{"packageName": "some-other-package", "version": "2.3.0"}`)},
+                       }},
+                       InChannels: []*catalogmetadata.Channel{&channel},
+               },
        }

        fakeCatalogClient := testutil.NewFakeCatalogClient(bundleList)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant