From 4944df4787e192d299ba98c447aef04b49007553 Mon Sep 17 00:00:00 2001 From: Xia Zhao Date: Tue, 25 Nov 2025 22:19:03 +0800 Subject: [PATCH] UPSTREAM: : migrate olmv1 QE cases --- .../openshift_payload_olmv1.json | 195 +++ .../pkg/bindata/operator/operator.go | 35 +- .../tests-extension/pkg/bindata/qe/bindata.go | 193 ++- .../tests-extension/test/qe/specs/olmv1.go | 112 ++ .../tests-extension/test/qe/specs/olmv1_ce.go | 1432 +++++++++++++++++ ...ion-withselectorlabel-WithoutVersion.yaml} | 16 +- ...electorlabel-withoutChannel-OwnSingle.yaml | 45 + 7 files changed, 1954 insertions(+), 74 deletions(-) rename openshift/tests-extension/test/qe/testdata/olm/{clusterextension-withoutChannel-OwnSingle.yaml => clusterextension-withselectorlabel-WithoutVersion.yaml} (71%) create mode 100644 openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml diff --git a/openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json b/openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json index f587662af..c28c3f929 100644 --- a/openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json +++ b/openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json @@ -16,6 +16,36 @@ "exclude": "topology==\"External\"" } }, + { + "name": "[sig-olmv1][Jira:OLM] cluster-olm-operator PolarionID:78393-[OTP][Skipped:Disconnected]support metrics", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] cluster-olm-operator PolarionID:79770-[OTP][Level0]metrics are collected by default", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, { "name": "[sig-olmv1][Jira:OLM] clustercatalog PolarionID:69242-[OTP][Skipped:Disconnected]Catalogd deprecated package bundlemetadata catalogmetadata from clustercatalog CR", "originalName": "[sig-olmv1][Jira:OLM] clustercatalog PolarionID:69242-[Skipped:Disconnected]Catalogd deprecated package bundlemetadata catalogmetadata from clustercatalog CR", @@ -565,6 +595,171 @@ "exclude": "topology==\"External\"" } }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:69196-[OTP][Level0][Skipped:Disconnected]Supports Version Ranges during clusterextension upgrade", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:68821-[OTP][Skipped:Disconnected]Supports Version Ranges during Installation", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:74108-[OTP][Skipped:Disconnected][Slow]olm v1 supports legacy upgrade edges", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:74923-[OTP][Skipped:Disconnected]no two ClusterExtensions can manage the same underlying object", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:75501-[OTP][Skipped:Disconnected]the updates of various status fields is orthogonal", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:76685-[OTP][Skipped:Disconnected]olm v1 supports selecting catalogs [Serial]", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:77972-[OTP][Skipped:Disconnected]olm v1 Supports MaxOCPVersion in properties file", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:82249-[OTP][Skipped:Disconnected]Verify olmv1 support for float type maxOCPVersion in properties file", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:80117-[OTP][Skipped:Disconnected] Single Namespace Install Mode should be supported", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:80120-[OTP][Skipped:Disconnected] Own Namespace Install Mode should be supported", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:82136-[OTP][Skipped:Disconnected]olm v1 supports NetworkPolicy resources", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, { "name": "[sig-olmv1][Jira:OLM] OLM v1 for stress PolarionID:81509-[OTP][Skipped:Disconnected][OlmStress]olmv1 create mass operator to see if they all are installed successfully [Slow][Timeout:330m]", "labels": { diff --git a/openshift/tests-extension/pkg/bindata/operator/operator.go b/openshift/tests-extension/pkg/bindata/operator/operator.go index d4a997490..f849820b8 100644 --- a/openshift/tests-extension/pkg/bindata/operator/operator.go +++ b/openshift/tests-extension/pkg/bindata/operator/operator.go @@ -2,6 +2,7 @@ // sources: // testdata/operator/Dockerfile // testdata/operator/manifests/registry.clusterserviceversion.yaml +// testdata/operator/manifests/script.configmap.yaml // testdata/operator/metadata/annotations.yaml // testdata/operator/metadata/properties.yaml // testdata/operator/tests/scorecard/config.yaml @@ -96,12 +97,12 @@ func dockerfile() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "Dockerfile", size: 888, mode: os.FileMode(420), modTime: time.Unix(1760017176, 0)} + info := bindataFileInfo{name: "Dockerfile", size: 888, mode: os.FileMode(420), modTime: time.Unix(1759972370, 0)} a := &asset{bytes: bytes, info: info} return a, nil } -var _manifestsRegistryClusterserviceversionYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x57\x4d\x6f\xe3\x36\x13\xbe\xfb\x57\x0c\x74\x7e\xe9\xd8\xd9\xec\xbe\x01\x4f\xcd\xee\x06\x8b\x02\xf9\x42\x92\xf6\xd0\xa2\x28\xc6\xd4\xc4\x66\x4d\x91\x2c\x49\x39\xab\x4d\xf3\xdf\x0b\x52\x92\x2d\x59\x72\x92\x45\x7b\x29\x2f\x92\xe6\xf3\x99\xe1\x70\x38\x42\x2b\x7f\x26\xe7\xa5\xd1\x1c\x8c\x25\x87\xc1\x38\x3f\x15\xc6\x91\x89\x8f\xe2\x68\x33\x47\x65\x57\x38\x9f\xac\xa5\xce\x39\x7c\x52\xa5\x0f\xe4\xee\xc8\x6d\xa4\xa0\x46\x75\x52\x50\xc0\x1c\x03\xf2\x09\x00\x6a\x6d\x02\x06\x69\xb4\x8f\x9f\x00\xa8\x0a\x46\x5f\xb1\xb0\x8a\x3c\x87\xbf\x58\x22\x02\xfc\xda\x3c\x01\x9e\xb6\x6f\x00\xd9\x0e\x50\xc6\x21\x33\x82\x19\x9b\xd3\x86\xd1\x31\x4d\x5b\x7c\x0f\x0e\x0b\x7a\x34\x6e\x3d\x95\x66\xfa\xaa\xc4\x36\x82\xec\x7f\x5d\x3f\x31\x9c\xe8\xe1\x96\x96\xd2\x07\x57\xf5\xb9\x6d\x40\x19\xef\xa1\x03\xc8\x14\x2e\x48\xf9\x01\x3d\x21\xb7\xd3\x75\xb9\x20\xa7\x29\x90\x8f\x9e\x0b\xd4\xb8\xa4\x9c\x2d\xaa\xe8\x69\x5d\xfa\x60\x0a\xf9\x8d\x7a\xae\x0e\xa8\x6a\x2c\x28\x2a\x3d\x3d\xc1\xfd\xf9\xdd\x3d\xfb\xf8\xd3\xd5\xe7\x8b\x73\x78\x7e\xce\x7a\xba\xcf\x7d\x53\xd9\x41\x35\xe6\xd3\x06\x74\xb5\x7b\xba\x99\xb7\x24\x32\x0e\xba\x54\x6a\x4b\x7e\x6e\xde\x7e\x4b\x4f\x81\x16\x17\x52\xc9\x20\xe3\x3e\x7e\x44\x2f\x05\xfc\xa8\x7d\xc0\x46\x43\x38\xc2\x40\xf9\x59\xe0\x90\x1d\xcf\x8e\xdf\xb3\xd9\x29\x9b\x7d\xb8\x9f\xff\x9f\x9f\xbc\xe3\x27\xf3\x5f\x6a\xdf\xbb\x22\x1b\xdd\xac\x45\x29\x55\x4e\x6e\x57\x8c\xcc\xe7\x6b\xb6\x99\x4f\xdf\x9d\x4c\xe7\x6f\x31\x60\x9d\xf9\x83\x44\xf8\x5d\x61\x65\xca\xc0\x61\x69\x52\x66\x1b\xbb\xa9\x1e\x4e\x26\x00\x31\x51\x1c\x06\x69\x9a\x6e\x66\xd3\x59\x72\x14\x05\xbc\x45\x41\x1c\xac\x42\x41\x2b\x13\xf5\x27\x31\x4d\xa9\xca\xad\xf4\xf5\x19\xc8\xe9\x41\x6a\x59\xd7\x3b\x3c\xc5\x94\x89\xb4\xd1\x8e\xbc\x29\x5d\x97\xdf\xb0\x73\xf2\xc2\x49\xdb\x50\xf6\x11\x74\xd9\x53\xb8\xbf\xfe\x7c\x3d\x8d\x3a\xd2\x5b\x85\xd5\xd5\x38\xea\x09\x80\x14\x46\x47\x5c\x0c\x16\xe8\xe9\xc3\x49\x3a\x8d\x90\xd5\x39\x2f\x28\x97\x18\x2a\x4b\x0d\x45\xd6\xbb\x56\x1f\xcf\x36\xa2\xb8\x72\xb2\xca\x54\x05\xe9\xe0\x5b\x12\x83\x54\xf1\xbc\x53\x2b\x2f\x15\x3a\x87\x6d\x99\xbf\xa8\x71\x20\xff\x1d\x1d\x61\x74\x70\x46\x31\xab\x50\x13\x6f\x3f\x15\x39\x56\x7b\x73\x5b\xd9\x03\xb6\xd8\x0b\x2a\xdd\xa0\xe3\x72\x64\x95\x14\xe8\x39\xcc\x3b\x54\x4f\x8a\x44\x30\x8e\xf7\x0e\x59\x81\x41\xac\x2e\x52\x1b\xe0\x7b\x07\xf9\xed\x98\x01\x7c\x70\x18\x68\x59\x35\x55\xd1\xae\x40\x85\x55\x18\x68\xcf\x67\xa7\xc1\x76\xd7\xa0\xd9\x76\x57\xcc\xb8\x08\x6a\x2f\xf3\x39\x3d\x60\xa9\x42\xca\x0e\x4a\x1d\xcf\xda\x10\x5c\x5c\x6a\x34\xc4\xef\x0b\x72\x98\xe9\xd6\x42\x72\x3d\xb0\xce\x00\xdd\x72\xd4\x67\x51\xa0\xce\x87\x0c\x06\x5e\x11\xd9\x11\x7a\x36\x9f\xcd\x66\xd9\x80\x21\x0b\x5c\x52\xa7\x43\x7e\xba\xbe\xba\xbf\xbd\xbe\xb8\x38\xbf\x1d\x34\xd7\x94\x04\xb9\x21\x4d\xde\xdf\x38\xb3\xa0\xa1\x7b\x80\x55\x08\xf6\x0b\x85\x31\x16\x80\xc5\xb0\xe2\x70\xb4\x22\x54\x61\xf5\x6d\x5c\xc4\xb8\xc0\xe1\x74\x76\x3a\x1f\x61\xa7\xc6\x81\xea\x33\x29\xac\xee\x48\x18\x9d\xc7\x0a\x7d\x3f\x22\x69\xc9\x49\x93\x6f\x65\x8e\x67\x03\x99\xfa\x94\x8c\x6f\x75\x3c\x00\x98\xcb\x7f\x1c\x68\xb4\x52\xfd\x5b\x71\xbe\x21\xcc\xf9\x30\xcc\xb6\xed\x8e\x14\x51\xdc\xcd\x42\x86\x51\x0e\x80\xb0\x25\x87\xf7\xb3\x59\x31\xca\x2d\xa8\x30\xae\xe2\x30\x3f\x3e\xbd\x94\x23\x12\x8e\xfe\x2c\xc9\xbf\x68\x7b\xfe\x8a\xe9\x0f\x27\x23\x96\x3d\x89\xd2\xc9\x50\x7d\x32\x3a\xd0\xd7\xd1\xec\xa3\x52\xe6\xf1\xc6\xc9\x8d\x54\xb4\xa4\x73\x2f\x50\x61\x7d\xb9\x3c\xa0\xf2\x34\xa2\xd1\xbb\xc9\x47\x31\xe5\xce\xd8\x71\x0e\x83\xb3\x8b\x8b\xc9\x77\x82\x74\xa5\x3e\xf3\x57\x46\xdf\x1a\x13\x38\x04\x57\xee\xa3\x6a\xee\xd2\x33\x21\x4c\xa9\x43\x7d\xcd\x35\x8d\x6a\x4f\x32\x90\x2b\xa4\x4e\x01\x7e\x71\x28\xe8\xe6\x40\x45\xd8\x28\xe7\x7d\xb7\x33\x32\x70\xa5\xea\x46\xcc\xe2\x35\xfe\xc5\x99\xd2\xf6\xd2\xc0\xda\x7b\xb3\x01\x3f\x56\x51\x2c\x36\xb1\x07\xb9\x2c\xd0\xfa\x0e\x79\x43\x6e\xb1\x27\xb7\xa4\xd0\xfb\x56\xd2\xf7\x09\x8f\xf1\x3e\xe9\x9b\x4e\x93\x54\x8f\x54\xda\x7c\x9f\x64\x07\x7a\x39\x29\xea\x08\x1d\x0c\x4f\x18\xe3\xf2\x26\x89\xd3\xf5\x69\xbc\x16\x5e\x8f\x57\x11\x7a\xfa\xef\xc5\xfa\x96\xad\xa4\x4d\x9c\x78\x5e\x0e\x6d\x04\x67\x1f\xd4\x58\x09\xbf\x79\x26\xd9\x0d\x03\xbb\x11\x6c\x37\xa8\x5d\x9a\xbc\x86\xcc\xc0\x97\x36\x76\x52\xca\x3b\xc7\xa8\x9e\xec\xae\x1f\xf5\x55\x3b\xb3\xbe\x22\x7a\x27\xf5\x52\xd1\x41\xe9\x5d\xdb\xa8\xc5\x2f\x4b\x15\xe4\x5b\x6d\x9f\x29\xb5\x15\x8d\x29\x5d\x53\xf5\x68\x5c\xde\xc0\x1f\x1b\xf8\x94\xd4\xeb\x86\xfd\xd2\x54\x58\x3a\xc5\xd3\x25\xe4\xf9\xd1\xd1\x70\x70\xcf\x4d\x81\x52\x4f\xe2\x78\x26\xbb\xd3\x05\x03\x2a\x50\x2a\x0e\x95\x29\xdd\x0f\xe9\x3d\xfe\xd7\x26\x93\xb5\xbb\xcb\xad\x02\x44\xe4\xc9\x44\x48\xfd\x8c\x43\xfa\x73\x9c\x00\x58\x67\x36\x32\xfe\x97\x74\xf4\x6e\x1a\x5a\xab\xb5\x07\x31\xfa\xdb\xa1\xda\xb4\x3f\xd9\xf5\xff\xc5\xdf\x01\x00\x00\xff\xff\x82\x2e\xe1\x7d\x77\x0f\x00\x00") +var _manifestsRegistryClusterserviceversionYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x58\x4b\x6f\xdb\xb8\x13\xbf\xfb\x53\x0c\x74\xfe\x4b\xb1\xd3\xa4\x0d\x78\xfa\xa7\x6d\x10\x2c\x90\x17\x92\xec\x1e\xb6\x28\x16\x63\x6a\x62\x73\x4d\x91\x5c\x92\x72\xaa\x66\xf3\xdd\x17\x94\x64\x5b\xb2\x68\xc7\x45\xf7\xb2\xbc\x58\x22\xe7\xf1\x9b\x27\x47\x46\x23\x7e\x23\xeb\x84\x56\x0c\xb4\x21\x8b\x5e\x5b\x97\x71\x6d\x49\x87\x9f\xe2\x68\x39\x41\x69\xe6\x38\x19\x2d\x84\xca\x19\x7c\x92\xa5\xf3\x64\x1f\xc8\x2e\x05\xa7\x96\x75\x54\x90\xc7\x1c\x3d\xb2\x11\x00\x2a\xa5\x3d\x7a\xa1\x95\x0b\xaf\x00\x28\x8b\x94\xbe\x61\x61\x24\x39\x06\x7f\xa7\xf5\x26\xc0\x97\xf6\x17\xe0\x65\xfd\x04\x90\x6c\x00\x25\x0c\x12\xcd\x53\x6d\x72\x5a\xa6\x74\x4c\xd9\x0a\xdf\x93\xc5\x82\x9e\xb5\x5d\x64\x42\x67\x6f\x52\xac\x2d\x48\xfe\xd7\xd5\x13\xcc\x09\x1a\xee\x69\x26\x9c\xb7\x55\xff\x74\x65\x50\xc2\x7a\xe8\x00\x12\x89\x53\x92\x6e\xb0\x5f\x23\x37\xd9\xa2\x9c\x92\x55\xe4\xc9\x05\xcd\x05\x2a\x9c\x51\x9e\x4e\xab\xa0\x69\x51\x3a\xaf\x0b\xf1\x9d\x7a\xaa\x76\xb0\x2a\x2c\x28\x30\xbd\xbc\xc0\xe3\xc5\xc3\x63\xfa\xf1\xd7\x9b\xcf\x57\x17\xf0\xfa\x9a\xf4\x78\x5f\xfb\xa2\x92\x9d\x6c\xa9\xab\x03\xd0\xe5\xee\xf1\x26\xce\x10\x4f\x18\xa8\x52\xca\xf5\xf6\x6b\xfb\xf4\xb5\xfe\xe5\x68\x70\x2a\xa4\xf0\x22\xc4\xf1\x23\x3a\xc1\xe1\x17\xe5\x3c\xb6\x1c\xdc\x12\x7a\xca\xcf\x3d\x83\xe4\x78\x7c\x7c\x9a\x8e\xcf\xd2\xf1\xfb\xc7\xc9\x07\x76\xf2\x8e\x9d\x4c\x7e\x6f\x74\x6f\x92\x2c\x1a\xac\x69\x29\x64\x4e\x76\x93\x8c\xa9\xcb\x17\xe9\x72\x92\xbd\x3b\xc9\x26\x87\x08\x30\x56\xff\x49\xdc\xff\x21\xb1\xd2\xa5\x67\x30\xd3\xb5\x67\x5b\xb9\x75\x3e\x9c\x8c\x00\x82\xa3\x18\x0c\xdc\x94\x2d\xc7\xd9\xb8\x56\x14\x08\x9c\x41\x4e\x0c\x8c\x44\x4e\x73\x1d\xf8\x47\xc1\x4d\x75\x96\x1b\xe1\x9a\x1a\xc8\xe9\x49\x28\xd1\xe4\x3b\xbc\x04\x97\xf1\x3a\xd0\x96\x9c\x2e\x6d\xf7\xbc\x3d\xce\xc9\x71\x2b\x4c\xbb\xb3\x8d\xa0\x7b\x9c\xc1\xe3\xed\xe7\xdb\x2c\xf0\x08\x67\x24\x56\x37\x71\xd4\x23\x00\xc1\xb5\x0a\xb8\x52\x98\xa2\xa3\xf7\x27\x75\x35\x42\xd2\xf8\xbc\xa0\x5c\xa0\xaf\x0c\xb5\x3b\xa2\x89\x5a\x53\x9e\x2b\x8b\xc2\xca\xc9\x48\x5d\x15\xa4\xbc\x5b\x6d\xa5\x50\x67\x3c\xeb\xe4\xca\xbe\x44\x67\xb0\x4e\xf3\xbd\x1c\x3b\xfc\xdf\xe1\xe1\x5a\x79\xab\x65\x6a\x24\x2a\x62\xab\x57\x49\x36\x6d\xb4\xd9\x35\xed\x0e\x59\xe9\x1e\x96\xae\xd1\x61\x59\x32\x52\x70\x74\x0c\x26\x9d\x5d\x47\x92\xb8\xd7\x96\xf5\x8a\xac\x40\xcf\xe7\x57\x75\x1b\x60\x5b\x85\x7c\x38\x66\x00\xe7\x2d\x7a\x9a\x55\x6d\x56\xac\x96\xa7\xc2\x48\xf4\xb4\xa5\xb3\xd3\x60\xbb\x6b\xd0\x6c\xbb\x2b\x78\x9c\x7b\xb9\xe5\xf9\x9c\x9e\xb0\x94\xbe\xf6\x0e\x0a\x15\x6a\x6d\x08\x2e\x2c\x19\x35\xf1\xc7\x8c\x1c\x7a\x3a\xac\xa5\x96\x65\x41\x03\xd1\x69\x1b\xc9\x26\xff\x5d\x4c\xf1\x93\x98\x5d\xa3\x19\x62\x5a\x25\xc1\xdc\x7b\x93\xa7\x8d\x80\x08\x51\x6b\xfb\xb5\xce\x89\xc1\xf8\xc3\xe9\x69\x24\x7e\xb5\x4f\x22\xd8\xd0\xce\xa2\xce\x28\x0a\x0c\x17\xe3\x97\xe4\xa8\xc5\x7d\x54\x83\xc8\xdc\x3c\xf9\x3a\x20\x17\x05\xce\xa8\xd3\x9f\x3f\xdd\xde\x3c\xde\xdf\x5e\x5d\x5d\xdc\x0f\x5a\x7b\x58\x46\x5b\x1f\x51\x1a\xe0\xac\xa1\xde\x69\xeb\x19\x9c\x8d\xcf\x26\x03\xba\xc6\xcf\xd7\xba\x54\xbb\xa4\xec\x77\x78\x58\x45\xe0\xbe\x43\x3f\x67\x70\xb4\x8f\xce\x12\xe6\xb7\x4a\x56\x0c\xbc\x2d\x69\x40\x22\xc5\x92\x14\x39\x77\x67\xf5\x94\x62\x58\x82\xd3\x2e\xc9\xc7\x8e\x00\x4c\xa3\x7f\x4e\x28\xfd\xfc\x7b\x9c\x64\xb7\x1b\x42\xc3\x13\x5e\xa0\xfc\x4c\x12\xab\x07\xe2\x5a\xe5\xa1\xd2\xb7\xa3\x5f\x8b\x21\x2b\x74\xbe\xa6\x39\x1e\x0f\x68\x1a\x97\xc5\x4b\xa6\x71\x83\xf8\x69\x43\x83\x94\xea\xdf\xb2\xf3\x00\x33\x27\x43\x33\x57\xd7\x57\x34\x71\xa4\x28\x44\x3c\xa5\x00\xb8\x29\x19\x9c\x8e\xc7\x45\x3c\x9d\xa8\xd0\xb6\x62\x30\x39\x3e\xbb\x16\x11\x0a\x4b\x7f\x95\xe4\xf6\xca\x9e\xbc\x21\xfa\xfd\x49\x44\xb2\x23\x5e\x5a\xe1\xab\x4f\x5a\x79\xfa\x16\xf5\x3e\x4a\xa9\x9f\xef\xac\x58\x0a\x49\x33\xba\x70\x1c\x25\x36\x97\xf4\x13\x4a\x37\x4c\xe9\xad\x89\x28\x8a\x29\xb7\x3a\xda\xad\x42\xed\x9d\x5f\x5d\x0d\x61\x7a\xb4\xbe\x34\x3f\x95\x3c\xb5\x0c\xca\x7f\x3c\x7b\x9e\x50\xc8\xd2\xd2\xe3\xdc\x92\x0b\xe3\x0e\x83\x77\xc3\xbc\x78\x3b\x77\xde\x74\xb5\x2d\xd5\xb9\xbb\xd1\xea\x5e\x6b\x1f\x6d\x17\xed\x64\x75\xce\x79\x68\x3e\xcd\xd0\xd3\xb6\xee\x2d\x4a\x4f\xb6\x10\xaa\x0e\xd3\xa5\x45\x4e\x77\x3b\xb0\x99\x40\xe7\x5c\xf7\x9e\x4c\xc1\x96\xb2\x1b\xb7\x34\x0c\x75\x97\x56\x97\xa6\x17\xcc\x74\x35\x45\xb5\xe0\x63\x75\x91\xb6\x77\x53\x81\xa6\xdb\x1d\x97\x64\xa7\x5b\x74\x33\xf2\xbd\x77\x29\x5c\x7f\xe3\x39\x4c\x17\x7d\xd1\xf5\x5c\xdd\xdb\x2a\x4d\xbe\xbd\x65\x06\x7c\x39\x49\xea\x10\xed\x34\x8f\x6b\x6d\xf3\xd6\x89\xd9\xe2\x2c\x0c\x09\x6f\xdb\x2b\x09\x1d\xfd\xf7\x6c\x3d\x24\x94\xb4\x0c\xf3\xef\x7e\xd3\x22\x38\xfb\xa0\x62\x29\x7c\xf0\x84\xba\x19\x0d\x37\x03\xf9\x66\x6c\x0f\xd3\x8b\x6b\x66\x7d\x57\x9a\x50\xd1\x94\x77\xca\xa8\x99\xf3\x6f\x9f\xd5\xcd\xea\x0b\xe6\x0d\xd2\x07\xa1\x66\x92\x76\x52\x6f\x9a\x5f\x43\x7e\x5d\x4a\x2f\x0e\x95\x7d\x2e\xe5\x9a\x34\xb8\x74\x41\xd5\xb3\xb6\x79\x0b\x3f\x36\xfe\x4b\xa1\x16\xed\xf1\xbe\x6f\x84\xd2\xca\x66\xda\x73\xec\xe8\x68\xf8\x19\x97\xeb\x02\x85\x1a\x85\x61\x5d\x74\x47\xba\x14\xa8\x40\x21\x19\x54\xba\xb4\xff\xaf\x9f\x33\xae\x9b\xfb\xa4\x51\x77\xbd\x66\x80\x80\xbc\x16\xe1\xeb\x7e\xc6\xa0\xfe\x1f\x61\x04\x60\xac\x5e\x8a\xf0\x95\xda\xe1\xbb\x6b\xf7\x56\x5c\x5b\x10\x83\xbe\x0d\xaa\xe5\xea\x2f\x97\xe6\x6b\xf3\x9f\x00\x00\x00\xff\xff\x78\xa4\x24\x61\x85\x11\x00\x00") func manifestsRegistryClusterserviceversionYamlBytes() ([]byte, error) { return bindataRead( @@ -116,7 +117,27 @@ func manifestsRegistryClusterserviceversionYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "manifests/registry.clusterserviceversion.yaml", size: 3959, mode: os.FileMode(420), modTime: time.Unix(1760017176, 0)} + info := bindataFileInfo{name: "manifests/registry.clusterserviceversion.yaml", size: 4485, mode: os.FileMode(420), modTime: time.Unix(1764220580, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _manifestsScriptConfigmapYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\xce\xbf\x6e\x83\x30\x10\xc7\xf1\xdd\x4f\xf1\x2b\x9d\x8d\xa1\x13\xf2\xd0\xa5\x73\xd7\xee\x57\x7c\xc4\x56\x82\xb1\xec\x0b\x24\x52\x1e\x3e\x12\xe4\xcf\xc4\x78\xf7\xf9\x4a\x77\x94\xc2\x1f\xe7\x12\xa6\x68\x31\xb7\xea\x18\xa2\xb3\xf8\x99\xe2\x10\x0e\xbf\x94\xd4\xc8\x42\x8e\x84\xac\x02\x22\x8d\x6c\xe1\x45\x92\xd3\xa5\xcf\x21\x89\x7a\xd2\xba\xac\x8b\xb7\xb8\x29\x00\xf8\xfc\x30\xff\x21\x9a\xe2\xd7\x89\x7b\x3f\xa1\x7a\x9c\x41\x5b\x7f\xd5\x4d\xf5\x06\xc9\x67\xc6\x37\xcc\x4c\xd9\x2c\xcb\x62\x8a\x50\x16\x76\xfb\x41\x66\x72\xd7\x7d\x3e\x85\x99\x37\xbd\x70\xbf\x7d\x06\x3d\x40\xfb\x57\x02\x9d\xd0\x35\x5d\xab\xee\x01\x00\x00\xff\xff\xa2\x23\x09\xd5\xfd\x00\x00\x00") + +func manifestsScriptConfigmapYamlBytes() ([]byte, error) { + return bindataRead( + _manifestsScriptConfigmapYaml, + "manifests/script.configmap.yaml", + ) +} + +func manifestsScriptConfigmapYaml() (*asset, error) { + bytes, err := manifestsScriptConfigmapYamlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "manifests/script.configmap.yaml", size: 253, mode: os.FileMode(420), modTime: time.Unix(1764220580, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -136,7 +157,7 @@ func metadataAnnotationsYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "metadata/annotations.yaml", size: 732, mode: os.FileMode(420), modTime: time.Unix(1760017176, 0)} + info := bindataFileInfo{name: "metadata/annotations.yaml", size: 732, mode: os.FileMode(420), modTime: time.Unix(1759972370, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -156,7 +177,7 @@ func metadataPropertiesYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "metadata/properties.yaml", size: 73, mode: os.FileMode(420), modTime: time.Unix(1760017176, 0)} + info := bindataFileInfo{name: "metadata/properties.yaml", size: 73, mode: os.FileMode(420), modTime: time.Unix(1759972370, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -176,7 +197,7 @@ func testsScorecardConfigYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "tests/scorecard/config.yaml", size: 1614, mode: os.FileMode(420), modTime: time.Unix(1760017176, 0)} + info := bindataFileInfo{name: "tests/scorecard/config.yaml", size: 1614, mode: os.FileMode(420), modTime: time.Unix(1759972370, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -235,6 +256,7 @@ func AssetNames() []string { var _bindata = map[string]func() (*asset, error){ "Dockerfile": dockerfile, "manifests/registry.clusterserviceversion.yaml": manifestsRegistryClusterserviceversionYaml, + "manifests/script.configmap.yaml": manifestsScriptConfigmapYaml, "metadata/annotations.yaml": metadataAnnotationsYaml, "metadata/properties.yaml": metadataPropertiesYaml, "tests/scorecard/config.yaml": testsScorecardConfigYaml, @@ -286,6 +308,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "Dockerfile": &bintree{dockerfile, map[string]*bintree{}}, "manifests": &bintree{nil, map[string]*bintree{ "registry.clusterserviceversion.yaml": &bintree{manifestsRegistryClusterserviceversionYaml, map[string]*bintree{}}, + "script.configmap.yaml": &bintree{manifestsScriptConfigmapYaml, map[string]*bintree{}}, }}, "metadata": &bintree{nil, map[string]*bintree{ "annotations.yaml": &bintree{metadataAnnotationsYaml, map[string]*bintree{}}, diff --git a/openshift/tests-extension/pkg/bindata/qe/bindata.go b/openshift/tests-extension/pkg/bindata/qe/bindata.go index d975ed082..bccc3a73e 100644 --- a/openshift/tests-extension/pkg/bindata/qe/bindata.go +++ b/openshift/tests-extension/pkg/bindata/qe/bindata.go @@ -9,12 +9,13 @@ // test/qe/testdata/olm/clustercatalog-secret.yaml // test/qe/testdata/olm/clustercatalog-withlabel.yaml // test/qe/testdata/olm/clustercatalog.yaml -// test/qe/testdata/olm/clusterextension-withoutChannel-OwnSingle.yaml // test/qe/testdata/olm/clusterextension-withselectorExpressions-WithoutChannelVersion.yaml // test/qe/testdata/olm/clusterextension-withselectorLableExpressions-WithoutChannelVersion.yaml // test/qe/testdata/olm/clusterextension-withselectorlabel-OwnSingle.yaml // test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannel.yaml // test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannelVersion.yaml +// test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutVersion.yaml +// test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml // test/qe/testdata/olm/clusterextension-withselectorlabel.yaml // test/qe/testdata/olm/clusterextension.yaml // test/qe/testdata/olm/clusterextensionWithoutChannel.yaml @@ -492,56 +493,6 @@ func testQeTestdataOlmClustercatalogYaml() (*asset, error) { return a, nil } -var _testQeTestdataOlmClusterextensionWithoutchannelOwnsingleYaml = []byte(`apiVersion: template.openshift.io/v1 -kind: Template -metadata: - name: operator-template -objects: -- apiVersion: olm.operatorframework.io/v1 - kind: ClusterExtension - metadata: - name: "${NAME}" - annotations: - olm.operatorframework.io/watch-namespace: "${WATCHNS}" - spec: - namespace: "${INSTALLNAMESPACE}" - serviceAccount: - name: "${SANAME}" - source: - sourceType: "${SOURCETYPE}" - catalog: - packageName: "${PACKAGE}" - version: "${VERSION}" - upgradeConstraintPolicy: "${POLICY}" -parameters: -- name: NAME -- name: INSTALLNAMESPACE -- name: WATCHNS -- name: PACKAGE -- name: VERSION -- name: SANAME -- name: POLICY - value: "CatalogProvided" -- name: SOURCETYPE - value: "Catalog" - -`) - -func testQeTestdataOlmClusterextensionWithoutchannelOwnsingleYamlBytes() ([]byte, error) { - return _testQeTestdataOlmClusterextensionWithoutchannelOwnsingleYaml, nil -} - -func testQeTestdataOlmClusterextensionWithoutchannelOwnsingleYaml() (*asset, error) { - bytes, err := testQeTestdataOlmClusterextensionWithoutchannelOwnsingleYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "test/qe/testdata/olm/clusterextension-withoutChannel-OwnSingle.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - var _testQeTestdataOlmClusterextensionWithselectorexpressionsWithoutchannelversionYaml = []byte(`apiVersion: template.openshift.io/v1 kind: Template metadata: @@ -829,6 +780,122 @@ func testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelversionYaml return a, nil } +var _testQeTestdataOlmClusterextensionWithselectorlabelWithoutversionYaml = []byte(`apiVersion: template.openshift.io/v1 +kind: Template +metadata: + name: operator-template +objects: +- apiVersion: olm.operatorframework.io/v1 + kind: ClusterExtension + metadata: + name: "${NAME}" + spec: + namespace: "${INSTALLNAMESPACE}" + serviceAccount: + name: "${SANAME}" + source: + sourceType: "${SOURCETYPE}" + catalog: + packageName: "${PACKAGE}" + channels: + - "${CHANNEL}" + selector: + matchLabels: + "${LABELKEY}": "${LABELVALUE}" + upgradeConstraintPolicy: "${POLICY}" +parameters: +- name: NAME +- name: INSTALLNAMESPACE +- name: PACKAGE +- name: CHANNEL +- name: SANAME +- name: POLICY + value: "CatalogProvided" +- name: LABELVALUE + # suggest to use case id +- name: LABELKEY + value: "olmv1-test" +- name: SOURCETYPE + value: "Catalog" +`) + +func testQeTestdataOlmClusterextensionWithselectorlabelWithoutversionYamlBytes() ([]byte, error) { + return _testQeTestdataOlmClusterextensionWithselectorlabelWithoutversionYaml, nil +} + +func testQeTestdataOlmClusterextensionWithselectorlabelWithoutversionYaml() (*asset, error) { + bytes, err := testQeTestdataOlmClusterextensionWithselectorlabelWithoutversionYamlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutVersion.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelOwnsingleYaml = []byte(`apiVersion: template.openshift.io/v1 +kind: Template +metadata: + name: operator-template +objects: +- apiVersion: olm.operatorframework.io/v1 + kind: ClusterExtension + metadata: + name: "${NAME}" + spec: + namespace: "${INSTALLNAMESPACE}" + serviceAccount: + name: "${SANAME}" + config: + configType: Inline + inline: + watchNamespace: "${WATCHNS}" + source: + sourceType: "${SOURCETYPE}" + catalog: + packageName: "${PACKAGE}" + version: "${VERSION}" + selector: + matchLabels: + "${LABELKEY}": "${LABELVALUE}" + upgradeConstraintPolicy: "${POLICY}" +parameters: +- name: NAME +- name: INSTALLNAMESPACE +- name: WATCHNS +- name: PACKAGE +- name: VERSION +- name: SANAME +- name: POLICY + value: "CatalogProvided" +- name: SOURCETYPE + value: "Catalog" +- name: LABELVALUE + # suggest to use case id +- name: LABELKEY + value: "olmv1-test" + + + + +`) + +func testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelOwnsingleYamlBytes() ([]byte, error) { + return _testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelOwnsingleYaml, nil +} + +func testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelOwnsingleYaml() (*asset, error) { + bytes, err := testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelOwnsingleYamlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + var _testQeTestdataOlmClusterextensionWithselectorlabelYaml = []byte(`apiVersion: template.openshift.io/v1 kind: Template metadata: @@ -2250,12 +2317,13 @@ var _bindata = map[string]func() (*asset, error){ "test/qe/testdata/olm/clustercatalog-secret.yaml": testQeTestdataOlmClustercatalogSecretYaml, "test/qe/testdata/olm/clustercatalog-withlabel.yaml": testQeTestdataOlmClustercatalogWithlabelYaml, "test/qe/testdata/olm/clustercatalog.yaml": testQeTestdataOlmClustercatalogYaml, - "test/qe/testdata/olm/clusterextension-withoutChannel-OwnSingle.yaml": testQeTestdataOlmClusterextensionWithoutchannelOwnsingleYaml, "test/qe/testdata/olm/clusterextension-withselectorExpressions-WithoutChannelVersion.yaml": testQeTestdataOlmClusterextensionWithselectorexpressionsWithoutchannelversionYaml, "test/qe/testdata/olm/clusterextension-withselectorLableExpressions-WithoutChannelVersion.yaml": testQeTestdataOlmClusterextensionWithselectorlableexpressionsWithoutchannelversionYaml, "test/qe/testdata/olm/clusterextension-withselectorlabel-OwnSingle.yaml": testQeTestdataOlmClusterextensionWithselectorlabelOwnsingleYaml, "test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannel.yaml": testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelYaml, "test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutChannelVersion.yaml": testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelversionYaml, + "test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutVersion.yaml": testQeTestdataOlmClusterextensionWithselectorlabelWithoutversionYaml, + "test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml": testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelOwnsingleYaml, "test/qe/testdata/olm/clusterextension-withselectorlabel.yaml": testQeTestdataOlmClusterextensionWithselectorlabelYaml, "test/qe/testdata/olm/clusterextension.yaml": testQeTestdataOlmClusterextensionYaml, "test/qe/testdata/olm/clusterextensionWithoutChannel.yaml": testQeTestdataOlmClusterextensionwithoutchannelYaml, @@ -2320,21 +2388,22 @@ var _bintree = &bintree{nil, map[string]*bintree{ "qe": {nil, map[string]*bintree{ "testdata": {nil, map[string]*bintree{ "olm": {nil, map[string]*bintree{ - "basic-bd-plain-image.yaml": {testQeTestdataOlmBasicBdPlainImageYaml, map[string]*bintree{}}, - "basic-bd-registry-image.yaml": {testQeTestdataOlmBasicBdRegistryImageYaml, map[string]*bintree{}}, - "binding-prefligth.yaml": {testQeTestdataOlmBindingPrefligthYaml, map[string]*bintree{}}, - "binding-prefligth_multirole.yaml": {testQeTestdataOlmBindingPrefligth_multiroleYaml, map[string]*bintree{}}, - "cip.yaml": {testQeTestdataOlmCipYaml, map[string]*bintree{}}, - "clustercatalog-secret-withlabel.yaml": {testQeTestdataOlmClustercatalogSecretWithlabelYaml, map[string]*bintree{}}, - "clustercatalog-secret.yaml": {testQeTestdataOlmClustercatalogSecretYaml, map[string]*bintree{}}, - "clustercatalog-withlabel.yaml": {testQeTestdataOlmClustercatalogWithlabelYaml, map[string]*bintree{}}, - "clustercatalog.yaml": {testQeTestdataOlmClustercatalogYaml, map[string]*bintree{}}, - "clusterextension-withoutChannel-OwnSingle.yaml": {testQeTestdataOlmClusterextensionWithoutchannelOwnsingleYaml, map[string]*bintree{}}, + "basic-bd-plain-image.yaml": {testQeTestdataOlmBasicBdPlainImageYaml, map[string]*bintree{}}, + "basic-bd-registry-image.yaml": {testQeTestdataOlmBasicBdRegistryImageYaml, map[string]*bintree{}}, + "binding-prefligth.yaml": {testQeTestdataOlmBindingPrefligthYaml, map[string]*bintree{}}, + "binding-prefligth_multirole.yaml": {testQeTestdataOlmBindingPrefligth_multiroleYaml, map[string]*bintree{}}, + "cip.yaml": {testQeTestdataOlmCipYaml, map[string]*bintree{}}, + "clustercatalog-secret-withlabel.yaml": {testQeTestdataOlmClustercatalogSecretWithlabelYaml, map[string]*bintree{}}, + "clustercatalog-secret.yaml": {testQeTestdataOlmClustercatalogSecretYaml, map[string]*bintree{}}, + "clustercatalog-withlabel.yaml": {testQeTestdataOlmClustercatalogWithlabelYaml, map[string]*bintree{}}, + "clustercatalog.yaml": {testQeTestdataOlmClustercatalogYaml, map[string]*bintree{}}, "clusterextension-withselectorExpressions-WithoutChannelVersion.yaml": {testQeTestdataOlmClusterextensionWithselectorexpressionsWithoutchannelversionYaml, map[string]*bintree{}}, "clusterextension-withselectorLableExpressions-WithoutChannelVersion.yaml": {testQeTestdataOlmClusterextensionWithselectorlableexpressionsWithoutchannelversionYaml, map[string]*bintree{}}, "clusterextension-withselectorlabel-OwnSingle.yaml": {testQeTestdataOlmClusterextensionWithselectorlabelOwnsingleYaml, map[string]*bintree{}}, "clusterextension-withselectorlabel-WithoutChannel.yaml": {testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelYaml, map[string]*bintree{}}, "clusterextension-withselectorlabel-WithoutChannelVersion.yaml": {testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelversionYaml, map[string]*bintree{}}, + "clusterextension-withselectorlabel-WithoutVersion.yaml": {testQeTestdataOlmClusterextensionWithselectorlabelWithoutversionYaml, map[string]*bintree{}}, + "clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml": {testQeTestdataOlmClusterextensionWithselectorlabelWithoutchannelOwnsingleYaml, map[string]*bintree{}}, "clusterextension-withselectorlabel.yaml": {testQeTestdataOlmClusterextensionWithselectorlabelYaml, map[string]*bintree{}}, "clusterextension.yaml": {testQeTestdataOlmClusterextensionYaml, map[string]*bintree{}}, "clusterextensionWithoutChannel.yaml": {testQeTestdataOlmClusterextensionwithoutchannelYaml, map[string]*bintree{}}, diff --git a/openshift/tests-extension/test/qe/specs/olmv1.go b/openshift/tests-extension/test/qe/specs/olmv1.go index a53f1cb97..2239c5fe3 100644 --- a/openshift/tests-extension/test/qe/specs/olmv1.go +++ b/openshift/tests-extension/test/qe/specs/olmv1.go @@ -1,10 +1,15 @@ package specs import ( + "context" + "fmt" "strings" + "time" g "github.com/onsi/ginkgo/v2" o "github.com/onsi/gomega" + "github.com/tidwall/gjson" + "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" exutil "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util" @@ -40,4 +45,111 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] cluster-olm-operator", g.Label("NonHyp } }) + g.It("PolarionID:78393-[OTP][Skipped:Disconnected]support metrics", func() { + exutil.SkipOnProxyCluster(oc) + + var metricsMsg string + g.By("get catalogd metrics") + promeEp, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("service", "-n", "openshift-catalogd", "catalogd-service", "-o=jsonpath={.spec.clusterIP}").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(promeEp).NotTo(o.BeEmpty()) + if strings.Count(promeEp, ":") >= 2 { + g.Skip("Skip for IPv6.") + } + queryContent := "https://" + promeEp + ":7443/metrics" + + g.By("Get token") + metricsToken, err := exutil.GetSAToken(oc) + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(metricsToken).NotTo(o.BeEmpty()) + + wrongToken, err := oc.AsAdmin().WithoutNamespace().Run("create").Args("token", "openshift-state-metrics", "-n", "openshift-monitoring").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(wrongToken).NotTo(o.BeEmpty()) + + g.By("Get metrics") + podnameStr, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", "openshift-monitoring", "-l", "prometheus==k8s", "-o=jsonpath='{..metadata.name}'").Output() + o.Expect(podnameStr).NotTo(o.BeEmpty()) + prometheusPodname := strings.Split(strings.Trim(podnameStr, "'"), " ")[0] + + errWait := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + metricsMsg, err := oc.AsAdmin().NotShowInfo().WithoutNamespace().Run("exec").Args("-n", "openshift-monitoring", prometheusPodname, "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", metricsToken), queryContent).Output() + e2e.Logf("err:%v", err) + if strings.Contains(metricsMsg, "catalogd_http_request_duration_seconds_bucket{code=\"200\"") { + e2e.Logf("found catalogd_http_request_duration_seconds_bucket{code=\"200\"") + return true, nil + } + return false, nil + }) + if errWait != nil { + e2e.Logf("metricsMsg:%v", metricsMsg) + exutil.AssertWaitPollNoErr(errWait, "catalogd_http_request_duration_seconds_bucket{code=\"200\" not found.") + } + + g.By("ClusterRole/openshift-state-metrics has no rule to get the catalogd metrics") + metricsMsg, _ = oc.AsAdmin().NotShowInfo().WithoutNamespace().Run("exec").Args("-n", "openshift-monitoring", prometheusPodname, "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", wrongToken), queryContent).Output() + o.Expect(metricsMsg).To(o.ContainSubstring("Authorization denied")) + + g.By("get operator-controller metrics") + promeEp, err = oc.WithoutNamespace().AsAdmin().Run("get").Args("service", "-n", "openshift-operator-controller", "operator-controller-service", "-o=jsonpath={.spec.clusterIP}").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(promeEp).NotTo(o.BeEmpty()) + queryContent = "https://" + promeEp + ":8443/metrics" + + errWait = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + metricsMsg, err := oc.AsAdmin().NotShowInfo().WithoutNamespace().Run("exec").Args("-n", "openshift-monitoring", prometheusPodname, "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", metricsToken), queryContent).Output() + e2e.Logf("err:%v", err) + if strings.Contains(metricsMsg, "controller_runtime_active_workers") { + e2e.Logf("found controller_runtime_active_workers") + return true, nil + } + return false, nil + }) + if errWait != nil { + e2e.Logf("metricsMsg:%v", metricsMsg) + exutil.AssertWaitPollNoErr(errWait, "controller_runtime_active_workers not found.") + } + + g.By("ClusterRole/openshift-state-metrics has no rule to get the operator-controller metrics") + metricsMsg, _ = oc.AsAdmin().NotShowInfo().WithoutNamespace().Run("exec").Args("-n", "openshift-monitoring", prometheusPodname, "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", wrongToken), queryContent).Output() + o.Expect(metricsMsg).To(o.ContainSubstring("Authorization denied")) + + }) + + g.It("PolarionID:79770-[OTP][Level0]metrics are collected by default", func() { + podnameStr, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", "openshift-monitoring", "-l", "prometheus==k8s", "-o=jsonpath='{..metadata.name}'").Output() + o.Expect(podnameStr).NotTo(o.BeEmpty()) + k8sPodname := strings.Split(strings.Trim(podnameStr, "'"), " ")[0] + + g.By("1) check status of Metrics targets is up") + targetsUrl := "http://localhost:9090/api/v1/targets" + targetsContent, _ := oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-monitoring", k8sPodname, "--", "curl", "-s", targetsUrl).Output() + status := gjson.Get(targetsContent, `data.activeTargets.#(labels.namespace=="openshift-catalogd").health`).String() + if strings.Compare(status, "up") != 0 { + statusAll := gjson.Get(targetsContent, `data.activeTargets.#(labels.namespace=="openshift-catalogd")`).String() + e2e.Logf("catalogd target status: %s", statusAll) + o.Expect(status).To(o.Equal("up")) + } + status = gjson.Get(targetsContent, `data.activeTargets.#(labels.namespace=="openshift-operator-controller").health`).String() + if strings.Compare(status, "up") != 0 { + statusAll := gjson.Get(targetsContent, `data.activeTargets.#(labels.namespace=="openshift-operator-controller")`).String() + e2e.Logf("operator-controller target status: %s", statusAll) + o.Expect(status).To(o.Equal("up")) + } + + g.By("2) check metrics are collected") + queryUrl := "http://localhost:9090/api/v1/query" + query1 := `query=catalogd_http_request_duration_seconds_count{code="200"}` + queryResult1, _ := oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-monitoring", k8sPodname, "--", "curl", "-G", "--data-urlencode", query1, queryUrl).Output() + e2e.Logf("query result 1: %s", queryResult1) + o.Expect(queryResult1).To(o.ContainSubstring("value")) + + query2 := `query=controller_runtime_reconcile_total{controller="controller-operator-cluster-extension-controller",result="success"}` + queryResult2, _ := oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-monitoring", k8sPodname, "--", "curl", "-G", "--data-urlencode", query2, queryUrl).Output() + e2e.Logf("query result 2: %s", queryResult2) + o.Expect(queryResult2).To(o.ContainSubstring("value")) + + g.By("3) test SUCCESS") + }) + }) diff --git a/openshift/tests-extension/test/qe/specs/olmv1_ce.go b/openshift/tests-extension/test/qe/specs/olmv1_ce.go index 9949f3cfd..6491c6576 100644 --- a/openshift/tests-extension/test/qe/specs/olmv1_ce.go +++ b/openshift/tests-extension/test/qe/specs/olmv1_ce.go @@ -1,6 +1,7 @@ package specs import ( + "context" "fmt" "os" "os/exec" @@ -10,6 +11,7 @@ import ( g "github.com/onsi/ginkgo/v2" o "github.com/onsi/gomega" + "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" exutil "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util" @@ -1493,4 +1495,1434 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh ceArgocd.WaitProgressingMessage(oc, "Desired state reached") }) + g.It("PolarionID:69196-[OTP][Level0][Skipped:Disconnected]Supports Version Ranges during clusterextension upgrade", func() { + var ( + caseID = "69196" + labelValue = caseID + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns = "ns-69196" + sa = "sa69196" + saCrb = olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: ns, + Template: saClusterRoleBindingTemplate, + } + clustercatalog = olmv1util.ClusterCatalogDescription{ + Name: "clustercatalog-69196", + LabelValue: labelValue, + Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm69196", + Template: clustercatalogTemplate, + } + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-69196", + InstallNamespace: ns, + PackageName: "nginx69196", + Channel: "candidate-v1.0", + Version: "1.0.1", + SaName: sa, + LabelValue: labelValue, + Template: clusterextensionTemplate, + } + ) + + g.By("Create namespace") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) + + g.By("Create SA for clusterextension") + defer saCrb.Delete(oc) + saCrb.Create(oc) + + g.By("Create clustercatalog") + defer clustercatalog.Delete(oc) + clustercatalog.Create(oc) + + g.By("Create clusterextension with channel candidate-v1.0, version 1.0.1") + defer clusterextension.Delete(oc) + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) + + g.By("update version to be 1.0.3") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version": "1.0.3"}}}}`) + errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + conditions, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.conditions}") + if !strings.Contains(conditions, "error upgrading") { + e2e.Logf("error message is not raised") + return false, nil + } + return true, nil + }) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o=jsonpath-as-json={.status}") + exutil.AssertWaitPollNoErr(errWait, "error message is not raised") + } + + g.By("update version to be >=1.0.1") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version": ">=1.0.1"}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + resolvedBundle, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.install.bundle.name}") + if !strings.Contains(resolvedBundle, "v1.0.2") { + e2e.Logf("clusterextension.resolvedBundle is %s, not v1.0.2, and try next", resolvedBundle) + return false, nil + } + return true, nil + }) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o=jsonpath-as-json={.status}") + exutil.AssertWaitPollNoErr(errWait, "clusterextension resolvedBundle is not v1.0.2") + } + conditions, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.conditions}") + o.Expect(strings.ToLower(conditions)).To(o.ContainSubstring("desired state reached")) + o.Expect(conditions).NotTo(o.ContainSubstring("error")) + + g.By("update channel to be candidate-v1.1") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels": ["candidate-v1.1"]}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + resolvedBundle, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.install.bundle.name}") + if !strings.Contains(resolvedBundle, "v1.1.0") { + e2e.Logf("clusterextension.resolvedBundle is %s, not v1.1.0, and try next", resolvedBundle) + return false, nil + } + return true, nil + }) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o=jsonpath-as-json={.status}") + exutil.AssertWaitPollNoErr(errWait, "clusterextension resolvedBundle is not v1.1.0") + } + }) + + g.It("PolarionID:68821-[OTP][Skipped:Disconnected]Supports Version Ranges during Installation", func() { + var ( + caseID = "68821" + labelValue = caseID + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") + clusterextensionWithoutChannelTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml") + clusterextensionWithoutChannelVersionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannelVersion.yaml") + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns = "ns-68821" + sa = "sa68821" + saCrb = olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: ns, + Template: saClusterRoleBindingTemplate, + } + clustercatalog = olmv1util.ClusterCatalogDescription{ + Name: "clustercatalog-68821", + LabelValue: labelValue, + Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm68821", + Template: clustercatalogTemplate, + } + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-68821", + PackageName: "nginx68821", + Channel: "candidate-v0.0", + Version: ">=0.0.1", + LabelValue: labelValue, + InstallNamespace: ns, + SaName: sa, + Template: clusterextensionTemplate, + } + ) + + g.By("Create namespace") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) + + g.By("Create SA for clusterextension") + defer saCrb.Delete(oc) + saCrb.Create(oc) + + g.By("Create clustercatalog") + defer clustercatalog.Delete(oc) + clustercatalog.Create(oc) + + g.By("Create clusterextension with channel candidate-v0.0, version >=0.0.1") + defer clusterextension.Delete(oc) + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v0.0.3")) + clusterextension.Delete(oc) + + g.By("Create clusterextension with channel candidate-v1.0, version 1.0.x") + clusterextension.Channel = "candidate-v1.0" + clusterextension.Version = "1.0.x" + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.2")) + clusterextension.Delete(oc) + + g.By("Create clusterextension with channel empty, version >=0.0.1 !=1.1.0 <1.1.2") + clusterextension.Channel = "" + clusterextension.Version = ">=0.0.1 !=1.1.0 <1.1.2" + clusterextension.Template = clusterextensionWithoutChannelTemplate + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.2")) + clusterextension.Delete(oc) + + g.By("Create clusterextension with channel empty, version empty") + clusterextension.Channel = "" + clusterextension.Version = "" + clusterextension.Template = clusterextensionWithoutChannelVersionTemplate + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.1.0")) + clusterextension.Delete(oc) + + g.By("Create clusterextension with invalid version") + clusterextension.Version = "!1.0.1" + clusterextension.Template = clusterextensionTemplate + err = clusterextension.CreateWithoutCheck(oc) + o.Expect(err).To(o.HaveOccurred()) + + }) + + g.It("PolarionID:74108-[OTP][Skipped:Disconnected][Slow]olm v1 supports legacy upgrade edges", func() { + var ( + caseID = "74108" + labelValue = caseID + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutVersion.yaml") + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns = "ns-74108" + sa = "sa74108" + saCrb = olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: ns, + Template: saClusterRoleBindingTemplate, + } + clustercatalog = olmv1util.ClusterCatalogDescription{ + Name: "clustercatalog-74108", + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm74108", + LabelValue: labelValue, + Template: clustercatalogTemplate, + } + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-74108", + InstallNamespace: ns, + PackageName: "nginx74108", + Channel: "candidate-v0.0", + LabelValue: labelValue, + SaName: sa, + Template: clusterextensionTemplate, + } + ) + + g.By("Create namespace") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) + + g.By("Create SA for clusterextension") + defer saCrb.Delete(oc) + saCrb.Create(oc) + + g.By("1) Create clustercatalog") + defer clustercatalog.Delete(oc) + clustercatalog.Create(oc) + + g.By("2) Install clusterextension with channel candidate-v0.0") + defer clusterextension.Delete(oc) + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("0.0.2")) + + g.By("3) Attempt to update to channel candidate-v2.1 with CatalogProvided policy, that should fail") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels": ["candidate-v2.1"]}}}}`) + errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")]}`) + if strings.Contains(message, "error upgrading") { + e2e.Logf("status is %s", message) + return true, nil + } + return false, nil + }) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o=jsonpath-as-json={.status}") + } + exutil.AssertWaitPollNoErr(errWait, "no error message raised") + + g.By("4) Attempt to update to channel candidate-v0.1 with CatalogProvided policy, that should success") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels": ["candidate-v0.1"]}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "0.1.0") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx74108 0.1.0 is not installed") + + g.By("5) Attempt to update to channel candidate-v1.0 with CatalogProvided policy, that should fail") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels": ["candidate-v1.0"]}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")]}`) + if strings.Contains(message, "error upgrading") { + e2e.Logf("status is %s", message) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "no error message raised") + + g.By("6) update policy to SelfCertified, upgrade should success") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"upgradeConstraintPolicy": "SelfCertified"}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "1.0.2") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx74108 1.0.2 is not installed") + + g.By("7) Attempt to update to channel candidate-v1.1 with CatalogProvided policy, that should success") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"upgradeConstraintPolicy": "CatalogProvided"}}}}`) + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels": ["candidate-v1.1"]}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "1.1.0") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx74108 0.1.0 is not installed") + + g.By("8) Attempt to update to channel candidate-v1.2 with CatalogProvided policy, that should fail") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels": ["candidate-v1.2"]}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")]}`) + if strings.Contains(message, "error upgrading") { + e2e.Logf("status is %s", message) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "no error message raised") + + g.By("9) update policy to SelfCertified, upgrade should success") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"upgradeConstraintPolicy": "SelfCertified"}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "1.2.0") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx74108 1.2.0 is not installed") + + g.By("10) Attempt to update to channel candidate-v2.0 with CatalogProvided policy, that should fail") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"upgradeConstraintPolicy": "CatalogProvided"}}}}`) + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels": ["candidate-v2.0"]}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")]}`) + if strings.Contains(message, "error upgrading") { + e2e.Logf("status is %s", message) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "no error message raised") + + g.By("11) Attempt to update to channel candidate-v2.1 with CatalogProvided policy, that should success") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels": ["candidate-v2.1"]}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "2.1.1") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx74108 2.1.1 is not installed") + + g.By("8) downgrade to version 1.0.1 with SelfCertified policy, that should work") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"upgradeConstraintPolicy": "SelfCertified"}}}}`) + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels": ["candidate-v1.0"],"version":"1.0.1"}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "1.0.1") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o=jsonpath-as-json={.status}") + } + exutil.AssertWaitPollNoErr(errWait, "nginx74108 1.0.1 is not installed") + + }) + + g.It("PolarionID:74923-[OTP][Skipped:Disconnected]no two ClusterExtensions can manage the same underlying object", func() { + var ( + caseID = "74923" + labelValue = caseID + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannelVersion.yaml") + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns1 = "ns-74923-1" + ns2 = "ns-74923-2" + sa1 = "sa74923-1" + sa2 = "sa74923-2" + saCrb1 = olmv1util.SaCLusterRolebindingDescription{ + Name: sa1, + Namespace: ns1, + Template: saClusterRoleBindingTemplate, + } + saCrb2 = olmv1util.SaCLusterRolebindingDescription{ + Name: sa2, + Namespace: ns2, + Template: saClusterRoleBindingTemplate, + } + clustercatalog = olmv1util.ClusterCatalogDescription{ + Name: "clustercatalog-74923-1", + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm74923", + LabelValue: labelValue, + Template: clustercatalogTemplate, + } + clusterextension1 = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-74923-1", + PackageName: "nginx74923", + InstallNamespace: ns1, + SaName: sa1, + LabelValue: labelValue, + Template: clusterextensionTemplate, + } + clusterextension2 = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-74923-2", + PackageName: "nginx74923", + InstallNamespace: ns2, + SaName: sa2, + LabelValue: labelValue, + Template: clusterextensionTemplate, + } + ) + + g.By("1. Create clustercatalog") + defer clustercatalog.Delete(oc) + clustercatalog.Create(oc) + + g.By("2. Create clusterextension1") + g.By("2.1 Create namespace 1") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns1, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns1).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns1)).To(o.BeTrue()) + + g.By("2.2 Create SA for clusterextension1") + defer saCrb1.Delete(oc) + saCrb1.Create(oc) + + g.By("2.3 Create clusterextension1") + defer clusterextension1.Delete(oc) + clusterextension1.Create(oc) + o.Expect(clusterextension1.InstalledBundle).To(o.ContainSubstring("v1.0.2")) + + g.By("3 Create clusterextension2") + g.By("3.1 Create namespace 2") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns2, "--ignore-not-found").Execute() + }() + err = oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns2).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns2)).To(o.BeTrue()) + + g.By("3.2 Create SA for clusterextension2") + defer saCrb2.Delete(oc) + saCrb2.Create(oc) + + g.By("3.3 Create clusterextension2") + defer clusterextension2.Delete(oc) + _ = clusterextension2.CreateWithoutCheck(oc) + errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension2.Name, "-o", "jsonpath={.status.conditions[*].message}") + if !strings.Contains(message, "already exists in namespace") { + e2e.Logf("status is %s", message) + return false, nil + } + return true, nil + }) + exutil.AssertWaitPollNoErr(errWait, "clusterextension2 should not be installed") + clusterextension2.Delete(oc) + clusterextension1.Delete(oc) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + status, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("crd", "nginxolm74923s.cache.example.com").Output() + if !strings.Contains(status, "NotFound") { + e2e.Logf("crd status: %s", status) + return false, nil + } + return true, nil + }) + exutil.AssertWaitPollNoErr(errWait, "crd nginxolm74923s.cache.example.com is not deleted") + + g.By("4 Create crd") + crdFilePath := filepath.Join(baseDir, "crd-nginxolm74923.yaml") + defer func() { + _, _ = oc.AsAdmin().WithoutNamespace().Run("delete").Args("crd", "nginxolm74923s.cache.example.com").Output() + }() + _, _ = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", crdFilePath).Output() + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + status, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("crd", "nginxolm74923s.cache.example.com").Output() + if strings.Contains(status, "NotFound") { + e2e.Logf("crd status: %s", status) + return false, nil + } + return true, nil + }) + exutil.AssertWaitPollNoErr(errWait, "crd nginxolm74923s.cache.example.com is not deleted") + + _ = clusterextension1.CreateWithoutCheck(oc) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension1.Name, "-o", "jsonpath={.status.conditions[*].message}") + if !strings.Contains(message, "already exists in namespace") { + e2e.Logf("status is %s", message) + return false, nil + } + return true, nil + }) + exutil.AssertWaitPollNoErr(errWait, "clusterextension1 should not be installed") + + }) + + g.It("PolarionID:75501-[OTP][Skipped:Disconnected]the updates of various status fields is orthogonal", func() { + var ( + caseID = "75501" + labelValue = caseID + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns = "ns-75501" + sa = "sa75501" + saCrb = olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: ns, + Template: saClusterRoleBindingTemplate, + } + clustercatalog = olmv1util.ClusterCatalogDescription{ + Name: "clustercatalog-75501", + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75501", + LabelValue: labelValue, + Template: clustercatalogTemplate, + } + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-75501", + InstallNamespace: ns, + PackageName: "nginx75501", + Channel: "candidate-v2.1", + Version: "2.1.0", + SaName: sa, + LabelValue: labelValue, + Template: clusterextensionTemplate, + } + ) + + g.By("Create namespace") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) + + g.By("Create SA for clusterextension") + defer saCrb.Delete(oc) + saCrb.Create(oc) + + g.By("Create clustercatalog") + defer clustercatalog.Delete(oc) + clustercatalog.Create(oc) + + g.By("Create clusterextension with channel candidate-v2.1, version 2.1.0") + defer clusterextension.Delete(oc) + clusterextension.Create(oc) + _, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o=jsonpath-as-json={.status}") + reason, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")].reason}`) + o.Expect(reason).To(o.ContainSubstring("Succeeded")) + status, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Installed")].status}`) + o.Expect(status).To(o.ContainSubstring("True")) + reason, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Installed")].reason}`) + o.Expect(reason).To(o.ContainSubstring("Succeeded")) + installedBundleVersion, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.install.bundle.version}`) + o.Expect(installedBundleVersion).To(o.ContainSubstring("2.1.0")) + installedBundleName, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.install.bundle.name}`) + o.Expect(installedBundleName).To(o.ContainSubstring("nginx75501.v2.1.0")) + resolvedBundleVersion, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.install.bundle.version}`) + o.Expect(resolvedBundleVersion).To(o.ContainSubstring("2.1.0")) + resolvedBundleName, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.install.bundle.name}`) + o.Expect(resolvedBundleName).To(o.ContainSubstring("nginx75501.v2.1.0")) + + clusterextension.Delete(oc) + + g.By("Test UnpackFailed, bundle image cannot be pulled successfully") + clusterextension.Channel = "candidate-v2.0" + clusterextension.Version = "2.0.0" + _ = clusterextension.CreateWithoutCheck(oc) + errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + unpackedReason, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")].reason}`) + unpackedMessage, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")].message}`) + if !strings.Contains(unpackedReason, "Retrying") || !strings.Contains(unpackedMessage, "manifest unknown") { + return false, nil + } + return true, nil + }) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o=jsonpath-as-json={.status}") + exutil.AssertWaitPollNoErr(errWait, "clusterextension status is not correct") + } + clusterextension.Delete(oc) + + g.By("Test ResolutionFailed, wrong version") + clusterextension.Version = "3.0.0" + _ = clusterextension.CreateWithoutCheck(oc) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + resolvedReason, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")].reason}`) + resolvedMessage, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")].message}`) + if !strings.Contains(resolvedReason, "Retrying") || !strings.Contains(resolvedMessage, "no bundles found for package") { + return false, nil + } + return true, nil + }) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o=jsonpath-as-json={.status}") + exutil.AssertWaitPollNoErr(errWait, "clusterextension status is not correct") + } + clusterextension.Delete(oc) + + g.By("Test ResolutionFailed, no package") + clusterextension.PackageName = "nginxfake" + _ = clusterextension.CreateWithoutCheck(oc) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + resolvedReason, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")].reason}`) + resolvedMessage, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")].message}`) + if !strings.Contains(resolvedReason, "Retrying") || !strings.Contains(resolvedMessage, "no bundles found for package") { + return false, nil + } + return true, nil + }) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o=jsonpath-as-json={.status}") + exutil.AssertWaitPollNoErr(errWait, "clusterextension status is not correct") + } + + }) + + g.It("PolarionID:76685-[OTP][Skipped:Disconnected]olm v1 supports selecting catalogs [Serial]", func() { + var ( + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextensionWithoutChannelVersion.yaml") + clusterextensionLabelTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannelVersion.yaml") + clusterextensionExpressionsTemplate = filepath.Join(baseDir, "clusterextension-withselectorExpressions-WithoutChannelVersion.yaml") + clusterextensionLableExpressionsTemplate = filepath.Join(baseDir, "clusterextension-withselectorLableExpressions-WithoutChannelVersion.yaml") + + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns = "ns-76685" + sa = "sa76685" + saCrb = olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: ns, + Template: saClusterRoleBindingTemplate, + } + clustercatalog1 = olmv1util.ClusterCatalogDescription{ + LabelKey: "olmv1-test", + LabelValue: "ocp-76685-1", + Name: "clustercatalog-76685-1", + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginx76685v1", + Template: clustercatalogTemplate, + } + clustercatalog2 = olmv1util.ClusterCatalogDescription{ + LabelKey: "olmv1-test", + LabelValue: "ocp-76685-2", + Name: "clustercatalog-76685-2", + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginx76685v2", + Template: clustercatalogTemplate, + } + clustercatalog3 = olmv1util.ClusterCatalogDescription{ + LabelKey: "olmv1-test", + LabelValue: "ocp-76685-3", + Name: "clustercatalog-76685-3", + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginx76685v3", + Template: clustercatalogTemplate, + } + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-76685", + InstallNamespace: ns, + PackageName: "nginx76685", + SaName: sa, + Template: clusterextensionTemplate, + } + ) + + g.By("1) Create namespace, sa, clustercatalog1 and clustercatalog2") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) + + defer saCrb.Delete(oc) + saCrb.Create(oc) + + defer clustercatalog1.Delete(oc) + clustercatalog1.Create(oc) + defer clustercatalog2.Delete(oc) + clustercatalog2.Create(oc) + + g.By("2) 2 clustercatalogs with same priority, install clusterextension, selector of clusterextension is empty") + defer clusterextension.Delete(oc) + _ = clusterextension.CreateWithoutCheck(oc) + errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", `jsonpath={.status.conditions[?(@.type=="Progressing")]}`) + if strings.Contains(message, "multiple catalogs with the same priority") { + e2e.Logf("status is %s", message) + return true, nil + } + return false, nil + }) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o=jsonpath-as-json={.status}") + } + exutil.AssertWaitPollNoErr(errWait, "no error message raised") + clusterextension.Delete(oc) + + g.By("3) 2 clustercatalogs with same priority, install clusterextension, selector of clusterextension is not empty") + clusterextension.Template = clusterextensionLabelTemplate + clusterextension.LabelKey = "olm.operatorframework.io/metadata.name" + clusterextension.LabelValue = clustercatalog1.Name + clusterextension.Create(oc) + clusterextension.WaitClusterExtensionVersion(oc, "v1.0.1") + clusterextension.Delete(oc) + + g.By("4) Install 2 clustercatalogs with different priorities, and the selector of clusterextension is empty") + clustercatalog1.Patch(oc, `{"spec":{"priority": 100}}`) + clustercatalog2.Patch(oc, `{"spec":{"priority": 1000}}`) + clusterextension.Template = clusterextensionTemplate + clusterextension.Create(oc) + clusterextension.WaitClusterExtensionVersion(oc, "v2.0.0") + clusterextension.Delete(oc) + + g.By("5) Install 2 clustercatalogs with different priorities, and the selector of clusterextension is not empty") + clusterextension.Template = clusterextensionLabelTemplate + clusterextension.LabelKey = "olm.operatorframework.io/metadata.name" + clusterextension.LabelValue = clustercatalog1.Name + clusterextension.Create(oc) + clusterextension.WaitClusterExtensionVersion(oc, "v1.0.1") + + g.By("6) add ClusterCatalog 3, and modify the selector of clusterextension to use ClusterCatalog 3") + defer clustercatalog3.Delete(oc) + clustercatalog3.Create(oc) + clusterextension.LabelKey = clustercatalog3.LabelKey + clusterextension.LabelValue = clustercatalog3.LabelValue + clusterextension.Create(oc) + clusterextension.WaitClusterExtensionVersion(oc, "v3.0.0") + clusterextension.Delete(oc) + + g.By("7) matchExpressions") + clusterextension.Template = clusterextensionExpressionsTemplate + clusterextension.ExpressionsKey = clustercatalog3.LabelKey + clusterextension.ExpressionsOperator = "NotIn" + clusterextension.ExpressionsValue1 = clustercatalog3.LabelValue + clusterextension.Create(oc) + clusterextension.WaitClusterExtensionVersion(oc, "v2.0.0") + + g.By("8) test both matchLabels and matchExpressions") + clusterextension.Template = clusterextensionLableExpressionsTemplate + clusterextension.LabelKey = "olm.operatorframework.io/metadata.name" + clusterextension.LabelValue = clustercatalog3.Name + clusterextension.ExpressionsKey = clustercatalog3.LabelKey + clusterextension.ExpressionsOperator = "In" + clusterextension.ExpressionsValue1 = clustercatalog1.LabelValue + clusterextension.ExpressionsValue2 = clustercatalog2.LabelValue + clusterextension.ExpressionsValue3 = clustercatalog3.LabelValue + clusterextension.Create(oc) + clusterextension.WaitClusterExtensionVersion(oc, "v3.0.0") + + }) + + g.It("PolarionID:77972-[OTP][Skipped:Disconnected]olm v1 Supports MaxOCPVersion in properties file", func() { + var ( + caseID = "77972" + labelValue = caseID + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml") + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns = "ns-77972" + sa = "sa77972" + saCrb = olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: ns, + Template: saClusterRoleBindingTemplate, + } + clustercatalog = olmv1util.ClusterCatalogDescription{ + LabelKey: "olmv1-test", + LabelValue: labelValue, + Name: "clustercatalog-77972", + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm77972", + Template: clustercatalogTemplate, + } + + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-77972", + InstallNamespace: ns, + PackageName: "nginx77972", + SaName: sa, + Version: "0.0.1", + LabelValue: labelValue, + Template: clusterextensionTemplate, + } + ) + + g.By("1) Create namespace, sa, clustercatalog1 and clustercatalog2") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) + + defer saCrb.Delete(oc) + saCrb.Create(oc) + + defer clustercatalog.Delete(oc) + clustercatalog.Create(oc) + + g.By("2) install clusterextension, version 0.0.1, without setting olm.maxOpenShiftVersion") + defer clusterextension.Delete(oc) + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v0.0.1")) + status, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].status}`) + o.Expect(status).To(o.ContainSubstring("True")) + message, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].message}`) + o.Expect(message).To(o.ContainSubstring("All is well")) + + g.By("3) upgrade clusterextension to 1.1.0, olm.maxOpenShiftVersion is 4.19") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"1.1.0"}}}}`) + errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].message}`) + if strings.Contains(message, "InstalledOLMOperatorsUpgradeable") && strings.Contains(message, "nginx77972.v1.1.0") { + e2e.Logf("status is %s", message) + return true, nil + } + return false, nil + }) + status, _ = olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].status}`) + o.Expect(status).To(o.ContainSubstring("False")) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "co", "olm", "-o=jsonpath-as-json={.status.conditions}") + } + exutil.AssertWaitPollNoErr(errWait, "Upgradeable message is not correct") + + g.By("4) upgrade clusterextension to 1.2.0, olm.maxOpenShiftVersion is 4.20") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"1.2.0"}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].message}`) + if strings.Contains(message, "InstalledOLMOperatorsUpgradeable") && strings.Contains(message, "nginx77972.v1.2.0") { + e2e.Logf("status is %s", message) + return true, nil + } + return false, nil + }) + status, _ = olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].status}`) + o.Expect(status).To(o.ContainSubstring("False")) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "co", "olm", "-o=jsonpath-as-json={.status.conditions}") + } + exutil.AssertWaitPollNoErr(errWait, "Upgradeable message is not correct") + }) + + g.It("PolarionID:82249-[OTP][Skipped:Disconnected]Verify olmv1 support for float type maxOCPVersion in properties file", func() { + var ( + caseID = "82249" + labelValue = caseID + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml") + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns = "ns-82249" + sa = "sa82249" + saCrb = olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: ns, + Template: saClusterRoleBindingTemplate, + } + clustercatalog = olmv1util.ClusterCatalogDescription{ + LabelKey: "olmv1-test", + Name: "clustercatalog-82249", + LabelValue: labelValue, + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm82249", + Template: clustercatalogTemplate, + } + + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-82249", + InstallNamespace: ns, + PackageName: "nginx82249", + SaName: sa, + Version: "0.0.1", + LabelValue: labelValue, + Template: clusterextensionTemplate, + } + ) + + g.By("1) Create namespace, sa, clustercatalog") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) + + defer saCrb.Delete(oc) + saCrb.Create(oc) + + defer clustercatalog.Delete(oc) + clustercatalog.Create(oc) + + g.By("2) install clusterextension, version 0.0.1, without setting olm.maxOpenShiftVersion") + defer clusterextension.Delete(oc) + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v0.0.1")) + status, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].status}`) + o.Expect(status).To(o.ContainSubstring("True")) + message, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].message}`) + o.Expect(message).To(o.ContainSubstring("All is well")) + + g.By("3) upgrade clusterextension to 1.2.0, olm.maxOpenShiftVersion is 4.20") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"1.2.0"}}}}`) + errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].message}`) + if strings.Contains(message, "InstalledOLMOperatorsUpgradeable") && strings.Contains(message, "nginx82249.v1.2.0") { + e2e.Logf("status is %s", message) + return true, nil + } + return false, nil + }) + status, _ = olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].status}`) + o.Expect(status).To(o.ContainSubstring("False")) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "co", "olm", "-o=jsonpath-as-json={.status.conditions}") + } + exutil.AssertWaitPollNoErr(errWait, "Upgradeable message is not correct") + + g.By("4) upgrade clusterextension to 1.3.0, olm.maxOpenShiftVersion is 4.21") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"1.3.0"}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].message}`) + if strings.Contains(message, "InstalledOLMOperatorsUpgradeable") && strings.Contains(message, "nginx82249.v1.3.0") { + e2e.Logf("status is %s", message) + return true, nil + } + return false, nil + }) + status, _ = olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].status}`) + o.Expect(status).To(o.ContainSubstring("False")) + if errWait != nil { + _, _ = olmv1util.GetNoEmpty(oc, "co", "olm", "-o=jsonpath-as-json={.status.conditions}") + } + exutil.AssertWaitPollNoErr(errWait, "Upgradeable message is not correct") + + g.By("5) Test PASS") + + }) + + g.It("PolarionID:80117-[OTP][Skipped:Disconnected] Single Namespace Install Mode should be supported", func() { + if !olmv1util.IsFeaturegateEnabled(oc, "NewOLMOwnSingleNamespace") { + g.Skip("SingleOwnNamespaceInstallSupport is not enable, so skip it") + } + var ( + caseID = "80117" + labelValue = caseID + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionOwnSingleTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml") + + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns = "ns-80117" + nsWatch = "ns-80117-watch" + sa = "sa80117" + saCrb = olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: ns, + Template: saClusterRoleBindingTemplate, + } + clustercatalog = olmv1util.ClusterCatalogDescription{ + LabelKey: "olmv1-test", + LabelValue: labelValue, + Name: "clustercatalog-80117", + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm80117", + Template: clustercatalogTemplate, + } + + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-80117", + InstallNamespace: ns, + PackageName: "nginx80117", + SaName: sa, + Version: "1.0.1", + WatchNamespace: nsWatch, + LabelValue: labelValue, + Template: clusterextensionOwnSingleTemplate, + } + clusterextensionAllNs = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-80117", + InstallNamespace: ns, + PackageName: "nginx80117", + SaName: sa, + Version: "1.1.0", + LabelValue: labelValue, + Template: clusterextensionTemplate, + } + ) + + g.By("1) Create namespace, sa, clustercatalog") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) + + defer saCrb.Delete(oc) + saCrb.Create(oc) + + defer clustercatalog.Delete(oc) + clustercatalog.Create(oc) + + g.By("2) install clusterextension, version 1.0.1, without creating watch ns") + defer clusterextension.Delete(oc) + _ = clusterextension.CreateWithoutCheck(oc) + errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.conditions[*].message}") + if !strings.Contains(message, "failed to create resource") { + e2e.Logf("status is %s", message) + return false, nil + } + return true, nil + }) + exutil.AssertWaitPollNoErr(errWait, "status is not correct") + clusterextension.Delete(oc) + + g.By("3) create watch ns") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", nsWatch, "--ignore-not-found").Execute() + }() + err = oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", nsWatch).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", nsWatch)).To(o.BeTrue()) + + g.By("4) create clusterextension, version 1.0.1") + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) + + g.By("4.1) check deployment") + deploymentTargetNS, _ := olmv1util.GetNoEmpty(oc, "deployment", "nginx80117-controller-manager", "-n", ns, "-o", `jsonpath={.spec.template.metadata.annotations.olm\.targetNamespaces}`) + o.Expect(deploymentTargetNS).To(o.ContainSubstring(nsWatch)) + g.By("4.2) check rolebinding") + rdNS, _ := olmv1util.GetNoEmpty(oc, "rolebinding", "-l", "olm.operatorframework.io/owner-name="+clusterextension.Name, "-n", nsWatch, "-o", `jsonpath={..subjects[].namespace}`) + o.Expect(rdNS).To(o.ContainSubstring(ns)) + + g.By("5) upgrade clusterextension to 1.0.2, v1.0.2 only support singleNamespace") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"1.0.2"}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "1.0.2") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx80117 1.0.2 is not installed") + g.By("5.1) check deployment") + deploymentTargetNS, _ = olmv1util.GetNoEmpty(oc, "deployment", "nginx80117-controller-manager", "-n", ns, "-o", `jsonpath={.spec.template.metadata.annotations.olm\.targetNamespaces}`) + o.Expect(deploymentTargetNS).To(o.ContainSubstring(nsWatch)) + g.By("5.2) check rolebinding") + rdNS, _ = olmv1util.GetNoEmpty(oc, "rolebinding", "-l", "olm.operatorframework.io/owner-name="+clusterextension.Name, "-n", nsWatch, "-o", `jsonpath={..subjects[].namespace}`) + o.Expect(rdNS).To(o.ContainSubstring(ns)) + + g.By("6) upgrade clusterextension to 1.1.0, support allnamespace") + clusterextensionAllNs.Create(oc) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "1.1.0") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx80117 1.1.0 is not installed") + g.By("6.1) check deployment") + deploymentTargetNS, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "nginx80117-controller-manager", "-n", ns, "-o", `jsonpath={.spec.template.metadata.annotations.olm\.targetNamespaces}`).Output() + o.Expect(deploymentTargetNS).To(o.BeEmpty()) + g.By("6.2) check rolebinding") + rdNS, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("rolebinding", "-l", "olm.operatorframework.io/owner-name="+clusterextension.Name, "-n", nsWatch).Output() + o.Expect(rdNS).To(o.ContainSubstring("No resources found")) + + g.By("7) upgrade clusterextension to 2.0.0, support singleNamespace") + clusterextension.Version = "2.0.0" + clusterextension.Create(oc) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "2.0.0") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx80117 2.0.0 is not installed") + g.By("7.1) check deployment") + deploymentTargetNS, _ = olmv1util.GetNoEmpty(oc, "deployment", "nginx80117-controller-manager", "-n", ns, "-o", `jsonpath={.spec.template.metadata.annotations.olm\.targetNamespaces}`) + o.Expect(deploymentTargetNS).To(o.ContainSubstring(nsWatch)) + g.By("7.2) check rolebinding") + rdNS, _ = olmv1util.GetNoEmpty(oc, "rolebinding", "-l", "olm.operatorframework.io/owner-name="+clusterextension.Name, "-n", nsWatch, "-o", `jsonpath={..subjects[].namespace}`) + o.Expect(rdNS).To(o.ContainSubstring(ns)) + + g.By("8) check not support install two same clusterextensions") + ns2 := ns + "-2" + nsWatch2 := nsWatch + "-2" + sa2 := "sa80117-2" + saCrb2 := olmv1util.SaCLusterRolebindingDescription{ + Name: sa2, + Namespace: ns2, + Template: saClusterRoleBindingTemplate, + } + + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns2, "--ignore-not-found").Execute() + }() + err = oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns2).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns2)).To(o.BeTrue()) + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", nsWatch2, "--ignore-not-found").Execute() + }() + err = oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", nsWatch2).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", nsWatch2)).To(o.BeTrue()) + + defer saCrb2.Delete(oc) + saCrb2.Create(oc) + clusterextension2 := olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-80117-2", + InstallNamespace: ns2, + PackageName: "nginx80117", + SaName: sa2, + Version: "1.0.1", + WatchNamespace: nsWatch2, + LabelKey: "olmv1-test", + LabelValue: labelValue, + Template: clusterextensionOwnSingleTemplate, + } + defer clusterextension2.Delete(oc) + _ = clusterextension2.CreateWithoutCheck(oc) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension2.Name, "-o", "jsonpath={.status.conditions[*].message}") + if !strings.Contains(message, "already exists") { + e2e.Logf("status is %s", message) + return false, nil + } + return true, nil + }) + exutil.AssertWaitPollNoErr(errWait, "status is not correct") + + g.By("9) Test SUCCESS") + + }) + + g.It("PolarionID:80120-[OTP][Skipped:Disconnected] Own Namespace Install Mode should be supported", func() { + if !olmv1util.IsFeaturegateEnabled(oc, "NewOLMOwnSingleNamespace") { + g.Skip("SingleOwnNamespaceInstallSupport is not enable, so skip it") + } + var ( + caseID = "80120" + labelValue = caseID + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionOwnSingleTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml") + + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns = "ns-80120" + sa = "sa80120" + saCrb = olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: ns, + Template: saClusterRoleBindingTemplate, + } + clustercatalog = olmv1util.ClusterCatalogDescription{ + LabelKey: "olmv1-test", + LabelValue: labelValue, + Name: "clustercatalog-80120", + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm80120", + Template: clustercatalogTemplate, + } + + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-80120", + InstallNamespace: ns, + PackageName: "nginx80120", + SaName: sa, + Version: "1.0.1", + LabelKey: "olmv1-test", + LabelValue: labelValue, + WatchNamespace: ns, + Template: clusterextensionOwnSingleTemplate, + } + clusterextensionAllNs = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-80120", + InstallNamespace: ns, + PackageName: "nginx80120", + SaName: sa, + Version: "3.0.0", + LabelKey: "olmv1-test", + LabelValue: labelValue, + Template: clusterextensionTemplate, + } + ) + + g.By("1) Create namespace, sa, clustercatalog") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) + + defer saCrb.Delete(oc) + saCrb.Create(oc) + + defer clustercatalog.Delete(oc) + clustercatalog.Create(oc) + + g.By("2) install clusterextension, version 1.0.1") + defer clusterextension.Delete(oc) + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) + g.By("2.1) check deployment") + deploymentTargetNS, _ := olmv1util.GetNoEmpty(oc, "deployment", "nginx80120-controller-manager", "-n", ns, "-o", `jsonpath={.spec.template.metadata.annotations.olm\.targetNamespaces}`) + o.Expect(deploymentTargetNS).To(o.ContainSubstring(ns)) + g.By("2.2) check rolebinding") + rdNS, _ := olmv1util.GetNoEmpty(oc, "rolebinding", "-l", "olm.operatorframework.io/owner-name="+clusterextension.Name, "-n", ns, "-o", `jsonpath={..subjects[].namespace}`) + o.Expect(rdNS).To(o.ContainSubstring(ns)) + + g.By("3) upgrade clusterextension to 1.0.2, v1.0.2 only support OwnNamespace") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"1.0.2"}}}}`) + errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "1.0.2") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx80120 1.0.2 is not installed") + + g.By("4) upgrade clusterextension to 3.0.0, support allnamespace") + clusterextensionAllNs.Create(oc) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "3.0.0") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx80120 3.0.0 is not installed") + g.By("4.1) check deployment") + deploymentTargetNS, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "nginx80120-controller-manager", "-n", ns, "-o", `jsonpath={.spec.template.metadata.annotations.olm\.targetNamespaces}`).Output() + o.Expect(deploymentTargetNS).To(o.BeEmpty()) + g.By("4.2) check rolebinding") + rdNS, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("rolebinding", "-l", "olm.operatorframework.io/owner-name="+clusterextension.Name, "-n", ns).Output() + o.Expect(rdNS).To(o.ContainSubstring("No resources found")) + + g.By("5) upgrade clusterextension to 4.0.0, support OwnNamespace") + clusterextension.Version = "4.0.0" + clusterextension.Create(oc) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "4.0.0") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx80120 4.0.0 is not installed") + g.By("5.1) check deployment") + deploymentTargetNS, _ = olmv1util.GetNoEmpty(oc, "deployment", "nginx80120-controller-manager", "-n", ns, "-o", `jsonpath={.spec.template.metadata.annotations.olm\.targetNamespaces}`) + o.Expect(deploymentTargetNS).To(o.ContainSubstring(ns)) + g.By("5.2) check rolebinding") + rdNS, _ = olmv1util.GetNoEmpty(oc, "rolebinding", "-l", "olm.operatorframework.io/owner-name="+clusterextension.Name, "-n", ns, "-o", `jsonpath={..subjects[].namespace}`) + o.Expect(rdNS).To(o.ContainSubstring(ns)) + + g.By("6) if the annotations is not correct, error should be raised") + clusterextension.Delete(oc) + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-80120", + InstallNamespace: ns, + PackageName: "nginx80120", + SaName: sa, + Version: "1.0.1", + WatchNamespace: ns + "flake", + LabelKey: "olmv1-test", + LabelValue: labelValue, + Template: clusterextensionOwnSingleTemplate, + } + _ = clusterextension.CreateWithoutCheck(oc) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.conditions[*].message}") + if !strings.Contains(message, "invalid configuration") { + e2e.Logf("status is %s", message) + return false, nil + } + return true, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx80120 status is not correct") + + g.By("7) Test SUCCESS") + + }) + + g.It("PolarionID:82136-[OTP][Skipped:Disconnected]olm v1 supports NetworkPolicy resources", func() { + var ( + caseID = "82136" + labelValue = caseID + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel-WithoutChannel.yaml") + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") + ns = "ns-82136" + sa = "sa82136" + saCrb = olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: ns, + Template: saClusterRoleBindingTemplate, + } + clustercatalog = olmv1util.ClusterCatalogDescription{ + LabelKey: "olmv1-test", + LabelValue: labelValue, + Name: "clustercatalog-82136", + Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm82136", + Template: clustercatalogTemplate, + } + clusterextension = olmv1util.ClusterExtensionDescription{ + Name: "clusterextension-82136", + InstallNamespace: ns, + PackageName: "nginx82136", + Version: "1.0.1", + SaName: sa, + LabelKey: "olmv1-test", + LabelValue: labelValue, + Template: clusterextensionTemplate, + } + ) + + g.By("Create namespace") + defer func() { + _ = oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() + }() + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) + + g.By("Create SA for clusterextension") + defer saCrb.Delete(oc) + saCrb.Create(oc) + + g.By("1) Create clustercatalog") + defer clustercatalog.Delete(oc) + clustercatalog.Create(oc) + + g.By("2) Installnginx82136.v1.0.1, no networkpolicy") + defer clusterextension.Delete(oc) + clusterextension.Create(oc) + o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("1.0.1")) + networkpolicies, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("networkpolicy", "-n", ns).Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(networkpolicies).To(o.ContainSubstring("No resources found")) + + g.By("3) upgrade to nginx82136.v1.1.0, 1 networkpolicy, allow all ingress and all egress traffic") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"1.1.0"}}}}`) + errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "1.1.0") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx82136 1.1.0 is not installed") + networkpolicies, err = oc.WithoutNamespace().AsAdmin().Run("get").Args("networkpolicy", "-n", ns).Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(networkpolicies).To(o.ContainSubstring("nginx82136-controller-acceptall")) + + g.By("4) upgrade to nginx82136.v2.0.0, 2 networkpolicy, one default deny all traffic, one for controller-manager") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"2.0.0"}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "2.0.0") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx82136 2.2.0 is not installed") + networkpolicies, err = oc.WithoutNamespace().AsAdmin().Run("get").Args("networkpolicy", "-n", ns).Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(networkpolicies).To(o.ContainSubstring("default-deny-all")) + o.Expect(networkpolicies).To(o.ContainSubstring("nginx82136-controller")) + o.Expect(networkpolicies).NotTo(o.ContainSubstring("nginx82136-controller-acceptall")) + + g.By("5) upgrade to nginx82136.v2.1.0, wrong networkpolicy") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"2.1.0"}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.conditions[*].message}") + if !strings.Contains(message, "Unsupported value") { + e2e.Logf("status is %s", message) + return false, nil + } + return true, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx82136.v2.1.0 should not be installed, wrong error message") + + g.By("6) upgrade to nginx82136.v2.2.0, no networkpolicy") + clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"2.2.0"}}}}`) + errWait = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { + clusterextension.GetBundleResource(oc) + if strings.Contains(clusterextension.InstalledBundle, "2.2.0") { + e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) + return true, nil + } + return false, nil + }) + exutil.AssertWaitPollNoErr(errWait, "nginx82136 2.2.0 is not installed") + networkpolicies, err = oc.WithoutNamespace().AsAdmin().Run("get").Args("networkpolicy", "-n", ns).Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(networkpolicies).To(o.ContainSubstring("No resources found")) + + g.By("7) Test SUCCESS") + }) + }) diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withoutChannel-OwnSingle.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutVersion.yaml similarity index 71% rename from openshift/tests-extension/test/qe/testdata/olm/clusterextension-withoutChannel-OwnSingle.yaml rename to openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutVersion.yaml index 757dd2766..fcccd8e72 100644 --- a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withoutChannel-OwnSingle.yaml +++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-WithoutVersion.yaml @@ -7,8 +7,6 @@ objects: kind: ClusterExtension metadata: name: "${NAME}" - annotations: - olm.operatorframework.io/watch-namespace: "${WATCHNS}" spec: namespace: "${INSTALLNAMESPACE}" serviceAccount: @@ -17,17 +15,23 @@ objects: sourceType: "${SOURCETYPE}" catalog: packageName: "${PACKAGE}" - version: "${VERSION}" + channels: + - "${CHANNEL}" + selector: + matchLabels: + "${LABELKEY}": "${LABELVALUE}" upgradeConstraintPolicy: "${POLICY}" parameters: - name: NAME - name: INSTALLNAMESPACE -- name: WATCHNS - name: PACKAGE -- name: VERSION +- name: CHANNEL - name: SANAME - name: POLICY value: "CatalogProvided" +- name: LABELVALUE + # suggest to use case id +- name: LABELKEY + value: "olmv1-test" - name: SOURCETYPE value: "Catalog" - diff --git a/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml new file mode 100644 index 000000000..7a7dec1ec --- /dev/null +++ b/openshift/tests-extension/test/qe/testdata/olm/clusterextension-withselectorlabel-withoutChannel-OwnSingle.yaml @@ -0,0 +1,45 @@ +apiVersion: template.openshift.io/v1 +kind: Template +metadata: + name: operator-template +objects: +- apiVersion: olm.operatorframework.io/v1 + kind: ClusterExtension + metadata: + name: "${NAME}" + spec: + namespace: "${INSTALLNAMESPACE}" + serviceAccount: + name: "${SANAME}" + config: + configType: Inline + inline: + watchNamespace: "${WATCHNS}" + source: + sourceType: "${SOURCETYPE}" + catalog: + packageName: "${PACKAGE}" + version: "${VERSION}" + selector: + matchLabels: + "${LABELKEY}": "${LABELVALUE}" + upgradeConstraintPolicy: "${POLICY}" +parameters: +- name: NAME +- name: INSTALLNAMESPACE +- name: WATCHNS +- name: PACKAGE +- name: VERSION +- name: SANAME +- name: POLICY + value: "CatalogProvided" +- name: SOURCETYPE + value: "Catalog" +- name: LABELVALUE + # suggest to use case id +- name: LABELKEY + value: "olmv1-test" + + + +