|
1 | 1 | package resolver
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "fmt" |
4 | 5 | "strings"
|
5 | 6 | "testing"
|
6 | 7 | "time"
|
@@ -169,7 +170,7 @@ func TestResolver(t *testing.T) {
|
169 | 170 | {
|
170 | 171 | Path: "quay.io/test/bundle@sha256:abcd",
|
171 | 172 | Identifier: "b.v1",
|
172 |
| - Properties: `{"properties":[{"type":"olm.gvk","value":{"group":"g","kind":"k","version":"v"}}]}`, |
| 173 | + Properties: `{"properties":[{"type":"olm.gvk","value":{"group":"g","kind":"k","version":"v"}},{"type":"olm.package","value":{"packageName":"b","version":"0.0.0"}}]}`, |
173 | 174 | CatalogSourceRef: &corev1.ObjectReference{
|
174 | 175 | Namespace: catalog.Namespace,
|
175 | 176 | Name: catalog.Name,
|
@@ -349,7 +350,7 @@ func TestResolver(t *testing.T) {
|
349 | 350 | Path: "quay.io/test/bundle@sha256:abcd",
|
350 | 351 | Identifier: "a.v2",
|
351 | 352 | Replaces: "a.v1",
|
352 |
| - Properties: `{"properties":[{"type":"olm.gvk","value":{"group":"g","kind":"k","version":"v"}}]}`, |
| 353 | + Properties: `{"properties":[{"type":"olm.gvk","value":{"group":"g","kind":"k","version":"v"}},{"type":"olm.package","value":{"packageName":"a","version":"0.0.0"}}]}`, |
353 | 354 | CatalogSourceRef: &corev1.ObjectReference{
|
354 | 355 | Namespace: catalog.Namespace,
|
355 | 356 | Name: catalog.Name,
|
@@ -596,24 +597,14 @@ func TestResolver(t *testing.T) {
|
596 | 597 | }},
|
597 | 598 | out: resolverTestOut{
|
598 | 599 | steps: [][]*v1alpha1.Step{
|
599 |
| - bundleSteps(bundle("a.v3", "a", "alpha", "a.v2", nil, nil, nil, nil), namespace, "a.v1", catalog), |
| 600 | + bundleSteps(bundle("a.v3", "a", "alpha", "a.v2", nil, nil, nil, nil, withVersion("1.0.0"), withSkipRange("< 1.0.0")), namespace, "a.v1", catalog), |
600 | 601 | },
|
601 | 602 | subs: []*v1alpha1.Subscription{
|
602 | 603 | updatedSub(namespace, "a.v3", "a.v1", "a", "alpha", catalog),
|
603 | 604 | },
|
604 | 605 | },
|
605 | 606 | },
|
606 | 607 | {
|
607 |
| - // This test uses logic that implements the FakeSourceQuerier to ensure |
608 |
| - // that the required API is provided by the new Operator. |
609 |
| - // |
610 |
| - // Background: |
611 |
| - // OLM used to add the new operator to the generation before removing |
612 |
| - // the old operator from the generation. The logic that removes an operator |
613 |
| - // from the current generation removes the APIs it provides from the list of |
614 |
| - // "available" APIs. This caused OLM to search for an operator that provides the API. |
615 |
| - // If the operator that provides the API uses a skipRange rather than the Spec.Replaces |
616 |
| - // field, the Replaces field is set to an empty string, causing OLM to fail to upgrade. |
617 | 608 | name: "InstalledSubs/ExistingOperators/OldCSVsReplaced",
|
618 | 609 | clusterState: []runtime.Object{
|
619 | 610 | existingSub(namespace, "a.v1", "a", "alpha", catalog),
|
@@ -653,7 +644,7 @@ func TestResolver(t *testing.T) {
|
653 | 644 | }},
|
654 | 645 | out: resolverTestOut{
|
655 | 646 | steps: [][]*v1alpha1.Step{
|
656 |
| - bundleSteps(bundle("a.v3", "a", "alpha", "", nil, nil, nil, nil), namespace, "a.v1", catalog), |
| 647 | + bundleSteps(bundle("a.v3", "a", "alpha", "", nil, nil, nil, nil, withVersion("1.0.0"), withSkipRange("< 1.0.0")), namespace, "a.v1", catalog), |
657 | 648 | },
|
658 | 649 | subs: []*v1alpha1.Subscription{
|
659 | 650 | updatedSub(namespace, "a.v3", "a.v1", "a", "alpha", catalog),
|
@@ -691,7 +682,7 @@ func TestResolver(t *testing.T) {
|
691 | 682 | }},
|
692 | 683 | out: resolverTestOut{
|
693 | 684 | steps: [][]*v1alpha1.Step{
|
694 |
| - bundleSteps(bundle("a.v3", "a", "alpha", "", nil, nil, nil, nil), namespace, "a.v1", catalog), |
| 685 | + bundleSteps(bundle("a.v3", "a", "alpha", "", nil, nil, nil, nil, withVersion("1.0.0"), withSkips([]string{"a.v1"})), namespace, "a.v1", catalog), |
695 | 686 | },
|
696 | 687 | subs: []*v1alpha1.Subscription{
|
697 | 688 | updatedSub(namespace, "a.v3", "a.v1", "a", "alpha", catalog),
|
|
0 commit comments