Skip to content

Commit 57ac405

Browse files
authored
🌱 Update to catalogd v0.26.0 and update e2e tests (#1237)
* Update to catalogd v0.26.0 and update e2e tests * Use proper labels from catalogd * Add better deployment checking * Fix broken test This test seems broken, it's supposed to resolve again after updating to V2. The test implies that this should be the 2.0.0 version, but it's checking against 1.2.0 (which was the original version installed). Signed-off-by: Todd Short <[email protected]> * fixup! Update to catalogd v0.26.0 and update e2e tests Signed-off-by: Todd Short <[email protected]> --------- Signed-off-by: Todd Short <[email protected]>
1 parent f8c9077 commit 57ac405

File tree

6 files changed

+30
-18
lines changed

6 files changed

+30
-18
lines changed

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/onsi/ginkgo/v2 v2.20.2
1515
github.com/onsi/gomega v1.34.2
1616
github.com/operator-framework/api v0.27.0
17-
github.com/operator-framework/catalogd v0.23.0
17+
github.com/operator-framework/catalogd v0.26.0
1818
github.com/operator-framework/helm-operator-plugins v0.5.0
1919
github.com/operator-framework/operator-registry v1.46.0
2020
github.com/spf13/pflag v1.0.5
@@ -161,7 +161,7 @@ require (
161161
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
162162
github.com/pkg/errors v0.9.1 // indirect
163163
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
164-
github.com/prometheus/client_golang v1.20.2 // indirect
164+
github.com/prometheus/client_golang v1.20.3 // indirect
165165
github.com/prometheus/client_model v0.6.1 // indirect
166166
github.com/prometheus/common v0.55.0 // indirect
167167
github.com/prometheus/procfs v0.15.1 // indirect

go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@ github.com/openshift/crd-schema-checker v0.0.0-20240404194209-35a9033b1d11 h1:eT
518518
github.com/openshift/crd-schema-checker v0.0.0-20240404194209-35a9033b1d11/go.mod h1:EmVJt97N+pfWFsli/ipXTBZqSG5F5KGQhm3c3IsGq1o=
519519
github.com/operator-framework/api v0.27.0 h1:OrVaGKZJvbZo58HTv2guz7aURkhVKYhFqZ/6VpifiXI=
520520
github.com/operator-framework/api v0.27.0/go.mod h1:lg2Xx+S8NQWGYlEOvFwQvH46E5EK5IrAIL7HWfAhciM=
521-
github.com/operator-framework/catalogd v0.23.0 h1:LAuiYuFftCQp6Jvol9pWbyvOY04QP7xH0dcf9ZO9RcE=
522-
github.com/operator-framework/catalogd v0.23.0/go.mod h1:OFG4YhsIctwdi97m2pyrsafjPBgIrXpP6gfK1nNIJjc=
521+
github.com/operator-framework/catalogd v0.26.0 h1:RDzNEv631o7WgkXGfFrOCiFBaBMwK621/vinRuOS2LI=
522+
github.com/operator-framework/catalogd v0.26.0/go.mod h1:pR03BacyPJPeVk6KM5OW6CLOoqkHzvyncQSZmiO3+IQ=
523523
github.com/operator-framework/helm-operator-plugins v0.5.0 h1:qph2OoECcI9mpuUBtOsWOMgvpx52mPTTSvzVxICsT04=
524524
github.com/operator-framework/helm-operator-plugins v0.5.0/go.mod h1:yVncrZ/FJNqedMil+055fk6sw8aMKRrget/AqGM0ig0=
525525
github.com/operator-framework/operator-lib v0.15.0 h1:0QeRM4PMtThqINpcFGCEBnIV3Z8u7/8fYLEx6mUtdcM=
@@ -550,8 +550,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
550550
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
551551
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
552552
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
553-
github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg=
554-
github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
553+
github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4=
554+
github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
555555
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
556556
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
557557
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=

internal/resolve/catalog_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ func (w staticCatalogWalker) WalkCatalogs(ctx context.Context, _ string, f Catal
673673
ObjectMeta: metav1.ObjectMeta{
674674
Name: k,
675675
Labels: map[string]string{
676-
"olm.operatorframework.io/name": k,
676+
"olm.operatorframework.io/metadata.name": k,
677677
},
678678
},
679679
}
@@ -852,7 +852,7 @@ func TestClusterExtensionMatchLabel(t *testing.T) {
852852
}
853853
r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs}
854854
ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyEnforce)
855-
ce.Spec.Source.Catalog.Selector.MatchLabels = map[string]string{"olm.operatorframework.io/name": "b"}
855+
ce.Spec.Source.Catalog.Selector.MatchLabels = map[string]string{"olm.operatorframework.io/metadata.name": "b"}
856856

857857
_, _, _, err := r.Resolve(context.Background(), ce, nil)
858858
require.NoError(t, err)
@@ -871,7 +871,7 @@ func TestClusterExtensionNoMatchLabel(t *testing.T) {
871871
}
872872
r := CatalogResolver{WalkCatalogsFunc: w.WalkCatalogs}
873873
ce := buildFooClusterExtension(pkgName, []string{}, "", ocv1alpha1.UpgradeConstraintPolicyEnforce)
874-
ce.Spec.Source.Catalog.Selector.MatchLabels = map[string]string{"olm.operatorframework.io/name": "a"}
874+
ce.Spec.Source.Catalog.Selector.MatchLabels = map[string]string{"olm.operatorframework.io/metadata.name": "a"}
875875

876876
_, _, _, err := r.Resolve(context.Background(), ce, nil)
877877
require.Error(t, err)

scripts/install.tpl.sh

+10
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,20 @@ function kubectl_wait() {
3333
kubectl wait --for=condition=Available --namespace="${namespace}" "${runtime}" --timeout="${timeout}"
3434
}
3535

36+
function kubectl_wait_rollout() {
37+
namespace=$1
38+
runtime=$2
39+
timeout=$3
40+
41+
kubectl rollout status --namespace="${namespace}" "${runtime}" --timeout="${timeout}"
42+
}
43+
3644
kubectl apply -f "https://github.com/cert-manager/cert-manager/releases/download/${cert_mgr_version}/cert-manager.yaml"
3745
kubectl_wait "cert-manager" "deployment/cert-manager-webhook" "60s"
3846

3947
kubectl apply -f "https://github.com/operator-framework/catalogd/releases/download/${catalogd_version}/catalogd.yaml"
48+
# Wait for the rollout, and then wait for the deployment to be Available
49+
kubectl_wait_rollout "olmv1-system" "deployment/catalogd-controller-manager" "60s"
4050
kubectl_wait "olmv1-system" "deployment/catalogd-controller-manager" "60s"
4151

4252
if [[ "${install_default_catalogs,,}" != "false" ]]; then

test/e2e/cluster_extension_install_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ func TestClusterExtensionInstallRegistry(t *testing.T) {
231231
Catalog: &ocv1alpha1.CatalogSource{
232232
PackageName: "prometheus",
233233
Selector: metav1.LabelSelector{
234-
MatchLabels: map[string]string{"olm.operatorframework.io/name": extensionCatalog.Name},
234+
MatchLabels: map[string]string{"olm.operatorframework.io/metadata.name": extensionCatalog.Name},
235235
},
236236
},
237237
},
@@ -548,7 +548,7 @@ func TestClusterExtensionInstallReResolvesWhenCatalogIsPatched(t *testing.T) {
548548
Selector: metav1.LabelSelector{
549549
MatchExpressions: []metav1.LabelSelectorRequirement{
550550
{
551-
Key: "olm.operatorframework.io/name",
551+
Key: "olm.operatorframework.io/metadata.name",
552552
Operator: metav1.LabelSelectorOpIn,
553553
Values: []string{extensionCatalog.Name},
554554
},
@@ -652,7 +652,7 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) {
652652
Catalog: &ocv1alpha1.CatalogSource{
653653
PackageName: "prometheus",
654654
Selector: metav1.LabelSelector{
655-
MatchLabels: map[string]string{"olm.operatorframework.io/name": extensionCatalog.Name},
655+
MatchLabels: map[string]string{"olm.operatorframework.io/metadata.name": extensionCatalog.Name},
656656
},
657657
},
658658
},
@@ -713,8 +713,8 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) {
713713
assert.Contains(ct, cond.Message, "resolved to")
714714
assert.Equal(ct,
715715
&ocv1alpha1.ClusterExtensionResolutionStatus{Bundle: &ocv1alpha1.BundleMetadata{
716-
Name: "prometheus-operator.1.2.0",
717-
Version: "1.2.0",
716+
Name: "prometheus-operator.2.0.0",
717+
Version: "2.0.0",
718718
}},
719719
clusterExtension.Status.Resolution,
720720
)
@@ -734,7 +734,7 @@ func TestClusterExtensionInstallReResolvesWhenManagedContentChanged(t *testing.T
734734
Catalog: &ocv1alpha1.CatalogSource{
735735
PackageName: "prometheus",
736736
Selector: metav1.LabelSelector{
737-
MatchLabels: map[string]string{"olm.operatorframework.io/name": extensionCatalog.Name},
737+
MatchLabels: map[string]string{"olm.operatorframework.io/metadata.name": extensionCatalog.Name},
738738
},
739739
},
740740
},
@@ -806,7 +806,7 @@ func TestClusterExtensionRecoversFromInitialInstallFailedWhenFailureFixed(t *tes
806806
Catalog: &ocv1alpha1.CatalogSource{
807807
PackageName: "prometheus",
808808
Selector: metav1.LabelSelector{
809-
MatchLabels: map[string]string{"olm.operatorframework.io/name": extensionCatalog.Name},
809+
MatchLabels: map[string]string{"olm.operatorframework.io/metadata.name": extensionCatalog.Name},
810810
},
811811
},
812812
},

test/e2e/e2e_suite_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ func TestMain(m *testing.M) {
4141
// createTestCatalog will create a new catalog on the test cluster, provided
4242
// the context, catalog name, and the image reference. It returns the created catalog
4343
// or an error if any errors occurred while creating the catalog.
44+
// Note that catalogd will automatically create the label:
45+
//
46+
// "olm.operatorframework.io/metadata.name": name
4447
func createTestCatalog(ctx context.Context, name string, imageRef string) (*catalogd.ClusterCatalog, error) {
4548
catalog := &catalogd.ClusterCatalog{
4649
ObjectMeta: metav1.ObjectMeta{
47-
Name: name,
48-
Labels: map[string]string{"olm.operatorframework.io/name": name},
50+
Name: name,
4951
},
5052
Spec: catalogd.ClusterCatalogSpec{
5153
Source: catalogd.CatalogSource{

0 commit comments

Comments
 (0)