element_type
stringclasses
4 values
project_name
stringclasses
1 value
uuid
stringlengths
36
36
name
stringlengths
0
346
imports
stringlengths
0
2.67k
structs
stringclasses
761 values
interfaces
stringclasses
22 values
file_location
stringclasses
545 values
code
stringlengths
26
8.07M
global_vars
stringclasses
7 values
package
stringclasses
124 values
tags
stringclasses
1 value
test case
openshift/openshift-tests-private
a1777f69-37c2-4ade-93c2-71cafbd5d777
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-69242-Catalogd deprecated package/bundlemetadata/catalogmetadata from clustercatalog CR
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-69242-Catalogd deprecated package/bundlemetadata/catalogmetadata from clustercatalog CR", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-69242", Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm69242", Template: clustercatalogTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("get the old related crd package/bundlemetadata/bundledeployment") packageOutput, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("package").Output() o.Expect(err).To(o.HaveOccurred()) o.Expect(string(packageOutput)).To(o.ContainSubstring("error: the server doesn't have a resource type \"package\"")) bundlemetadata, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("bundlemetadata").Output() o.Expect(err).To(o.HaveOccurred()) o.Expect(string(bundlemetadata)).To(o.ContainSubstring("error: the server doesn't have a resource type \"bundlemetadata\"")) catalogmetadata, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("catalogmetadata").Output() o.Expect(err).To(o.HaveOccurred()) o.Expect(string(catalogmetadata)).To(o.ContainSubstring("error: the server doesn't have a resource type \"catalogmetadata\"")) })
test case
openshift/openshift-tests-private
73222de9-b447-4f00-8b92-38afa22ea345
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-69069-Replace pod-based image unpacker with an image registry client
['"context"', '"fmt"', '"path/filepath"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-69069-Replace pod-based image unpacker with an image registry client", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-69069", Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm69069", Template: clustercatalogTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) initresolvedRef, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("clustercatalog", clustercatalog.Name, "-o=jsonpath={.status.resolvedSource.image.ref}").Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("Update the index image with different tag , but the same digestID") err = oc.AsAdmin().Run("patch").Args("clustercatalog", clustercatalog.Name, "-p", `{"spec":{"source":{"image":{"ref":"quay.io/olmqe/olmtest-operator-index:nginxolm69069v1"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("Check the image is updated without wait but the resolvedSource is still the same and won't unpack again") jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].status}`, "Serving") statusOutput, err := olmv1util.GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", jsonpath) o.Expect(err).NotTo(o.HaveOccurred()) if !strings.Contains(statusOutput, "True") { e2e.Failf("status is %v, not Serving", statusOutput) } errWait := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { img, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("clustercatalog", clustercatalog.Name, "-o=jsonpath={.status.resolvedSource.image.ref}").Output() if err != nil { return false, err } if strings.Contains(img, initresolvedRef) { return true, nil } e2e.Logf("diff image1: %v, but expect same", img) return false, nil }) if errWait != nil { olmv1util.GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o=jsonpath-as-json={.status}") } exutil.AssertWaitPollNoErr(errWait, "disgest is not same, but should be same") exutil.By("Update the index image with different tag and digestID") err = oc.AsAdmin().Run("patch").Args("clustercatalog", clustercatalog.Name, "-p", `{"spec":{"source":{"image":{"ref":"quay.io/olmqe/olmtest-operator-index:nginxolm69069v2"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) errWait = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 90*time.Second, false, func(ctx context.Context) (bool, error) { img, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("clustercatalog", clustercatalog.Name, "-o=jsonpath={.status.resolvedSource.image.ref}").Output() if err != nil { return false, err } if strings.Contains(img, initresolvedRef) { e2e.Logf("same image, but expect not same") return false, nil } e2e.Logf("image2: %v", img) return true, nil }) if errWait != nil { olmv1util.GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o=jsonpath-as-json={.status}") } exutil.AssertWaitPollNoErr(errWait, "digest is same, but should be not same") })
test case
openshift/openshift-tests-private
179d367c-3752-4a16-aae5-7eec366a2941
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-69869-Catalogd Add metrics to the Storage implementation
['"context"', '"fmt"', '"os/exec"', '"path/filepath"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-69869-Catalogd Add metrics to the Storage implementation", func() { exutil.SkipOnProxyCluster(oc) var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-69869", Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm69869", Template: clustercatalogTemplate, } metricsMsg string ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Get http content") packageDataOut, err := clustercatalog.UnmarshalContent(oc, "package") o.Expect(err).NotTo(o.HaveOccurred()) packageName := olmv1util.ListPackagesName(packageDataOut.Packages) o.Expect(packageName[0]).To(o.ContainSubstring("nginx69869")) exutil.By("Get token and clusterIP") 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()) metricsToken, err := exutil.GetSAToken(oc) o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(metricsToken).NotTo(o.BeEmpty()) clustercatalogPodname, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "--selector=app=catalog-operator", "-o=jsonpath={.items..metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clustercatalogPodname).NotTo(o.BeEmpty()) errWait := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { queryContent := "https://" + promeEp + ":7443/metrics" metricsMsg, err = oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", clustercatalogPodname, "-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.") } })
test case
openshift/openshift-tests-private
44c2a553-6035-402a-ad5a-23620778b8ab
Author:xzha-VMonly-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-High-70817-catalogd support setting a pull secret
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-VMonly-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-High-70817-catalogd support setting a pull secret", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-secret.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextensionWithoutChannelVersion.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-70817" sa = "sa70817" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-70817-quay", Imageref: "quay.io/olmqe/olmtest-operator-index-private:nginxolm70817", PullSecret: "fake-secret-70817", PollIntervalMinutes: "1", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-70817", InstallNamespace: ns, PackageName: "nginx70817", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("1) Create secret") defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", "openshift-catalogd", "secret", "secret-70817-quay").Output() _, err = oc.AsAdmin().WithoutNamespace().Run("create").Args("-n", "openshift-catalogd", "secret", "generic", "secret-70817-quay", "--from-file=.dockerconfigjson=/home/cloud-user/.docker/config.json", "--type=kubernetes.io/dockerconfigjson").Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("2) Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.CreateWithoutCheck(oc) clustercatalog.WaitCatalogStatus(oc, "false", "Serving", 30) conditions, _ := olmv1util.GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", "jsonpath={.status.conditions}") o.Expect(conditions).To(o.ContainSubstring("error fetching")) o.Expect(conditions).To(o.ContainSubstring("401 Unauthorized")) exutil.By("3) Patch the clustercatalog") patchResource(oc, asAdmin, withoutNamespace, "clustercatalog", clustercatalog.Name, "-p", `{"spec":{"source":{"image":{"pullSecret":"secret-70817-quay"}}}}`, "--type=merge") clustercatalog.WaitCatalogStatus(oc, "true", "Serving", 0) exutil.By("4) install clusterextension") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) })
test case
openshift/openshift-tests-private
0068fd85-bc81-4a90-9a7f-5ddf9d04b511
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-69202-Catalogd clustercatalog offer the operator content through http server off cluster
['"context"', '"os/exec"', '"path/filepath"', '"regexp"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-69202-Catalogd clustercatalog offer the operator content through http server off cluster", func() { exutil.SkipOnProxyCluster(oc) var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-69202", Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm69202", Template: clustercatalogTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("get the index content through http service off cluster") errWait := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 100*time.Second, false, func(ctx context.Context) (bool, error) { checkOutput, err := exec.Command("bash", "-c", "curl -k "+clustercatalog.ContentURL).Output() if err != nil { e2e.Logf("failed to execute the curl: %s. Trying again", err) return false, nil } if matched, _ := regexp.MatchString("nginx69202", string(checkOutput)); matched { e2e.Logf("Check the content off cluster success\n") return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(errWait, "Cannot get the result") })
test case
openshift/openshift-tests-private
a07c8db9-c654-43fd-b13c-1b65f9d67773
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-73219-Fetch deprecation data from the catalogd http server
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-73219-Fetch deprecation data from the catalogd http server", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-73219", Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm73219", Template: clustercatalogTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("get the deprecation content through http service on cluster") unmarshalContent, err := clustercatalog.UnmarshalContent(oc, "deprecations") o.Expect(err).NotTo(o.HaveOccurred()) deprecatedChannel := olmv1util.GetDeprecatedChannelNameByPakcage(unmarshalContent.Deprecations, "nginx73219") o.Expect(deprecatedChannel[0]).To(o.ContainSubstring("candidate-v0.0")) deprecatedBundle := olmv1util.GetDeprecatedBundlesNameByPakcage(unmarshalContent.Deprecations, "nginx73219") o.Expect(deprecatedBundle[0]).To(o.ContainSubstring("nginx73219.v0.0.1")) })
test case
openshift/openshift-tests-private
3089e51e-823b-4059-afb8-c1b3f609bf6d
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-73289-Check the deprecation conditions and messages
['"context"', '"path/filepath"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-73289-Check the deprecation conditions and messages", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-73289" sa = "sa73289" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-73289", Imageref: "quay.io/olmqe/olmtest-operator-index:nginxolm73289", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-73289", InstallNamespace: ns, PackageName: "nginx73289v1", Channel: "candidate-v1.0", Version: "1.0.1", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.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")) // Test BundleDeprecated exutil.By("Check BundleDeprecated status") clusterextension.WaitClusterExtensionCondition(oc, "Deprecated", "True", 0) clusterextension.WaitClusterExtensionCondition(oc, "BundleDeprecated", "True", 0) exutil.By("Check BundleDeprecated message info") message := clusterextension.GetClusterExtensionMessage(oc, "BundleDeprecated") if !strings.Contains(message, "nginx73289v1.v1.0.1 is deprecated. Uninstall and install v1.0.3 for support.") { e2e.Failf("Info does not meet expectations, message :%v", message) } exutil.By("update version to be >=1.0.2") 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) { installedBundle, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.install.bundle.name}") if !strings.Contains(installedBundle, "v1.0.3") { e2e.Logf("clusterextension.InstalledBundle is %s, not v1.0.3, and try next", installedBundle) 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.3") } exutil.By("Check if BundleDeprecated status and messages still exist") clusterextension.WaitClusterExtensionCondition(oc, "Deprecated", "False", 0) clusterextension.WaitClusterExtensionCondition(oc, "BundleDeprecated", "False", 0) message = clusterextension.GetClusterExtensionMessage(oc, "BundleDeprecated") if strings.Contains(message, "nginx73289v1.v1.0.1 is deprecated. Uninstall and install v1.0.3 for support.") { e2e.Failf("BundleDeprecated message still exists :%v", message) } clusterextension.Delete(oc) exutil.By("BundleDeprecated test done") // Test ChannelDeprecated exutil.By("update channel to candidate-v3.0") clusterextension.PackageName = "nginx73289v2" clusterextension.Channel = "candidate-v3.0" clusterextension.Version = ">=1.0.0" clusterextension.Template = clusterextensionTemplate clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v3.0.1")) exutil.By("Check ChannelDeprecated status and message") clusterextension.WaitClusterExtensionCondition(oc, "Deprecated", "True", 0) clusterextension.WaitClusterExtensionCondition(oc, "ChannelDeprecated", "True", 0) message = clusterextension.GetClusterExtensionMessage(oc, "ChannelDeprecated") if !strings.Contains(message, "The 'candidate-v3.0' channel is no longer supported. Please switch to the 'candidate-v3.1' channel.") { e2e.Failf("Info does not meet expectations, message :%v", message) } exutil.By("update channel to candidate-v3.1") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels": ["candidate-v3.1"]}}}}`) exutil.By("Check if ChannelDeprecated status and messages still exist") clusterextension.WaitClusterExtensionCondition(oc, "Deprecated", "False", 0) clusterextension.WaitClusterExtensionCondition(oc, "ChannelDeprecated", "False", 0) message = clusterextension.GetClusterExtensionMessage(oc, "ChannelDeprecated") if strings.Contains(message, "The 'candidate-v3.0' channel is no longer supported. Please switch to the 'candidate-v3.1' channel.") { e2e.Failf("ChannelDeprecated message still exists :%v", message) } clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "reason", "Succeeded", 3, 150, 0) clusterextension.WaitClusterExtensionCondition(oc, "Installed", "True", 0) clusterextension.Delete(oc) exutil.By("ChannelDeprecated test done") // Test PackageDeprecated exutil.By("update Package to 73289v3") clusterextension.PackageName = "nginx73289v3" clusterextension.Channel = "candidate-v1.0" clusterextension.Version = ">=1.0.0" clusterextension.Template = clusterextensionTemplate clusterextension.Create(oc) exutil.By("Check PackageDeprecated status and message") clusterextension.WaitClusterExtensionCondition(oc, "Deprecated", "True", 0) clusterextension.WaitClusterExtensionCondition(oc, "PackageDeprecated", "True", 0) message = clusterextension.GetClusterExtensionMessage(oc, "PackageDeprecated") if !strings.Contains(message, "The nginx73289v3 package is end of life. Please use the another package for support.") { e2e.Failf("Info does not meet expectations, message :%v", message) } exutil.By("PackageDeprecated test done") })
test case
openshift/openshift-tests-private
e6f070cf-872a-489b-b7a3-f02339981a6b
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-74948-catalog offer the operator content through https server
['"path/filepath"', '"strings"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-74948-catalog offer the operator content through https server", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-74948" sa = "sa74948" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-74948", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm74948", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-74948", InstallNamespace: ns, PackageName: "nginx74948", Channel: "candidate-v1.0", Version: "1.0.3", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Examine the service to confirm that the annotations are present") describe, err := oc.WithoutNamespace().AsAdmin().Run("describe").Args("service", "catalogd-service", "-n", "openshift-catalogd").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(describe).To(o.ContainSubstring("service.beta.openshift.io/serving-cert-secret-name: catalogserver-cert")) exutil.By("Ensure that the service CA bundle has been injected") crt, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("configmap", "openshift-service-ca.crt", "-n", "openshift-catalogd", "-o", "jsonpath={.metadata.annotations}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(crt).To(o.ContainSubstring("{\"service.beta.openshift.io/inject-cabundle\":\"true\"}")) exutil.By("Check secret data tls.crt tls.key") secretData, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("secret", "catalogserver-cert", "-n", "openshift-catalogd", "-o", "jsonpath={.data}").Output() o.Expect(err).NotTo(o.HaveOccurred()) if !strings.Contains(secretData, "tls.crt") || !strings.Contains(secretData, "tls.key") { e2e.Failf("secret data not found") } exutil.By("Get the index content through https service on cluster") unmarshalContent, err := clustercatalog.UnmarshalContent(oc, "all") o.Expect(err).NotTo(o.HaveOccurred()) allPackageName := olmv1util.ListPackagesName(unmarshalContent.Packages) o.Expect(allPackageName[0]).To(o.ContainSubstring("nginx74948")) exutil.By("Create clusterextension to verify operator-controller has been started, appropriately loaded the CA certs") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.3")) })
test case
openshift/openshift-tests-private
5d39a25f-b63a-49df-aac0-3ce0bf15e6b7
Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-74978-CRD upgrade will be prevented if the Scope is switched between Namespaced and Cluster
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-74978-CRD upgrade will be prevented if the Scope is switched between Namespaced and Cluster", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-74978" sa = "sa74978" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-74978", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm74978", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-74978", InstallNamespace: ns, PackageName: "nginx74978", Channel: "candidate-v1.0", Version: "1.0.1", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension v1.0.1") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) exutil.By("Update the version to 1.0.2, check changed from Namespaced to Cluster") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.2","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `CustomResourceDefinition nginxolm74978s.cache.example.com failed upgrade safety validation. "NoScopeChange" validation failed: scope changed from "Namespaced" to "Cluster"`, 10, 60, 0) clusterextension.Delete(oc) exutil.By("Create clusterextension v1.0.2") clusterextension.Version = "1.0.2" clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.2")) exutil.By("Update the version to 1.0.3, check changed from Cluster to Namespaced") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.3","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.2")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `CustomResourceDefinition nginxolm74978s.cache.example.com failed upgrade safety validation. "NoScopeChange" validation failed: scope changed from "Cluster" to "Namespaced"`, 10, 60, 0) })
test case
openshift/openshift-tests-private
fbe5c5bf-1580-4f0a-9d88-d39134c49011
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75218-Disabling the CRD Upgrade Safety preflight checks
['"context"', '"fmt"', '"path/filepath"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75218-Disabling the CRD Upgrade Safety preflight checks", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-75218" sa = "sa75218" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-75218", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75218", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-75218", InstallNamespace: ns, PackageName: "nginx75218", Channel: "candidate-v1.0", Version: "1.0.1", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension v1.0.1") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) exutil.By("update the version to 1.0.2, report messages and upgrade safety fail") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.2","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `scope changed from "Namespaced" to "Cluster"`, 10, 60, 0) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `.spec.field1 may not be removed`, 10, 60, 0) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `calculating schema diff for CRD version "v1alpha1"`, 10, 60, 0) exutil.By("disabled crd upgrade safety check, it will not affect spec.scope: Invalid value: Cluster") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.2","upgradeConstraintPolicy":"SelfCertified"}}, "install":{"preflight":{"crdUpgradeSafety":{"enforcement":"None"}}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) var message string errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 18*time.Second, false, func(ctx context.Context) (bool, error) { message = clusterextension.GetClusterExtensionMessage(oc, "Progressing") if !strings.Contains(message, `CustomResourceDefinition.apiextensions.k8s.io "nginxolm75218s.cache.example.com" is invalid: spec.scope: Invalid value: "Cluster": field is immutable`) { return false, nil } return true, nil }) if errWait != nil { olmv1util.GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o=jsonpath-as-json={.status}") } exutil.AssertWaitPollNoErr(errWait, fmt.Sprintf("Unexpected results message: %v", message)) exutil.By("disabled crd upgrade safety check An existing stored version of the CRD is removed") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.3","upgradeConstraintPolicy":"SelfCertified"}}, "install":{"preflight":{"crdUpgradeSafety":{"enforcement":"None"}}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `must have exactly one version marked as storage version, status.storedVersions[0]: Invalid value: "v1alpha1": must appear in spec.versions`, 10, 60, 0) exutil.By("disabled crd upgrade safety successfully") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.5","upgradeConstraintPolicy":"SelfCertified"}}, "install":{"preflight":{"crdUpgradeSafety":{"enforcement":"None"}}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "reason", "Succeeded", 3, 150, 0) clusterextension.WaitClusterExtensionCondition(oc, "Installed", "True", 0) clusterextension.GetBundleResource(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.5")) clusterextension.CheckClusterExtensionCondition(oc, "Installed", "message", "Installed bundle quay.io/openshifttest/nginxolm-operator-bundle:v1.0.5-nginxolm75218 successfully", 10, 60, 0) })
test case
openshift/openshift-tests-private
17d855b3-742b-4e44-b20b-51fbea9f3c24
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75122-CRD upgrade check Removing an existing stored version and add a new CRD with no modifications to existing versions
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75122-CRD upgrade check Removing an existing stored version and add a new CRD with no modifications to existing versions", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "75122" labelValue = caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-75122" sa = "sa75122" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-75122", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75122", LabelValue: labelValue, Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-75122", InstallNamespace: ns, PackageName: "nginx75122", Channel: "candidate-v1.0", Version: "1.0.1", SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension v1.0.1") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) exutil.By("upgrade will be prevented if An existing stored version of the CRD is removed") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.2","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `failed: stored version "v1alpha1" removed for resolved bundle "nginx75122.v1.0.2" with version "1.0.2"`, 10, 60, 0) exutil.By("upgrade will be allowed if A new version of the CRD is added with no modifications to existing versions") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.3","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "reason", "Succeeded", 3, 150, 0) clusterextension.WaitClusterExtensionCondition(oc, "Installed", "True", 0) clusterextension.GetBundleResource(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.3")) clusterextension.CheckClusterExtensionCondition(oc, "Installed", "message", "Installed bundle quay.io/openshifttest/nginxolm-operator-bundle:v1.0.3-nginxolm75122 successfully", 10, 60, 0) exutil.By("upgrade will be prevented if An existing served version of the CRD is removed") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.6","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) clusterextension.CheckClusterExtensionCondition(oc, "Installed", "message", "Installed bundle quay.io/openshifttest/nginxolm-operator-bundle:v1.0.6-nginxolm75122 successfully", 10, 60, 0) })
test case
openshift/openshift-tests-private
25f36be5-ae17-48fd-9a05-0910e664b62c
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75123-High-75217-CRD upgrade checks for changes in required field and field type
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75123-High-75217-CRD upgrade checks for changes in required field and field type", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "75123" labelValue = caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-75123" sa = "sa75123" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-75123", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75123", LabelValue: labelValue, Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-75123", InstallNamespace: ns, PackageName: "nginx75123", Channel: "candidate-v1.0", Version: "1.0.1", SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension v1.0.1") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) exutil.By("upgrade will be prevented if A new required field is added to an existing version of the CRD") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.2","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) // Cover test case: OCP-75217 - [olmv1] Override the unsafe upgrades with the warning message clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `new required fields [requiredfield2] added for resolved bundle`, 10, 60, 0) exutil.By("upgrade will be prevented if An existing field is removed from an existing version of the CRD") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.3","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `CustomResourceDefinition nginxolm75123s.cache.example.com failed upgrade safety validation. "NoExistingFieldRemoved" validation failed: crd/nginxolm75123s.cache.example.com version/v1alpha1 field/^.spec.field may not be removed`, 10, 60, 0) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `CustomResourceDefinition nginxolm75123s.cache.example.com failed upgrade safety validation. "ChangeValidator" validation failed: calculating schema diff for CRD version "v1alpha1"`, 10, 60, 0) exutil.By("upgrade will be prevented if An existing field type is changed in an existing version of the CRD") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.6","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `field "^.spec.field": type changed from "integer" to "string" for resolved bundle`, 10, 60, 0) exutil.By("upgrade will be allowed if An existing required field is changed to optional in an existing version") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.8","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "reason", "Succeeded", 3, 150, 0) clusterextension.WaitClusterExtensionCondition(oc, "Installed", "True", 0) clusterextension.GetBundleResource(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.8")) clusterextension.CheckClusterExtensionCondition(oc, "Installed", "message", "Installed bundle quay.io/openshifttest/nginxolm-operator-bundle:v1.0.8-nginxolm75123 successfully", 10, 60, 0) })
test case
openshift/openshift-tests-private
1e36d0df-b457-4972-ac4f-5785912e9c40
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75124-CRD upgrade checks for changes in default values
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75124-CRD upgrade checks for changes in default values", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "75124" labelValue = caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-75124" sa = "sa75124" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-75124", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75124", LabelValue: labelValue, Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-75124", InstallNamespace: ns, PackageName: "nginx75124", Channel: "candidate-v1.0", Version: "1.0.1", SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension v1.0.1") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) exutil.By("upgrade will be prevented if A new default value is added to a field that did not previously have a default value") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.2","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `default value "\"default-string-xzha\"" added when there was no default previously for resolved bundle`, 10, 60, 0) exutil.By("upgrade will be prevented if The default value of a field is changed") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.3","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `failed: version "v1alpha1", field "^.spec.defaultenum": default value changed from "\"value1\"" to "\"value3\"" for resolved bundle`, 10, 60, 0) exutil.By("upgrade will be prevented if An existing default value of a field is removed") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.6","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `field "^.spec.defaultint": default value "9" removed for resolved bundle`, 10, 60, 0) })
test case
openshift/openshift-tests-private
ec2d66c1-c733-4985-ba57-d508abbe63fb
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75515-CRD upgrade checks for changes in enumeration values
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75515-CRD upgrade checks for changes in enumeration values", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "75515" labelValue = caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-75515" sa = "sa75515" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-75515", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75515", LabelValue: labelValue, Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-75515", InstallNamespace: ns, PackageName: "nginx75515", Channel: "candidate-v1.0", Version: "1.0.1", SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension v1.0.1") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) exutil.By("upgrade will be prevented if New enum restrictions are added to an existing field which did not previously have enum restrictions") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.2","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `field "^.spec.unenumfield": enum constraints ["value1" "value2" "value3"] added when there were no restrictions previously for resolved bundle`, 10, 60, 0) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.Delete(oc) exutil.By("Create clusterextension v1.0.3") clusterextension.Version = "1.0.3" clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.3")) exutil.By("upgrade will be prevented if Existing enum values from an existing field are removed") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.5","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", "validation failed", 10, 60, 0) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.3")) exutil.By("upgrade will be allowed if Adding new enum values to the list of allowed enum values in a field") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.6","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) clusterextension.WaitClusterExtensionVersion(oc, "v1.0.6") })
test case
openshift/openshift-tests-private
8557bdec-9e4d-4567-a94b-93d5eba8a958
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75516-CRD upgrade checks for the field maximum minimum changes
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-75516-CRD upgrade checks for the field maximum minimum changes", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "75516" labelValue = caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-75516" sa = "sa75516" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-75516", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75516", LabelValue: labelValue, Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-75516", InstallNamespace: ns, PackageName: "nginx75516", Channel: "candidate-v1.0", Version: "1.0.1", SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension v1.0.1") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) exutil.By("upgrade will be prevented if The minimum value of an existing field is increased in an existing version and The maximum value of an existing field is decreased in an existing version") exutil.By("Check minimum & maximum") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.2","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", "maximum: constraint decreased from 100 to 80", 10, 60, 0) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", "minimum: constraint increased from 10 to 20", 10, 60, 0) exutil.By("Check minLength & maxLength") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.3","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", "maxLength: constraint decreased from 50 to 30", 10, 60, 0) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", "minLength: constraint increased from 3 to 9", 10, 60, 0) exutil.By("Check minProperties & maxProperties") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.4","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", "maxProperties: constraint decreased from 5 to 4", 10, 60, 0) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", "minProperties: constraint increased from 2 to 3", 10, 60, 0) exutil.By("Check minItems & maxItems") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.5","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", "maxItems: constraint decreased from 10 to 9", 10, 60, 0) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", "minItems: constraint increased from 2 to 3", 10, 60, 0) exutil.By("upgrade will be prevented if Minimum or maximum field constraints are added to a field that did not previously have constraints") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.6","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.1")) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `maximum: constraint 100 added when there were no restrictions previously`, 10, 60, 0) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "message", `minimum: constraint 10 added when there were no restrictions previously`, 10, 60, 0) exutil.By("upgrade will be Allowed if The minimum value of an existing field is decreased in an existing version & The maximum value of an existing field is increased in an existing version") err = oc.AsAdmin().Run("patch").Args("clusterextension", clusterextension.Name, "-p", `{"spec":{"source":{"catalog":{"version":"1.0.7","upgradeConstraintPolicy":"SelfCertified"}}}}`, "--type=merge").Execute() o.Expect(err).NotTo(o.HaveOccurred()) clusterextension.CheckClusterExtensionCondition(oc, "Progressing", "reason", "Succeeded", 3, 150, 0) clusterextension.WaitClusterExtensionCondition(oc, "Installed", "True", 0) clusterextension.GetBundleResource(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("v1.0.7")) clusterextension.CheckClusterExtensionCondition(oc, "Installed", "message", "Installed bundle quay.io/openshifttest/nginxolm-operator-bundle:v1.0.7-nginxolm75516 successfully", 10, 60, 0) })
test case
openshift/openshift-tests-private
b80c48b3-b8f5-47e3-ae6d-c20e7529d9d0
Author:xzha-ConnectedOnly-NonHyperShiftHOST-Critical-75441-Catalogd supports compression and jsonlines format
['"fmt"', '"os/exec"', '"path/filepath"', '"strings"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_opeco.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-Critical-75441-Catalogd supports compression and jsonlines format", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-75441", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75441", Template: clustercatalogTemplate, } clustercatalog1 = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-75441v2", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75441v2", Template: clustercatalogTemplate, } ) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) defer clustercatalog1.Delete(oc) clustercatalog1.Create(oc) exutil.By("Get the gzip response") url1 := clustercatalog.ContentURL exutil.By("Check the url response of clustercatalog-75441") getCmd := fmt.Sprintf("curl -ki %s -H \"Accept-Encoding: gzip\" --output -", url1) stringMessage, err := exec.Command("bash", "-c", getCmd).Output() o.Expect(err).NotTo(o.HaveOccurred()) if !strings.Contains(strings.ToLower(string(stringMessage)), "content-encoding: gzip") { e2e.Logf(string(stringMessage)) e2e.Failf("string Content-Encoding: gzip not in the output") } if !strings.Contains(strings.ToLower(string(stringMessage)), "content-type: application/jsonl") { e2e.Logf(string(stringMessage)) e2e.Failf("string Content-Type: application/jsonl not in the output") } exutil.By("Check the url response of clustercatalog-75441v2") url2 := clustercatalog1.ContentURL getCmd2 := fmt.Sprintf("curl -ki %s -H \"Accept-Encoding: gzip\"", url2) stringMessage2, err := exec.Command("bash", "-c", getCmd2).Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(strings.ToLower(string(stringMessage2))).NotTo(o.ContainSubstring("content-encoding: gzip")) o.Expect(strings.ToLower(string(stringMessage2))).To(o.ContainSubstring("content-type: application/jsonl")) })
test
openshift/openshift-tests-private
6843f46e-a5c4-4040-9189-8c10e4568778
olmv1_oprun
import ( "context" "fmt" "os" "os/exec" "path/filepath" "strings" "time" g "github.com/onsi/ginkgo/v2" o "github.com/onsi/gomega" olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util" exutil "github.com/openshift/openshift-tests-private/test/extended/util" "github.com/openshift/openshift-tests-private/test/extended/util/architecture" "github.com/tidwall/gjson" "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" )
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
package operators import ( "context" "fmt" "os" "os/exec" "path/filepath" "strings" "time" g "github.com/onsi/ginkgo/v2" o "github.com/onsi/gomega" olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util" exutil "github.com/openshift/openshift-tests-private/test/extended/util" "github.com/openshift/openshift-tests-private/test/extended/util/architecture" "github.com/tidwall/gjson" "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" ) var _ = g.Describe("[sig-operators] OLM v1 oprun should", func() { // Hypershift will be supported from 4.19, so add NonHyperShiftHOST Per cases now. defer g.GinkgoRecover() var ( oc = exutil.NewCLIWithoutNamespace("default") // we need to check if it is TP in BeforeEach before every case. if we use exutil.NewCLI("olmv1-oprun-"+getRandomString(), exutil.KubeConfigPath()) // it will create temp project, but it will fail sometime on SNO cluster because of system issue. // so, we use exutil.NewCLIWithoutNamespace("default") not to create temp project to get oc client to check if it is TP. // if it need temp project, could use oc.SetupProject() in g.It to create it firstly. ) g.BeforeEach(func() { exutil.SkipNoOLMv1Core(oc) }) // author: [email protected] // OLMv1 doesn't support Hypershift by now(29.11.2024). More: https://redhat-internal.slack.com/archives/GHMALGJV6/p1731949072094519?thread_ts=1731591485.969199&cid=GHMALGJV6 // g.It("Author:jiazha-NonHyperShiftHOST-Medium-74638-Apply hypershift cluster-profile for ibm-cloud-managed", func() { // ibmCloudManaged, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("olm.operator.openshift.io", "cluster", `-o=jsonpath={.metadata.annotations.include\.release\.openshift\.io/ibm-cloud-managed}`).Output() // if err != nil { // e2e.Failf("fail to get include.release.openshift.io/ibm-cloud-managed annotation:%v, error:%v", ibmCloudManaged, err) // } // if ibmCloudManaged != "true" { // e2e.Failf("the include.release.openshift.io/ibm-cloud-managed(%s) is not true", ibmCloudManaged) // } // }) // author: [email protected] g.It("Author:kuiwang-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-Medium-68903-BundleDeployment Health resource unhealthy pod api crd ds", func() { // oc.SetupProject() // it is example if the case need temp project. here it does not need it, so comment it. var ( ns = "ns-68903" baseDir = exutil.FixturePath("testdata", "olm", "v1") basicBdPlainImageTemplate = filepath.Join(baseDir, "basic-bd-plain-image.yaml") unhealthyPod = olmv1util.BundleDeploymentDescription{ BdName: "68903-pod-unhealthy", Address: "quay.io/olmqe/olmv1bundle:plain-68903-podunhealthy", Namespace: ns, Template: basicBdPlainImageTemplate, } unhealthyPodChild = []olmv1util.ChildResource{ {Kind: "namespace", Ns: ""}, } unhealthyApiservice = olmv1util.BundleDeploymentDescription{ BdName: "68903-apis-unhealthy", Address: "quay.io/olmqe/olmv1bundle:plain-68903-apisunhealthy", Namespace: ns, Template: basicBdPlainImageTemplate, } unhealthyApiserviceChild = []olmv1util.ChildResource{ {Kind: "APIService", Ns: ""}, } unhealthyCRD = olmv1util.BundleDeploymentDescription{ BdName: "68903-crd-unhealthy", Address: "quay.io/olmqe/olmv1bundle:plain-68903-crdunhealthy", Namespace: ns, Template: basicBdPlainImageTemplate, } unhealthyDS = olmv1util.BundleDeploymentDescription{ BdName: "68903-ds-unhealthy", Address: "quay.io/olmqe/olmv1bundle:plain-68903-dsunhealthy", Namespace: ns, Template: basicBdPlainImageTemplate, } unhealthyDSChild = []olmv1util.ChildResource{ {Kind: "namespace", Ns: ""}, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create unhealthy pod") defer unhealthyPod.DeleteWithoutCheck(oc) unhealthyPod.CreateWithoutCheck(oc) unhealthyPod.AssertHealthyWithConsistent(oc, "false") unhealthyPod.Delete(oc, unhealthyPodChild) exutil.By("Create unhealthy APIService") defer unhealthyApiservice.DeleteWithoutCheck(oc) unhealthyApiservice.CreateWithoutCheck(oc) unhealthyApiservice.AssertHealthyWithConsistent(oc, "false") unhealthyApiservice.Delete(oc, unhealthyApiserviceChild) exutil.By("Create unhealthy CRD") defer unhealthyCRD.DeleteWithoutCheck(oc) unhealthyCRD.CreateWithoutCheck(oc) unhealthyCRD.AssertHealthyWithConsistent(oc, "false") unhealthyCRD.DeleteWithoutCheck(oc) exutil.By("Create unhealthy DS") defer unhealthyDS.DeleteWithoutCheck(oc) unhealthyDS.CreateWithoutCheck(oc) unhealthyDS.AssertHealthyWithConsistent(oc, "false") unhealthyDS.Delete(oc, unhealthyDSChild) }) // author: [email protected] g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-68936-cluster extension can not be installed with insufficient permission sa for operand", func() { e2e.Logf("the rukpak is deprecated, so this case is deprecated, but here use 68936 for case 75492 becasue the duration of 75492 is too long") exutil.SkipForSNOCluster(oc) var ( ns = "ns-68936" sa = "68936" baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingOperandTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-operand-clusterrole.yaml") saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, RBACObjects: []olmv1util.ChildResource{ {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}}, {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}}, {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa), fmt.Sprintf("%s-installer-clusterrole-binding", sa)}}, {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa), fmt.Sprintf("%s-installer-clusterrole", sa)}}, {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}}, }, Kinds: "okv68936s", Template: saClusterRoleBindingOperandTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-68936", Imageref: "quay.io/olmqe/nginx-ok-index:vokv68936", Template: clustercatalogTemplate, } ceInsufficient = olmv1util.ClusterExtensionDescription{ Name: "insufficient-68936", PackageName: "nginx-ok-v68936", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("check Insufficient sa from operand") defer ceInsufficient.Delete(oc) ceInsufficient.CreateWithoutCheck(oc) ceInsufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "cannot set blockOwnerDeletion", 10, 60, 0) }) // author: [email protected] g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-68937-cluster extension can not be installed with insufficient permission sa for operand rbac object", func() { e2e.Logf("the rukpak is deprecated, so this case is deprecated, but here use 68937 for case 75492 becasue the duration of 75492 is too long") exutil.SkipForSNOCluster(oc) var ( ns = "ns-68937" sa = "68937" baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingOperandTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-operand-rbac.yaml") saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, RBACObjects: []olmv1util.ChildResource{ {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}}, {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}}, {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa), fmt.Sprintf("%s-installer-clusterrole-binding", sa)}}, {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa), fmt.Sprintf("%s-installer-clusterrole", sa)}}, {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}}, }, Kinds: "okv68937s", Template: saClusterRoleBindingOperandTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-68937", Imageref: "quay.io/olmqe/nginx-ok-index:vokv68937", Template: clustercatalogTemplate, } ceInsufficient = olmv1util.ClusterExtensionDescription{ Name: "insufficient-68937", PackageName: "nginx-ok-v68937", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("check Insufficient sa from operand rbac") defer ceInsufficient.Delete(oc) ceInsufficient.CreateWithoutCheck(oc) ceInsufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "permissions not currently held", 10, 60, 0) }) // author: [email protected] g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-75492-cluster extension can not be installed with wrong sa or insufficient permission sa", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "75492" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceInsufficientName = "ce-insufficient-" + caseID ceWrongSaName = "ce-wrongsa-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-bundle.yaml") saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, RBACObjects: []olmv1util.ChildResource{ {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}}, {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}}, {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa), fmt.Sprintf("%s-installer-clusterrole-binding", sa)}}, {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa), fmt.Sprintf("%s-installer-clusterrole", sa)}}, {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}}, }, Kinds: "okv3277775492s", Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "quay.io/olmqe/nginx-ok-index:vokv3283", LabelValue: labelValue, Template: clustercatalogTemplate, } ce75492Insufficient = olmv1util.ClusterExtensionDescription{ Name: ceInsufficientName, PackageName: "nginx-ok-v3277775492", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ce75492WrongSa = olmv1util.ClusterExtensionDescription{ Name: ceWrongSaName, PackageName: "nginx-ok-v3277775492", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa + "1", LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("check Insufficient sa from bundle") defer ce75492Insufficient.Delete(oc) ce75492Insufficient.CreateWithoutCheck(oc) ce75492Insufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "could not get information about the resource CustomResourceDefinition", 10, 60, 0) exutil.By("check wrong sa") defer ce75492WrongSa.Delete(oc) ce75492WrongSa.CreateWithoutCheck(oc) ce75492WrongSa.CheckClusterExtensionCondition(oc, "Installed", "message", "not found", 10, 60, 0) }) // author: [email protected] g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-75493-cluster extension can be installed with enough permission sa", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "75493" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceSufficientName = "ce-sufficient" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-nginx-limited.yaml") saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, RBACObjects: []olmv1util.ChildResource{ {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}}, {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}}, {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa), fmt.Sprintf("%s-installer-clusterrole-binding", sa)}}, {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa), fmt.Sprintf("%s-installer-clusterrole", sa)}}, {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}}, }, Kinds: "okv3277775493s", Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "quay.io/olmqe/nginx-ok-index:vokv3283", LabelValue: labelValue, Template: clustercatalogTemplate, } ce75493 = olmv1util.ClusterExtensionDescription{ Name: ceSufficientName, PackageName: "nginx-ok-v3277775493", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("check if ce is installed with limited permission") defer ce75493.Delete(oc) ce75493.Create(oc) o.Expect(olmv1util.Appearance(oc, exutil.Appear, "customresourcedefinitions.apiextensions.k8s.io", "okv3277775493s.cache.example.com")).To(o.BeTrue()) o.Expect(olmv1util.Appearance(oc, exutil.Appear, "services", "nginx-ok-v3283-75493-controller-manager-metrics-service", "-n", ns)).To(o.BeTrue()) ce75493.Delete(oc) o.Expect(olmv1util.Appearance(oc, exutil.Disappear, "customresourcedefinitions.apiextensions.k8s.io", "okv3277775493s.cache.example.com")).To(o.BeTrue()) o.Expect(olmv1util.Appearance(oc, exutil.Disappear, "services", "nginx-ok-v3283-75493-controller-manager-metrics-service", "-n", ns)).To(o.BeTrue()) }) // author: [email protected] g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-74618-ClusterExtension supports simple registry vzero bundles only", func() { exutil.SkipForSNOCluster(oc) var ( ns = "ns-74618" sa = "sa74618" baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-74618", Imageref: "quay.io/olmqe/nginx-ok-index:vokv32777", Template: clustercatalogTemplate, } ceGVK = olmv1util.ClusterExtensionDescription{ Name: "dep-gvk-32777", PackageName: "nginx-ok-v32777gvk", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } cePKG = olmv1util.ClusterExtensionDescription{ Name: "dep-pkg-32777", PackageName: "nginx-ok-v32777pkg", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, UpgradeConstraintPolicy: "SelfCertified", SaName: sa, Template: clusterextensionTemplate, } ceCST = olmv1util.ClusterExtensionDescription{ Name: "dep-cst-32777", PackageName: "nginx-ok-v32777cst", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } ceWBH = olmv1util.ClusterExtensionDescription{ Name: "wbh-32777", PackageName: "nginx-ok-v32777wbh", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, UpgradeConstraintPolicy: "SelfCertified", SaName: sa, Template: clusterextensionTemplate, } ceNAN = olmv1util.ClusterExtensionDescription{ Name: "nan-32777", PackageName: "nginx-ok-v32777nan", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("check gvk dependency fails to be installed") defer ceGVK.Delete(oc) ceGVK.CreateWithoutCheck(oc) // WA https://issues.redhat.com/browse/OCPBUGS-36798 ceGVK.CheckClusterExtensionCondition(oc, "Progressing", "message", "has a dependency declared via property \"olm.gvk.required\" which is currently not supported", 10, 180, 0) ceGVK.Delete(oc) exutil.By("check pkg dependency fails to be installed") defer cePKG.Delete(oc) cePKG.CreateWithoutCheck(oc) // WA https://issues.redhat.com/browse/OCPBUGS-36798 cePKG.CheckClusterExtensionCondition(oc, "Progressing", "message", "has a dependency declared via property \"olm.package.required\" which is currently not supported", 10, 180, 0) cePKG.Delete(oc) exutil.By("check cst dependency fails to be installed") defer ceCST.Delete(oc) ceCST.CreateWithoutCheck(oc) // WA https://issues.redhat.com/browse/OCPBUGS-36798 ceCST.CheckClusterExtensionCondition(oc, "Progressing", "message", "has a dependency declared via property \"olm.constraint\" which is currently not supported", 10, 180, 0) ceCST.Delete(oc) exutil.By("check webhook fails to be installed") defer ceWBH.Delete(oc) ceWBH.CreateWithoutCheck(oc) ceWBH.CheckClusterExtensionCondition(oc, "Progressing", "message", "webhookDefinitions are not supported", 10, 180, 0) ceWBH.CheckClusterExtensionCondition(oc, "Installed", "reason", "Failed", 10, 180, 0) ceWBH.Delete(oc) exutil.By("check non all ns mode fails to be installed.") defer ceNAN.Delete(oc) ceNAN.CreateWithoutCheck(oc) ceNAN.CheckClusterExtensionCondition(oc, "Progressing", "message", "do not support targeting all namespaces", 10, 180, 0) ceNAN.CheckClusterExtensionCondition(oc, "Installed", "reason", "Failed", 10, 180, 0) ceNAN.Delete(oc) }) // author: [email protected] g.It("Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-76843-support disc with icsp [Disruptive]", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "76843" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceName = "ce-" + caseID iscpName = "icsp-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") icspTemplate = filepath.Join(baseDir, "icsp-single-mirror.yaml") icsp = olmv1util.IcspDescription{ Name: iscpName, Mirror: "quay.io/olmqe", Source: "qe76843.myregistry.io/olmqe", Template: icspTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "qe76843.myregistry.io/olmqe/nginx-ok-index@sha256:c613ddd68b74575d823c6f370c0941b051ea500aa4449224489f7f2cc716e712", Template: clustercatalogTemplate, } saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } ce76843 = olmv1util.ClusterExtensionDescription{ Name: ceName, PackageName: "nginx-ok-v76843", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("check if there is idms or itms") // if exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, // exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageContentSourcePolicy") { // g.Skip("skip it because there is icsp") // } if exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageDigestMirrorSet") || exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageTagMirrorSet") { g.Skip("skip it because there is itms or idms") } exutil.By("check if current mcp is healthy") if !olmv1util.HealthyMCP4OLM(oc) { g.Skip("current mcp is not healthy") } exutil.By("create icsp") defer icsp.Delete(oc) icsp.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("check ce to be installed") defer ce76843.Delete(oc) ce76843.Create(oc) }) // author: [email protected] g.It("Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-76844-support disc with itms and idms [Disruptive]", func() { exutil.SkipOnProxyCluster(oc) exutil.SkipForSNOCluster(oc) var ( caseID = "76844" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceName = "ce-" + caseID itdmsName = "itdms-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") itdmsTemplate = filepath.Join(baseDir, "itdms-full-mirror.yaml") itdms = olmv1util.ItdmsDescription{ Name: itdmsName, MirrorSite: "quay.io", SourceSite: "qe76844.myregistry.io", MirrorNamespace: "quay.io/olmqe", SourceNamespace: "qe76844.myregistry.io/olmqe", Template: itdmsTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "qe76844.myregistry.io/olmqe/nginx-ok-index:vokv76844", Template: clustercatalogTemplate, } saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } ce76844 = olmv1util.ClusterExtensionDescription{ Name: ceName, PackageName: "nginx-ok-v76844", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("check if there is icsp") if exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageContentSourcePolicy") { g.Skip("skip it because there is icsp") } // if exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, // exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageDigestMirrorSet") || // exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, // exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageTagMirrorSet") { // g.Skip("skip it because there is itms or idms") // } exutil.By("check if current mcp is healthy") if !olmv1util.HealthyMCP4OLM(oc) { g.Skip("current mcp is not healthy") } exutil.By("create itdms") defer itdms.Delete(oc) itdms.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("check ce to be installed") defer ce76844.Delete(oc) ce76844.Create(oc) }) // author: [email protected] g.It("Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-78193-Runtime validation of container images using sigstore signatures [Disruptive]", func() { if !exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "crd", "clusterimagepolicies.config.openshift.io") { g.Skip("skip it because there is no ClusterImagePolicy") } architecture.SkipNonAmd64SingleArch(oc) exutil.SkipForSNOCluster(oc) var ( caseID = "78193" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID catalog1Name = "clustercatalog-" + caseID + "1" ceName = "ce-" + caseID cipName = "cip-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") cipTemplate = filepath.Join(baseDir, "cip.yaml") cip = olmv1util.CipDescription{ Name: cipName, Repo1: "quay.io/olmqe/nginx-ok-bundle-sigstore", Repo2: "quay.io/olmqe/nginx-ok-bundle-sigstore1", Repo3: "quay.io/olmqe/nginx-ok-index-sigstore", Repo4: "quay.io/olmqe/nginx-ok-index-sigstore1", Template: cipTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "quay.io/olmqe/nginx-ok-index-sigstore:vokv78193", Template: clustercatalogTemplate, } clustercatalog1 = olmv1util.ClusterCatalogDescription{ Name: catalog1Name, Imageref: "quay.io/olmqe/nginx-ok-index-sigstore1:vokv781931", Template: clustercatalogTemplate, } saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } ce = olmv1util.ClusterExtensionDescription{ Name: ceName, PackageName: "nginx-ok-v78193", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("check if current mcp is healthy") if !olmv1util.HealthyMCP4OLM(oc) { g.Skip("current mcp is not healthy") } exutil.By("create cip") defer cip.Delete(oc) cip.Create(oc) exutil.By("Create clustercatalog with olmsigkey signed successfully") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension with olmsigkey signed successfully") defer ce.Delete(oc) ce.Create(oc) exutil.By("Create clustercatalog with olmsigkey1 signed failed") defer clustercatalog1.Delete(oc) clustercatalog1.CreateWithoutCheck(oc) clustercatalog1.CheckClusterCatalogCondition(oc, "Progressing", "message", "signature verification failed: invalid signature", 10, 90, 0) }) // author: [email protected] g.It("Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-78300-validation of container images using sigstore signatures with different policy [Disruptive]", func() { if !exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "crd", "clusterimagepolicies.config.openshift.io") { g.Skip("skip it because there is no ClusterImagePolicy") } exutil.SkipForSNOCluster(oc) var ( caseID = "781932" ns = "ns-" + caseID sa = "sa" + caseID imageRef = "quay.io/olmqe/nginx-ok-index-sigstore:vokv" + caseID packageName = "nginx-ok-v" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceName = "ce-" + caseID cipName = "cip-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") cipTemplate = filepath.Join(baseDir, "cip.yaml") cip = olmv1util.CipDescription{ Name: cipName, Repo1: "quay.io/olmqe/nginx-ok-bundle-sigstore", Repo2: "quay.io/olmqe/nginx-ok-bundle-sigstore1", Repo3: "quay.io/olmqe/nginx-ok-index-sigstore", Repo4: "quay.io/olmqe/nginx-ok-index-sigstore1", Policy: "MatchRepository", Template: cipTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: imageRef, Template: clustercatalogTemplate, } saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } ce = olmv1util.ClusterExtensionDescription{ Name: ceName, PackageName: packageName, Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("check if current mcp is healthy") if !olmv1util.HealthyMCP4OLM(oc) { g.Skip("current mcp is not healthy") } exutil.By("create cip") defer cip.Delete(oc) cip.Create(oc) exutil.By("Create clustercatalog with olmsigkey signed successfully") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension with olmsigkey signed successfully") defer ce.Delete(oc) ce.Create(oc) }) // author: [email protected] g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-76983-install index and bundle from private image", func() { exutil.SkipForSNOCluster(oc) // note: 1, it depends the default global secret to access private index and bundle in quay.io var ( caseID = "76983" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceName = "ce-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "quay.io/olmqe/nginx-ok-index-private:vokv76983", Template: clustercatalogTemplate, } saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } ce = olmv1util.ClusterExtensionDescription{ Name: ceName, PackageName: "nginx-ok-v76983", // private bundle quay.io/olmqe/nginx-ok-bundle-private:v76983-0.0.1 Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("check if there is global secret and it includes token to access quay.io") if !exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "secret/pull-secret", "-n", "openshift-config") { g.Skip("skip it because there is no global secret") } output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("secret/pull-secret", "-n", "openshift-config", `--template={{index .data ".dockerconfigjson" | base64decode}}`).Output() if err != nil { e2e.Failf("can not get data of global secret ") } if !strings.Contains(output, "quay.io/olmqe") { g.Skip("skip it becuse of no token for test") } exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("check ce to be installed") defer ce.Delete(oc) ce.Create(oc) }) // author: [email protected] g.It("Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-76985-authfile is updated automatically [Disruptive].", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "76985" ) exutil.By("check if there is global secret") if !exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "secret/pull-secret", "-n", "openshift-config") { g.Skip("skip it because there is no global secret") } exutil.By("check if current mcp is healthy") if !olmv1util.HealthyMCP4OLM(oc) { g.Skip("current mcp is not healthy") } exutil.By("set gobal secret") dirname := "/tmp/" + caseID + "-globalsecretdir" err := os.MkdirAll(dirname, 0777) o.Expect(err).NotTo(o.HaveOccurred()) defer os.RemoveAll(dirname) err = oc.AsAdmin().WithoutNamespace().Run("extract").Args("secret/pull-secret", "-n", "openshift-config", "--to="+dirname, "--confirm").Execute() o.Expect(err).NotTo(o.HaveOccurred()) newAuthCmd := fmt.Sprintf(`cat %s/.dockerconfigjson | jq '.auths["fake.registry"] |= . + {"auth":"faketoken=="}' > %s/newdockerconfigjson`, dirname, dirname) _, err = exec.Command("bash", "-c", newAuthCmd).Output() o.Expect(err).NotTo(o.HaveOccurred()) err = oc.AsAdmin().WithoutNamespace().Run("set").Args("data", "secret/pull-secret", "-n", "openshift-config", "--from-file=.dockerconfigjson="+dirname+"/newdockerconfigjson").Execute() o.Expect(err).NotTo(o.HaveOccurred()) defer func() { err = oc.AsAdmin().WithoutNamespace().Run("set").Args("data", "secret/pull-secret", "-n", "openshift-config", "--from-file=.dockerconfigjson="+dirname+"/.dockerconfigjson").Execute() o.Expect(err).NotTo(o.HaveOccurred()) olmv1util.AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 120, 1) olmv1util.AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 120, 1) olmv1util.AssertMCPCondition(oc, "master", "Updating", "status", "False", 30, 600, 20) olmv1util.AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 600, 20) o.Expect(olmv1util.HealthyMCP4OLM(oc)).To(o.BeTrue()) }() olmv1util.AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 120, 1) olmv1util.AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 120, 1) olmv1util.AssertMCPCondition(oc, "master", "Updating", "status", "False", 30, 600, 20) olmv1util.AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 600, 20) o.Expect(olmv1util.HealthyMCP4OLM(oc)).To(o.BeTrue()) exutil.By("check if auth is updated for catalogd") catalogDPod, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", "control-plane=catalogd-controller-manager", "-o=jsonpath={.items[0].metadata.name}", "-n", "openshift-catalogd").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(catalogDPod).NotTo(o.BeEmpty()) // avoid to use oc.xx.Output to avoid possible sensitive information leak. checkAuthCmdCatalogd := `grep -q "fake.registry" /tmp/catalogd-global-pull-secret-*.json` finalArgsCatalogd := []string{ "--kubeconfig=" + exutil.KubeConfigPath(), "exec", "-n", "openshift-catalogd", catalogDPod, "--", "bash", "-c", checkAuthCmdCatalogd, } e2e.Logf("cmdCatalogd: %v", "oc"+" "+strings.Join(finalArgsCatalogd, " ")) cmdCatalogd := exec.Command("oc", finalArgsCatalogd...) _, err = cmdCatalogd.CombinedOutput() // please do not print output because it is possible to leak sensitive information o.Expect(err).NotTo(o.HaveOccurred(), "auth for catalogd is not updated") exutil.By("check if auth is updated for operator-controller") operatorControlerPod, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", "control-plane=operator-controller-controller-manager", "-o=jsonpath={.items[0].metadata.name}", "-n", "openshift-operator-controller").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(operatorControlerPod).NotTo(o.BeEmpty()) // avoid to use oc.xx.Output to avoid possible sensitive information leak. checkAuthCmdOperatorController := `grep -q "registry" /tmp/operator-controller-global-pull-secrets-*.json` finalArgsOperatorController := []string{ "--kubeconfig=" + exutil.KubeConfigPath(), "exec", "-n", "openshift-operator-controller", operatorControlerPod, "--", "bash", "-c", checkAuthCmdOperatorController, } e2e.Logf("cmdOperatorController: %v", "oc"+" "+strings.Join(finalArgsOperatorController, " ")) cmdOperatorController := exec.Command("oc", finalArgsOperatorController...) _, err = cmdOperatorController.CombinedOutput() // please do not print output because it is possible to leak sensitive information o.Expect(err).NotTo(o.HaveOccurred(), "auth for operator-controller is not updated") }) // author: [email protected] g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-68821-olmv1 Supports Version Ranges during Installation", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") clusterextensionWithoutChannelTemplate = filepath.Join(baseDir, "clusterextensionWithoutChannel.yaml") clusterextensionWithoutChannelVersionTemplate = filepath.Join(baseDir, "clusterextensionWithoutChannelVersion.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", 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", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.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) exutil.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) exutil.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) exutil.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) exutil.By("Create clusterextension with invalid version") clusterextension.Version = "!1.0.1" clusterextension.Template = clusterextensionTemplate err = clusterextension.CreateWithoutCheck(oc) o.Expect(err).To(o.HaveOccurred()) }) // author: [email protected] g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-69196-olmv1 Supports Version Ranges during clusterextension upgrade", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.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", 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, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.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")) exutil.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") } exutil.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") } }) // author: [email protected] g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-74108-olm v1 supports legacy upgrade edges", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextensionWithoutVersion.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", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-74108", InstallNamespace: ns, PackageName: "nginx74108", Channel: "candidate-v0.0", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("1) Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.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")) exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") }) // author: [email protected] g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-74923-no two ClusterExtensions can manage the same underlying object", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextensionWithoutChannelVersion.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", Template: clustercatalogTemplate, } clusterextension1 = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-74923-1", PackageName: "nginx74923", InstallNamespace: ns1, SaName: sa1, Template: clusterextensionTemplate, } clusterextension2 = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-74923-2", PackageName: "nginx74923", InstallNamespace: ns2, SaName: sa2, Template: clusterextensionTemplate, } ) exutil.By("1. Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("2. Create clusterextension1") exutil.By("2.1 Create namespace 1") defer 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()) exutil.By("2.2 Create SA for clusterextension1") defer saCrb1.Delete(oc) saCrb1.Create(oc) exutil.By("2.3 Create clusterextension1") defer clusterextension1.Delete(oc) clusterextension1.Create(oc) o.Expect(clusterextension1.InstalledBundle).To(o.ContainSubstring("v1.0.2")) exutil.By("3 Create clusterextension2") exutil.By("3.1 Create namespace 2") defer 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()) exutil.By("3.2 Create SA for clusterextension2") defer saCrb2.Delete(oc) saCrb2.Create(oc) exutil.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(status) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "crd nginxolm74923s.cache.example.com is not deleted") exutil.By("4 Create crd") crdFilePath := filepath.Join(baseDir, "crd-nginxolm74923.yaml") defer 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(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") }) // author: [email protected] g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-Medium-75501-the updates of various status fields is orthogonal", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.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", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-75501", InstallNamespace: ns, PackageName: "nginx75501", Channel: "candidate-v2.1", Version: "2.1.0", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.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) exutil.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, "error resolving canonical reference") { 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) exutil.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) exutil.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") } }) // author: [email protected] g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-76685-olm v1 supports selecting catalogs", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") 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, } ) exutil.By("1) Create namespace, sa, clustercatalog1 and clustercatalog2") defer 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) exutil.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) exutil.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) exutil.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) exutil.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") exutil.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) exutil.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") exutil.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") }) // author: [email protected] g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-77972-olm v1 Supports MaxOCPVersion in properties file", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextensionWithoutChannel.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: "ocp-77972", 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", Template: clusterextensionTemplate, } ) exutil.By("1) Create namespace, sa, clustercatalog1 and clustercatalog2") defer 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) exutil.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")) exutil.By("3) upgrade clusterextension to 0.1.0, olm.maxOpenShiftVersion is 4.17") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"0.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.v0.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") exutil.By("4) upgrade clusterextension to 1.0.0, olm.maxOpenShiftVersion is 4.18") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"1.0.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.0.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") exutil.By("5) 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") exutil.By("6) 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) { status, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].status}`) if strings.Contains(status, "True") { e2e.Logf("status is %s", status) return true, nil } return false, nil }) message, _ = olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].message}`) o.Expect(message).To(o.ContainSubstring("All is well")) if errWait != nil { olmv1util.GetNoEmpty(oc, "co", "olm", "-o=jsonpath-as-json={.status.conditions}") } exutil.AssertWaitPollNoErr(errWait, "Upgradeable is not True") }) // author: [email protected] g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-78393-support metrics", func() { var metricsMsg string exutil.By("Get token") catalogPodname, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "--selector=app=catalog-operator", "-o=jsonpath={.items..metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(catalogPodname).NotTo(o.BeEmpty()) 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()) exutil.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()) queryContent := "https://" + promeEp + ":7443/metrics" errWait := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { metricsMsg, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", catalogPodname, "-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.") } exutil.By("ClusterRole/openshift-state-metrics has no rule to get the catalogd metrics") metricsMsg, _ = oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", catalogPodname, "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", wrongToken), queryContent).Output() o.Expect(metricsMsg).To(o.ContainSubstring("Authorization denied")) exutil.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().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", catalogPodname, "-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.") } exutil.By("ClusterRole/openshift-state-metrics has no rule to get the operator-controller metrics") metricsMsg, _ = oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", catalogPodname, "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", wrongToken), queryContent).Output() o.Expect(metricsMsg).To(o.ContainSubstring("Authorization denied")) }) g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-79770-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] exutil.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(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(statusAll) o.Expect(status).To(o.Equal("up")) } exutil.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(queryResult1) o.Expect(queryResult1).To(o.ContainSubstring("value")) query2 := `query=controller_runtime_reconcile_total{controller="clusterextension",result="success"}` queryResult2, _ := oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-monitoring", k8sPodname, "--", "curl", "-G", "--data-urlencode", query2, queryUrl).Output() e2e.Logf(queryResult2) o.Expect(queryResult2).To(o.ContainSubstring("value")) exutil.By("3) test SUCCESS") }) // author: [email protected] g.It("Author:bandrade-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-High-69193-olmv1 major version zero", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-69193" sa = "sa69193" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-69193", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm69193", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-69193", InstallNamespace: ns, PackageName: "nginx69193", Channel: "candidate-v0.0", Version: "0.0.1", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("1) Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("2) Install version 0.0.1") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("0.0.1")) exutil.By("3) Attempt to update to version 0.0.2 with CatalogProvided policy, that should fail") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version": "0.0.2"}}}}`) /* 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, "constraints not satisfiable") { e2e.Logf("status is %s", message) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx69193 0.0.2 should not be installed") exutil.By("4) change UpgradeConstraintPolicy to be SelfCertified, that should work") clusterextension.Patch(oc, `{"spec":{"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, "0.0.2") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx69193 0.0.2 is not installed") clusterextension.Delete(oc) exutil.By("5) Install version 0.1.0 with CatalogProvided policy, that should work") clusterextension.Channel = "candidate-v0.1" clusterextension.Version = "0.1.0" clusterextension.UpgradeConstraintPolicy = "CatalogProvided" clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("0.1.0")) exutil.By("6) Attempt to update to version 0.2.0 with CatalogProvided policy, that should fail") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"0.2.0","channels":["candidate-v0.2"]}}}}`) 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, "error upgrading") { e2e.Logf("status is %s", message) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx69193 0.2.0 should not be installed") exutil.By("7) Install version 0.2.0 with SelfCertified policy, that should work") 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, "0.2.0") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx69193 0.2.0 is not installed") exutil.By("8) Install version 0.2.2 with CatalogProvided policy, that should work") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"upgradeConstraintPolicy": "CatalogProvided"}}}}`) clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version": "0.2.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, "0.2.2") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx69193 0.2.2 is not installed") }) // author: [email protected] g.It("Author:bandrade-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-High-70719-olmv1 Upgrade non-zero major version", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-70719" sa = "sa70719" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-70719", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm70719", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-70719", InstallNamespace: ns, PackageName: "nginx70719", Channel: "candidate-v0", Version: "0.2.2", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("1) Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("2) Install version 0.2.2") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("0.2.2")) exutil.By("3) Attempt to update to version 1.0.0 with CatalogProvided policy, that should fail") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels":["candidate-v1"], "version":"1.0.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, "error upgrading") { e2e.Logf("status is %s", message) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 1.0.0 should not be installed") exutil.By("4) change UpgradeConstraintPolicy to be SelfCertified, that should work") 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.0") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 1.0.0 is not installed") exutil.By("5) change UpgradeConstraintPolicy to be CatalogProvided, attempt to update to version 1.0.1, that should work") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"upgradeConstraintPolicy": "CatalogProvided"}}}}`) 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) { clusterextension.GetBundleResource(oc) if !strings.Contains(clusterextension.InstalledBundle, "1.0.1") { e2e.Logf("ResolvedBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 1.0.1 is not installed") exutil.By("6) attempt to update to version 1.2.1, that should work") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version": "1.2.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.2.1") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 1.2.1 is not installed") exutil.By("7) Attempt to update to version 2.0.0 with CatalogProvided policy, that should fail") 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) { message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.conditions[*].message}") if !strings.Contains(message, "installed package nginx70719 requires at least one of") { e2e.Logf("status is %s", message) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 2.0.0 should not be installed") exutil.By("8) Install version 2.0.0 with SelfCertified policy, that should work") clusterextension.Patch(oc, `{"spec":{"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, "2.0.0") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 2.0.0 is not installed") }) // author: [email protected] g.It("Author:bandrade-ConnectedOnly-NonHyperShiftHOST-High-70723-olmv1 downgrade version", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-70723" sa = "sa70723" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-70723", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm70723", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-70723", InstallNamespace: ns, PackageName: "nginx70723", Channel: "candidate-v2", Version: "2.2.1", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("1) Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("2) Install version 2.2.1") clusterextension.Create(oc) defer clusterextension.Delete(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("2.2.1")) exutil.By("3) Attempt to downgrade to version 2.0.0 with CatalogProvided policy, that should fail") 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) { message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.conditions[*].message}") if !strings.Contains(message, "error upgrading") { e2e.Logf("message is %s", message) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70723 2.0.0 should not be installed") exutil.By("4) change UpgradeConstraintPolicy to be SelfCertified, that should work") 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, "2.0.0") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70723 2.0.0 is not installed") }) // author: [email protected] g.It("Author:bandrade-NonHyperShiftHOST-Medium-75877-Make sure that rukpak is removed from payload", func() { exutil.By("1) Check if bundledeployments.core.rukpak.io CRD is not installed") _, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("crd", "bundledeployments.core.rukpak.io").Output() o.Expect(err).To(o.HaveOccurred()) exutil.By("2) Check if openshift-rukpak is not created") _, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("ns", "openshift-rukpak").Output() o.Expect(err).To(o.HaveOccurred()) }) // author: [email protected] g.It("Author:bandrade-ConnectedOnly-NonHyperShiftHOST-Medium-77413-Check if ClusterCatalog is in Serving properly", func() { exutil.By("1) Check the status of each one, all of them should be in with the Serving state") newCheck("expect", asAdmin, withoutNamespace, contain, "True", ok, []string{"clustercatalog", "openshift-certified-operators", "-o=jsonpath={.status.conditions[?(@.type==\"Serving\")].status}"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, contain, "True", ok, []string{"clustercatalog", "openshift-community-operators", "-o=jsonpath={.status.conditions[?(@.type==\"Serving\")].status}"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, contain, "True", ok, []string{"clustercatalog", "openshift-redhat-operators", "-o=jsonpath={.status.conditions[?(@.type==\"Serving\")].status}"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, contain, "True", ok, []string{"clustercatalog", "openshift-redhat-marketplace", "-o=jsonpath={.status.conditions[?(@.type==\"Serving\")].status}"}).check(oc) }) })
package operators
test case
openshift/openshift-tests-private
a5991728-5dc9-42a2-8f45-4602988dff39
Author:kuiwang-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-Medium-68903-BundleDeployment Health resource unhealthy pod api crd ds
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-Medium-68903-BundleDeployment Health resource unhealthy pod api crd ds", func() { // oc.SetupProject() // it is example if the case need temp project. here it does not need it, so comment it. var ( ns = "ns-68903" baseDir = exutil.FixturePath("testdata", "olm", "v1") basicBdPlainImageTemplate = filepath.Join(baseDir, "basic-bd-plain-image.yaml") unhealthyPod = olmv1util.BundleDeploymentDescription{ BdName: "68903-pod-unhealthy", Address: "quay.io/olmqe/olmv1bundle:plain-68903-podunhealthy", Namespace: ns, Template: basicBdPlainImageTemplate, } unhealthyPodChild = []olmv1util.ChildResource{ {Kind: "namespace", Ns: ""}, } unhealthyApiservice = olmv1util.BundleDeploymentDescription{ BdName: "68903-apis-unhealthy", Address: "quay.io/olmqe/olmv1bundle:plain-68903-apisunhealthy", Namespace: ns, Template: basicBdPlainImageTemplate, } unhealthyApiserviceChild = []olmv1util.ChildResource{ {Kind: "APIService", Ns: ""}, } unhealthyCRD = olmv1util.BundleDeploymentDescription{ BdName: "68903-crd-unhealthy", Address: "quay.io/olmqe/olmv1bundle:plain-68903-crdunhealthy", Namespace: ns, Template: basicBdPlainImageTemplate, } unhealthyDS = olmv1util.BundleDeploymentDescription{ BdName: "68903-ds-unhealthy", Address: "quay.io/olmqe/olmv1bundle:plain-68903-dsunhealthy", Namespace: ns, Template: basicBdPlainImageTemplate, } unhealthyDSChild = []olmv1util.ChildResource{ {Kind: "namespace", Ns: ""}, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create unhealthy pod") defer unhealthyPod.DeleteWithoutCheck(oc) unhealthyPod.CreateWithoutCheck(oc) unhealthyPod.AssertHealthyWithConsistent(oc, "false") unhealthyPod.Delete(oc, unhealthyPodChild) exutil.By("Create unhealthy APIService") defer unhealthyApiservice.DeleteWithoutCheck(oc) unhealthyApiservice.CreateWithoutCheck(oc) unhealthyApiservice.AssertHealthyWithConsistent(oc, "false") unhealthyApiservice.Delete(oc, unhealthyApiserviceChild) exutil.By("Create unhealthy CRD") defer unhealthyCRD.DeleteWithoutCheck(oc) unhealthyCRD.CreateWithoutCheck(oc) unhealthyCRD.AssertHealthyWithConsistent(oc, "false") unhealthyCRD.DeleteWithoutCheck(oc) exutil.By("Create unhealthy DS") defer unhealthyDS.DeleteWithoutCheck(oc) unhealthyDS.CreateWithoutCheck(oc) unhealthyDS.AssertHealthyWithConsistent(oc, "false") unhealthyDS.Delete(oc, unhealthyDSChild) })
test case
openshift/openshift-tests-private
e7ffff09-113e-4ffb-a4e9-605c7e87b067
Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-68936-cluster extension can not be installed with insufficient permission sa for operand
['"fmt"', '"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-68936-cluster extension can not be installed with insufficient permission sa for operand", func() { e2e.Logf("the rukpak is deprecated, so this case is deprecated, but here use 68936 for case 75492 becasue the duration of 75492 is too long") exutil.SkipForSNOCluster(oc) var ( ns = "ns-68936" sa = "68936" baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingOperandTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-operand-clusterrole.yaml") saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, RBACObjects: []olmv1util.ChildResource{ {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}}, {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}}, {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa), fmt.Sprintf("%s-installer-clusterrole-binding", sa)}}, {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa), fmt.Sprintf("%s-installer-clusterrole", sa)}}, {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}}, }, Kinds: "okv68936s", Template: saClusterRoleBindingOperandTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-68936", Imageref: "quay.io/olmqe/nginx-ok-index:vokv68936", Template: clustercatalogTemplate, } ceInsufficient = olmv1util.ClusterExtensionDescription{ Name: "insufficient-68936", PackageName: "nginx-ok-v68936", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("check Insufficient sa from operand") defer ceInsufficient.Delete(oc) ceInsufficient.CreateWithoutCheck(oc) ceInsufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "cannot set blockOwnerDeletion", 10, 60, 0) })
test case
openshift/openshift-tests-private
bef8326d-2230-4961-9b83-b5cb2b8393ab
Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-68937-cluster extension can not be installed with insufficient permission sa for operand rbac object
['"fmt"', '"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-68937-cluster extension can not be installed with insufficient permission sa for operand rbac object", func() { e2e.Logf("the rukpak is deprecated, so this case is deprecated, but here use 68937 for case 75492 becasue the duration of 75492 is too long") exutil.SkipForSNOCluster(oc) var ( ns = "ns-68937" sa = "68937" baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingOperandTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-operand-rbac.yaml") saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, RBACObjects: []olmv1util.ChildResource{ {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}}, {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}}, {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa), fmt.Sprintf("%s-installer-clusterrole-binding", sa)}}, {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa), fmt.Sprintf("%s-installer-clusterrole", sa)}}, {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}}, }, Kinds: "okv68937s", Template: saClusterRoleBindingOperandTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-68937", Imageref: "quay.io/olmqe/nginx-ok-index:vokv68937", Template: clustercatalogTemplate, } ceInsufficient = olmv1util.ClusterExtensionDescription{ Name: "insufficient-68937", PackageName: "nginx-ok-v68937", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("check Insufficient sa from operand rbac") defer ceInsufficient.Delete(oc) ceInsufficient.CreateWithoutCheck(oc) ceInsufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "permissions not currently held", 10, 60, 0) })
test case
openshift/openshift-tests-private
d31f914c-d04d-4fc9-a5d7-fc72f3045f68
Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-75492-cluster extension can not be installed with wrong sa or insufficient permission sa
['"fmt"', '"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-75492-cluster extension can not be installed with wrong sa or insufficient permission sa", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "75492" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceInsufficientName = "ce-insufficient-" + caseID ceWrongSaName = "ce-wrongsa-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-nginx-insufficient-bundle.yaml") saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, RBACObjects: []olmv1util.ChildResource{ {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}}, {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}}, {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa), fmt.Sprintf("%s-installer-clusterrole-binding", sa)}}, {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa), fmt.Sprintf("%s-installer-clusterrole", sa)}}, {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}}, }, Kinds: "okv3277775492s", Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "quay.io/olmqe/nginx-ok-index:vokv3283", LabelValue: labelValue, Template: clustercatalogTemplate, } ce75492Insufficient = olmv1util.ClusterExtensionDescription{ Name: ceInsufficientName, PackageName: "nginx-ok-v3277775492", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ce75492WrongSa = olmv1util.ClusterExtensionDescription{ Name: ceWrongSaName, PackageName: "nginx-ok-v3277775492", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa + "1", LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("check Insufficient sa from bundle") defer ce75492Insufficient.Delete(oc) ce75492Insufficient.CreateWithoutCheck(oc) ce75492Insufficient.CheckClusterExtensionCondition(oc, "Progressing", "message", "could not get information about the resource CustomResourceDefinition", 10, 60, 0) exutil.By("check wrong sa") defer ce75492WrongSa.Delete(oc) ce75492WrongSa.CreateWithoutCheck(oc) ce75492WrongSa.CheckClusterExtensionCondition(oc, "Installed", "message", "not found", 10, 60, 0) })
test case
openshift/openshift-tests-private
0b1efeb2-d465-4c92-8eca-edb6d5e9b643
Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-75493-cluster extension can be installed with enough permission sa
['"fmt"', '"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-75493-cluster extension can be installed with enough permission sa", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "75493" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceSufficientName = "ce-sufficient" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog-withlabel.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension-withselectorlabel.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-nginx-limited.yaml") saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, RBACObjects: []olmv1util.ChildResource{ {Kind: "RoleBinding", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role-binding", sa)}}, {Kind: "Role", Ns: ns, Names: []string{fmt.Sprintf("%s-installer-role", sa)}}, {Kind: "ClusterRoleBinding", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole-binding", sa), fmt.Sprintf("%s-installer-clusterrole-binding", sa)}}, {Kind: "ClusterRole", Ns: "", Names: []string{fmt.Sprintf("%s-installer-rbac-clusterrole", sa), fmt.Sprintf("%s-installer-clusterrole", sa)}}, {Kind: "ServiceAccount", Ns: ns, Names: []string{sa}}, }, Kinds: "okv3277775493s", Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "quay.io/olmqe/nginx-ok-index:vokv3283", LabelValue: labelValue, Template: clustercatalogTemplate, } ce75493 = olmv1util.ClusterExtensionDescription{ Name: ceSufficientName, PackageName: "nginx-ok-v3277775493", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found", "--force").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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("check if ce is installed with limited permission") defer ce75493.Delete(oc) ce75493.Create(oc) o.Expect(olmv1util.Appearance(oc, exutil.Appear, "customresourcedefinitions.apiextensions.k8s.io", "okv3277775493s.cache.example.com")).To(o.BeTrue()) o.Expect(olmv1util.Appearance(oc, exutil.Appear, "services", "nginx-ok-v3283-75493-controller-manager-metrics-service", "-n", ns)).To(o.BeTrue()) ce75493.Delete(oc) o.Expect(olmv1util.Appearance(oc, exutil.Disappear, "customresourcedefinitions.apiextensions.k8s.io", "okv3277775493s.cache.example.com")).To(o.BeTrue()) o.Expect(olmv1util.Appearance(oc, exutil.Disappear, "services", "nginx-ok-v3283-75493-controller-manager-metrics-service", "-n", ns)).To(o.BeTrue()) })
test case
openshift/openshift-tests-private
f3dd6daf-287d-4f77-8b90-34075950c578
Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-74618-ClusterExtension supports simple registry vzero bundles only
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-74618-ClusterExtension supports simple registry vzero bundles only", func() { exutil.SkipForSNOCluster(oc) var ( ns = "ns-74618" sa = "sa74618" baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-74618", Imageref: "quay.io/olmqe/nginx-ok-index:vokv32777", Template: clustercatalogTemplate, } ceGVK = olmv1util.ClusterExtensionDescription{ Name: "dep-gvk-32777", PackageName: "nginx-ok-v32777gvk", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } cePKG = olmv1util.ClusterExtensionDescription{ Name: "dep-pkg-32777", PackageName: "nginx-ok-v32777pkg", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, UpgradeConstraintPolicy: "SelfCertified", SaName: sa, Template: clusterextensionTemplate, } ceCST = olmv1util.ClusterExtensionDescription{ Name: "dep-cst-32777", PackageName: "nginx-ok-v32777cst", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } ceWBH = olmv1util.ClusterExtensionDescription{ Name: "wbh-32777", PackageName: "nginx-ok-v32777wbh", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, UpgradeConstraintPolicy: "SelfCertified", SaName: sa, Template: clusterextensionTemplate, } ceNAN = olmv1util.ClusterExtensionDescription{ Name: "nan-32777", PackageName: "nginx-ok-v32777nan", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("check gvk dependency fails to be installed") defer ceGVK.Delete(oc) ceGVK.CreateWithoutCheck(oc) // WA https://issues.redhat.com/browse/OCPBUGS-36798 ceGVK.CheckClusterExtensionCondition(oc, "Progressing", "message", "has a dependency declared via property \"olm.gvk.required\" which is currently not supported", 10, 180, 0) ceGVK.Delete(oc) exutil.By("check pkg dependency fails to be installed") defer cePKG.Delete(oc) cePKG.CreateWithoutCheck(oc) // WA https://issues.redhat.com/browse/OCPBUGS-36798 cePKG.CheckClusterExtensionCondition(oc, "Progressing", "message", "has a dependency declared via property \"olm.package.required\" which is currently not supported", 10, 180, 0) cePKG.Delete(oc) exutil.By("check cst dependency fails to be installed") defer ceCST.Delete(oc) ceCST.CreateWithoutCheck(oc) // WA https://issues.redhat.com/browse/OCPBUGS-36798 ceCST.CheckClusterExtensionCondition(oc, "Progressing", "message", "has a dependency declared via property \"olm.constraint\" which is currently not supported", 10, 180, 0) ceCST.Delete(oc) exutil.By("check webhook fails to be installed") defer ceWBH.Delete(oc) ceWBH.CreateWithoutCheck(oc) ceWBH.CheckClusterExtensionCondition(oc, "Progressing", "message", "webhookDefinitions are not supported", 10, 180, 0) ceWBH.CheckClusterExtensionCondition(oc, "Installed", "reason", "Failed", 10, 180, 0) ceWBH.Delete(oc) exutil.By("check non all ns mode fails to be installed.") defer ceNAN.Delete(oc) ceNAN.CreateWithoutCheck(oc) ceNAN.CheckClusterExtensionCondition(oc, "Progressing", "message", "do not support targeting all namespaces", 10, 180, 0) ceNAN.CheckClusterExtensionCondition(oc, "Installed", "reason", "Failed", 10, 180, 0) ceNAN.Delete(oc) })
test case
openshift/openshift-tests-private
5802e4d7-57ec-419c-96fd-7a31933492b7
Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-76843-support disc with icsp [Disruptive]
['"path/filepath"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-76843-support disc with icsp [Disruptive]", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "76843" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceName = "ce-" + caseID iscpName = "icsp-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") icspTemplate = filepath.Join(baseDir, "icsp-single-mirror.yaml") icsp = olmv1util.IcspDescription{ Name: iscpName, Mirror: "quay.io/olmqe", Source: "qe76843.myregistry.io/olmqe", Template: icspTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "qe76843.myregistry.io/olmqe/nginx-ok-index@sha256:c613ddd68b74575d823c6f370c0941b051ea500aa4449224489f7f2cc716e712", Template: clustercatalogTemplate, } saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } ce76843 = olmv1util.ClusterExtensionDescription{ Name: ceName, PackageName: "nginx-ok-v76843", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("check if there is idms or itms") // if exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, // exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageContentSourcePolicy") { // g.Skip("skip it because there is icsp") // } if exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageDigestMirrorSet") || exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageTagMirrorSet") { g.Skip("skip it because there is itms or idms") } exutil.By("check if current mcp is healthy") if !olmv1util.HealthyMCP4OLM(oc) { g.Skip("current mcp is not healthy") } exutil.By("create icsp") defer icsp.Delete(oc) icsp.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("check ce to be installed") defer ce76843.Delete(oc) ce76843.Create(oc) })
test case
openshift/openshift-tests-private
d94259ce-119b-46c8-b9b7-75df24b104ff
Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-76844-support disc with itms and idms [Disruptive]
['"path/filepath"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-76844-support disc with itms and idms [Disruptive]", func() { exutil.SkipOnProxyCluster(oc) exutil.SkipForSNOCluster(oc) var ( caseID = "76844" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceName = "ce-" + caseID itdmsName = "itdms-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") itdmsTemplate = filepath.Join(baseDir, "itdms-full-mirror.yaml") itdms = olmv1util.ItdmsDescription{ Name: itdmsName, MirrorSite: "quay.io", SourceSite: "qe76844.myregistry.io", MirrorNamespace: "quay.io/olmqe", SourceNamespace: "qe76844.myregistry.io/olmqe", Template: itdmsTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "qe76844.myregistry.io/olmqe/nginx-ok-index:vokv76844", Template: clustercatalogTemplate, } saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } ce76844 = olmv1util.ClusterExtensionDescription{ Name: ceName, PackageName: "nginx-ok-v76844", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("check if there is icsp") if exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageContentSourcePolicy") { g.Skip("skip it because there is icsp") } // if exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, // exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageDigestMirrorSet") || // exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, // exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "ImageTagMirrorSet") { // g.Skip("skip it because there is itms or idms") // } exutil.By("check if current mcp is healthy") if !olmv1util.HealthyMCP4OLM(oc) { g.Skip("current mcp is not healthy") } exutil.By("create itdms") defer itdms.Delete(oc) itdms.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("check ce to be installed") defer ce76844.Delete(oc) ce76844.Create(oc) })
test case
openshift/openshift-tests-private
ffe2950b-1411-4958-b50f-a90bba16f81e
Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-78193-Runtime validation of container images using sigstore signatures [Disruptive]
['"path/filepath"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-78193-Runtime validation of container images using sigstore signatures [Disruptive]", func() { if !exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "crd", "clusterimagepolicies.config.openshift.io") { g.Skip("skip it because there is no ClusterImagePolicy") } architecture.SkipNonAmd64SingleArch(oc) exutil.SkipForSNOCluster(oc) var ( caseID = "78193" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID catalog1Name = "clustercatalog-" + caseID + "1" ceName = "ce-" + caseID cipName = "cip-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") cipTemplate = filepath.Join(baseDir, "cip.yaml") cip = olmv1util.CipDescription{ Name: cipName, Repo1: "quay.io/olmqe/nginx-ok-bundle-sigstore", Repo2: "quay.io/olmqe/nginx-ok-bundle-sigstore1", Repo3: "quay.io/olmqe/nginx-ok-index-sigstore", Repo4: "quay.io/olmqe/nginx-ok-index-sigstore1", Template: cipTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "quay.io/olmqe/nginx-ok-index-sigstore:vokv78193", Template: clustercatalogTemplate, } clustercatalog1 = olmv1util.ClusterCatalogDescription{ Name: catalog1Name, Imageref: "quay.io/olmqe/nginx-ok-index-sigstore1:vokv781931", Template: clustercatalogTemplate, } saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } ce = olmv1util.ClusterExtensionDescription{ Name: ceName, PackageName: "nginx-ok-v78193", Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("check if current mcp is healthy") if !olmv1util.HealthyMCP4OLM(oc) { g.Skip("current mcp is not healthy") } exutil.By("create cip") defer cip.Delete(oc) cip.Create(oc) exutil.By("Create clustercatalog with olmsigkey signed successfully") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension with olmsigkey signed successfully") defer ce.Delete(oc) ce.Create(oc) exutil.By("Create clustercatalog with olmsigkey1 signed failed") defer clustercatalog1.Delete(oc) clustercatalog1.CreateWithoutCheck(oc) clustercatalog1.CheckClusterCatalogCondition(oc, "Progressing", "message", "signature verification failed: invalid signature", 10, 90, 0) })
test case
openshift/openshift-tests-private
c05670b2-30fe-4112-b48b-e75949b5a342
Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-78300-validation of container images using sigstore signatures with different policy [Disruptive]
['"path/filepath"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-78300-validation of container images using sigstore signatures with different policy [Disruptive]", func() { if !exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "crd", "clusterimagepolicies.config.openshift.io") { g.Skip("skip it because there is no ClusterImagePolicy") } exutil.SkipForSNOCluster(oc) var ( caseID = "781932" ns = "ns-" + caseID sa = "sa" + caseID imageRef = "quay.io/olmqe/nginx-ok-index-sigstore:vokv" + caseID packageName = "nginx-ok-v" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceName = "ce-" + caseID cipName = "cip-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") cipTemplate = filepath.Join(baseDir, "cip.yaml") cip = olmv1util.CipDescription{ Name: cipName, Repo1: "quay.io/olmqe/nginx-ok-bundle-sigstore", Repo2: "quay.io/olmqe/nginx-ok-bundle-sigstore1", Repo3: "quay.io/olmqe/nginx-ok-index-sigstore", Repo4: "quay.io/olmqe/nginx-ok-index-sigstore1", Policy: "MatchRepository", Template: cipTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: imageRef, Template: clustercatalogTemplate, } saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } ce = olmv1util.ClusterExtensionDescription{ Name: ceName, PackageName: packageName, Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("check if current mcp is healthy") if !olmv1util.HealthyMCP4OLM(oc) { g.Skip("current mcp is not healthy") } exutil.By("create cip") defer cip.Delete(oc) cip.Create(oc) exutil.By("Create clustercatalog with olmsigkey signed successfully") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clusterextension with olmsigkey signed successfully") defer ce.Delete(oc) ce.Create(oc) })
test case
openshift/openshift-tests-private
3d377f05-69ca-4608-9b75-26d70699344b
Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-76983-install index and bundle from private image
['"path/filepath"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-ConnectedOnly-NonHyperShiftHOST-Medium-76983-install index and bundle from private image", func() { exutil.SkipForSNOCluster(oc) // note: 1, it depends the default global secret to access private index and bundle in quay.io var ( caseID = "76983" ns = "ns-" + caseID sa = "sa" + caseID labelValue = caseID catalogName = "clustercatalog-" + caseID ceName = "ce-" + caseID baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") clustercatalog = olmv1util.ClusterCatalogDescription{ Name: catalogName, Imageref: "quay.io/olmqe/nginx-ok-index-private:vokv76983", Template: clustercatalogTemplate, } saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } ce = olmv1util.ClusterExtensionDescription{ Name: ceName, PackageName: "nginx-ok-v76983", // private bundle quay.io/olmqe/nginx-ok-bundle-private:v76983-0.0.1 Channel: "alpha", Version: ">=0.0.1", InstallNamespace: ns, SaName: sa, LabelValue: labelValue, Template: clusterextensionTemplate, } ) exutil.By("check if there is global secret and it includes token to access quay.io") if !exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "secret/pull-secret", "-n", "openshift-config") { g.Skip("skip it because there is no global secret") } output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("secret/pull-secret", "-n", "openshift-config", `--template={{index .data ".dockerconfigjson" | base64decode}}`).Output() if err != nil { e2e.Failf("can not get data of global secret ") } if !strings.Contains(output, "quay.io/olmqe") { g.Skip("skip it becuse of no token for test") } exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("check ce to be installed") defer ce.Delete(oc) ce.Create(oc) })
test case
openshift/openshift-tests-private
159bb69c-0a7c-43bd-9ae2-e8529a5c016d
Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-76985-authfile is updated automatically [Disruptive].
['"fmt"', '"os"', '"os/exec"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:kuiwang-NonHyperShiftHOST-Longduration-NonPreRelease-ConnectedOnly-Medium-76985-authfile is updated automatically [Disruptive].", func() { exutil.SkipForSNOCluster(oc) var ( caseID = "76985" ) exutil.By("check if there is global secret") if !exutil.CheckAppearance(oc, 1*time.Second, 1*time.Second, exutil.Immediately, exutil.AsAdmin, exutil.WithoutNamespace, exutil.Appear, "secret/pull-secret", "-n", "openshift-config") { g.Skip("skip it because there is no global secret") } exutil.By("check if current mcp is healthy") if !olmv1util.HealthyMCP4OLM(oc) { g.Skip("current mcp is not healthy") } exutil.By("set gobal secret") dirname := "/tmp/" + caseID + "-globalsecretdir" err := os.MkdirAll(dirname, 0777) o.Expect(err).NotTo(o.HaveOccurred()) defer os.RemoveAll(dirname) err = oc.AsAdmin().WithoutNamespace().Run("extract").Args("secret/pull-secret", "-n", "openshift-config", "--to="+dirname, "--confirm").Execute() o.Expect(err).NotTo(o.HaveOccurred()) newAuthCmd := fmt.Sprintf(`cat %s/.dockerconfigjson | jq '.auths["fake.registry"] |= . + {"auth":"faketoken=="}' > %s/newdockerconfigjson`, dirname, dirname) _, err = exec.Command("bash", "-c", newAuthCmd).Output() o.Expect(err).NotTo(o.HaveOccurred()) err = oc.AsAdmin().WithoutNamespace().Run("set").Args("data", "secret/pull-secret", "-n", "openshift-config", "--from-file=.dockerconfigjson="+dirname+"/newdockerconfigjson").Execute() o.Expect(err).NotTo(o.HaveOccurred()) defer func() { err = oc.AsAdmin().WithoutNamespace().Run("set").Args("data", "secret/pull-secret", "-n", "openshift-config", "--from-file=.dockerconfigjson="+dirname+"/.dockerconfigjson").Execute() o.Expect(err).NotTo(o.HaveOccurred()) olmv1util.AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 120, 1) olmv1util.AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 120, 1) olmv1util.AssertMCPCondition(oc, "master", "Updating", "status", "False", 30, 600, 20) olmv1util.AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 600, 20) o.Expect(olmv1util.HealthyMCP4OLM(oc)).To(o.BeTrue()) }() olmv1util.AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 120, 1) olmv1util.AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 120, 1) olmv1util.AssertMCPCondition(oc, "master", "Updating", "status", "False", 30, 600, 20) olmv1util.AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 600, 20) o.Expect(olmv1util.HealthyMCP4OLM(oc)).To(o.BeTrue()) exutil.By("check if auth is updated for catalogd") catalogDPod, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", "control-plane=catalogd-controller-manager", "-o=jsonpath={.items[0].metadata.name}", "-n", "openshift-catalogd").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(catalogDPod).NotTo(o.BeEmpty()) // avoid to use oc.xx.Output to avoid possible sensitive information leak. checkAuthCmdCatalogd := `grep -q "fake.registry" /tmp/catalogd-global-pull-secret-*.json` finalArgsCatalogd := []string{ "--kubeconfig=" + exutil.KubeConfigPath(), "exec", "-n", "openshift-catalogd", catalogDPod, "--", "bash", "-c", checkAuthCmdCatalogd, } e2e.Logf("cmdCatalogd: %v", "oc"+" "+strings.Join(finalArgsCatalogd, " ")) cmdCatalogd := exec.Command("oc", finalArgsCatalogd...) _, err = cmdCatalogd.CombinedOutput() // please do not print output because it is possible to leak sensitive information o.Expect(err).NotTo(o.HaveOccurred(), "auth for catalogd is not updated") exutil.By("check if auth is updated for operator-controller") operatorControlerPod, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", "control-plane=operator-controller-controller-manager", "-o=jsonpath={.items[0].metadata.name}", "-n", "openshift-operator-controller").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(operatorControlerPod).NotTo(o.BeEmpty()) // avoid to use oc.xx.Output to avoid possible sensitive information leak. checkAuthCmdOperatorController := `grep -q "registry" /tmp/operator-controller-global-pull-secrets-*.json` finalArgsOperatorController := []string{ "--kubeconfig=" + exutil.KubeConfigPath(), "exec", "-n", "openshift-operator-controller", operatorControlerPod, "--", "bash", "-c", checkAuthCmdOperatorController, } e2e.Logf("cmdOperatorController: %v", "oc"+" "+strings.Join(finalArgsOperatorController, " ")) cmdOperatorController := exec.Command("oc", finalArgsOperatorController...) _, err = cmdOperatorController.CombinedOutput() // please do not print output because it is possible to leak sensitive information o.Expect(err).NotTo(o.HaveOccurred(), "auth for operator-controller is not updated") })
test case
openshift/openshift-tests-private
50265e5c-0f55-49d3-92e9-1d365d8a5f35
Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-68821-olmv1 Supports Version Ranges during Installation
['"path/filepath"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-68821-olmv1 Supports Version Ranges during Installation", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") clusterextensionWithoutChannelTemplate = filepath.Join(baseDir, "clusterextensionWithoutChannel.yaml") clusterextensionWithoutChannelVersionTemplate = filepath.Join(baseDir, "clusterextensionWithoutChannelVersion.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", 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", InstallNamespace: ns, SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.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) exutil.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) exutil.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) exutil.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) exutil.By("Create clusterextension with invalid version") clusterextension.Version = "!1.0.1" clusterextension.Template = clusterextensionTemplate err = clusterextension.CreateWithoutCheck(oc) o.Expect(err).To(o.HaveOccurred()) })
test case
openshift/openshift-tests-private
6c9f4a03-cfc9-4318-ae3d-4d442d8578e3
Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-69196-olmv1 Supports Version Ranges during clusterextension upgrade
['"context"', '"path/filepath"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-69196-olmv1 Supports Version Ranges during clusterextension upgrade", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.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", 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, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.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")) exutil.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") } exutil.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") } })
test case
openshift/openshift-tests-private
20e978cd-bda5-427a-b7a8-8bbb48860fcd
Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-74108-olm v1 supports legacy upgrade edges
['"context"', '"path/filepath"', '"strings"', '"time"', 'g "github.com/onsi/ginkgo/v2"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-74108-olm v1 supports legacy upgrade edges", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextensionWithoutVersion.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", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-74108", InstallNamespace: ns, PackageName: "nginx74108", Channel: "candidate-v0.0", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("1) Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.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")) exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") exutil.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") })
test case
openshift/openshift-tests-private
33724a2f-9aae-4ae6-b2c9-0254a6983b09
Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-74923-no two ClusterExtensions can manage the same underlying object
['"context"', '"path/filepath"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-74923-no two ClusterExtensions can manage the same underlying object", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextensionWithoutChannelVersion.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", Template: clustercatalogTemplate, } clusterextension1 = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-74923-1", PackageName: "nginx74923", InstallNamespace: ns1, SaName: sa1, Template: clusterextensionTemplate, } clusterextension2 = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-74923-2", PackageName: "nginx74923", InstallNamespace: ns2, SaName: sa2, Template: clusterextensionTemplate, } ) exutil.By("1. Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("2. Create clusterextension1") exutil.By("2.1 Create namespace 1") defer 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()) exutil.By("2.2 Create SA for clusterextension1") defer saCrb1.Delete(oc) saCrb1.Create(oc) exutil.By("2.3 Create clusterextension1") defer clusterextension1.Delete(oc) clusterextension1.Create(oc) o.Expect(clusterextension1.InstalledBundle).To(o.ContainSubstring("v1.0.2")) exutil.By("3 Create clusterextension2") exutil.By("3.1 Create namespace 2") defer 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()) exutil.By("3.2 Create SA for clusterextension2") defer saCrb2.Delete(oc) saCrb2.Create(oc) exutil.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(status) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "crd nginxolm74923s.cache.example.com is not deleted") exutil.By("4 Create crd") crdFilePath := filepath.Join(baseDir, "crd-nginxolm74923.yaml") defer 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(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") })
test case
openshift/openshift-tests-private
3e62b10f-edce-48c6-8707-9f05aa08ba18
Author:xzha-ConnectedOnly-NonHyperShiftHOST-Medium-75501-the updates of various status fields is orthogonal
['"context"', '"path/filepath"', '"strings"', '"time"', 'g "github.com/onsi/ginkgo/v2"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-Medium-75501-the updates of various status fields is orthogonal", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.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", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-75501", InstallNamespace: ns, PackageName: "nginx75501", Channel: "candidate-v2.1", Version: "2.1.0", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.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) exutil.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, "error resolving canonical reference") { 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) exutil.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) exutil.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") } })
test case
openshift/openshift-tests-private
8d2237eb-87cb-4b06-a270-891d5d138ea0
Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-76685-olm v1 supports selecting catalogs
['"context"', '"path/filepath"', '"strings"', '"time"', 'g "github.com/onsi/ginkgo/v2"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-High-76685-olm v1 supports selecting catalogs", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") 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, } ) exutil.By("1) Create namespace, sa, clustercatalog1 and clustercatalog2") defer 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) exutil.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) exutil.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) exutil.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) exutil.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") exutil.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) exutil.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") exutil.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") })
test case
openshift/openshift-tests-private
0b53cf25-06b8-4d83-b9f3-796896a7c11f
Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-77972-olm v1 Supports MaxOCPVersion in properties file
['"context"', '"path/filepath"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-OSD_CCS-Medium-77972-olm v1 Supports MaxOCPVersion in properties file", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextensionWithoutChannel.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: "ocp-77972", 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", Template: clusterextensionTemplate, } ) exutil.By("1) Create namespace, sa, clustercatalog1 and clustercatalog2") defer 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) exutil.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")) exutil.By("3) upgrade clusterextension to 0.1.0, olm.maxOpenShiftVersion is 4.17") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"0.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.v0.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") exutil.By("4) upgrade clusterextension to 1.0.0, olm.maxOpenShiftVersion is 4.18") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"1.0.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.0.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") exutil.By("5) 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") exutil.By("6) 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) { status, _ := olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].status}`) if strings.Contains(status, "True") { e2e.Logf("status is %s", status) return true, nil } return false, nil }) message, _ = olmv1util.GetNoEmpty(oc, "co", "olm", "-o", `jsonpath={.status.conditions[?(@.type=="Upgradeable")].message}`) o.Expect(message).To(o.ContainSubstring("All is well")) if errWait != nil { olmv1util.GetNoEmpty(oc, "co", "olm", "-o=jsonpath-as-json={.status.conditions}") } exutil.AssertWaitPollNoErr(errWait, "Upgradeable is not True") })
test case
openshift/openshift-tests-private
ffb5a2cf-98f9-4190-9ae0-fa47c174a6dc
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-78393-support metrics
['"context"', '"fmt"', '"os/exec"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-78393-support metrics", func() { var metricsMsg string exutil.By("Get token") catalogPodname, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "--selector=app=catalog-operator", "-o=jsonpath={.items..metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(catalogPodname).NotTo(o.BeEmpty()) 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()) exutil.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()) queryContent := "https://" + promeEp + ":7443/metrics" errWait := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { metricsMsg, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", catalogPodname, "-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.") } exutil.By("ClusterRole/openshift-state-metrics has no rule to get the catalogd metrics") metricsMsg, _ = oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", catalogPodname, "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", wrongToken), queryContent).Output() o.Expect(metricsMsg).To(o.ContainSubstring("Authorization denied")) exutil.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().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", catalogPodname, "-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.") } exutil.By("ClusterRole/openshift-state-metrics has no rule to get the operator-controller metrics") metricsMsg, _ = oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", catalogPodname, "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", wrongToken), queryContent).Output() o.Expect(metricsMsg).To(o.ContainSubstring("Authorization denied")) })
test case
openshift/openshift-tests-private
9c411be8-b673-4cc6-baf3-cf3e0a32f207
Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-79770-metrics are collected by default
['"os/exec"', '"strings"', '"github.com/tidwall/gjson"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:xzha-ConnectedOnly-NonHyperShiftHOST-High-79770-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] exutil.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(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(statusAll) o.Expect(status).To(o.Equal("up")) } exutil.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(queryResult1) o.Expect(queryResult1).To(o.ContainSubstring("value")) query2 := `query=controller_runtime_reconcile_total{controller="clusterextension",result="success"}` queryResult2, _ := oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-monitoring", k8sPodname, "--", "curl", "-G", "--data-urlencode", query2, queryUrl).Output() e2e.Logf(queryResult2) o.Expect(queryResult2).To(o.ContainSubstring("value")) exutil.By("3) test SUCCESS") })
test case
openshift/openshift-tests-private
d1c8b7fa-39c0-4f40-8750-02646012f5d8
Author:bandrade-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-High-69193-olmv1 major version zero
['"context"', '"path/filepath"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:bandrade-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-High-69193-olmv1 major version zero", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-69193" sa = "sa69193" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-69193", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm69193", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-69193", InstallNamespace: ns, PackageName: "nginx69193", Channel: "candidate-v0.0", Version: "0.0.1", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("1) Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("2) Install version 0.0.1") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("0.0.1")) exutil.By("3) Attempt to update to version 0.0.2 with CatalogProvided policy, that should fail") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version": "0.0.2"}}}}`) /* 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, "constraints not satisfiable") { e2e.Logf("status is %s", message) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx69193 0.0.2 should not be installed") exutil.By("4) change UpgradeConstraintPolicy to be SelfCertified, that should work") clusterextension.Patch(oc, `{"spec":{"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, "0.0.2") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx69193 0.0.2 is not installed") clusterextension.Delete(oc) exutil.By("5) Install version 0.1.0 with CatalogProvided policy, that should work") clusterextension.Channel = "candidate-v0.1" clusterextension.Version = "0.1.0" clusterextension.UpgradeConstraintPolicy = "CatalogProvided" clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("0.1.0")) exutil.By("6) Attempt to update to version 0.2.0 with CatalogProvided policy, that should fail") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version":"0.2.0","channels":["candidate-v0.2"]}}}}`) 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, "error upgrading") { e2e.Logf("status is %s", message) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx69193 0.2.0 should not be installed") exutil.By("7) Install version 0.2.0 with SelfCertified policy, that should work") 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, "0.2.0") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx69193 0.2.0 is not installed") exutil.By("8) Install version 0.2.2 with CatalogProvided policy, that should work") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"upgradeConstraintPolicy": "CatalogProvided"}}}}`) clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version": "0.2.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, "0.2.2") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx69193 0.2.2 is not installed") })
test case
openshift/openshift-tests-private
3a127453-3dbc-4fcd-a4d2-0a452b4a9a71
Author:bandrade-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-High-70719-olmv1 Upgrade non-zero major version
['"context"', '"path/filepath"', '"strings"', '"time"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:bandrade-DEPRECATED-ConnectedOnly-NonHyperShiftHOST-High-70719-olmv1 Upgrade non-zero major version", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-70719" sa = "sa70719" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-70719", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm70719", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-70719", InstallNamespace: ns, PackageName: "nginx70719", Channel: "candidate-v0", Version: "0.2.2", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("1) Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("2) Install version 0.2.2") defer clusterextension.Delete(oc) clusterextension.Create(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("0.2.2")) exutil.By("3) Attempt to update to version 1.0.0 with CatalogProvided policy, that should fail") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"channels":["candidate-v1"], "version":"1.0.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, "error upgrading") { e2e.Logf("status is %s", message) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 1.0.0 should not be installed") exutil.By("4) change UpgradeConstraintPolicy to be SelfCertified, that should work") 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.0") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 1.0.0 is not installed") exutil.By("5) change UpgradeConstraintPolicy to be CatalogProvided, attempt to update to version 1.0.1, that should work") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"upgradeConstraintPolicy": "CatalogProvided"}}}}`) 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) { clusterextension.GetBundleResource(oc) if !strings.Contains(clusterextension.InstalledBundle, "1.0.1") { e2e.Logf("ResolvedBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 1.0.1 is not installed") exutil.By("6) attempt to update to version 1.2.1, that should work") clusterextension.Patch(oc, `{"spec":{"source":{"catalog":{"version": "1.2.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.2.1") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 1.2.1 is not installed") exutil.By("7) Attempt to update to version 2.0.0 with CatalogProvided policy, that should fail") 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) { message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.conditions[*].message}") if !strings.Contains(message, "installed package nginx70719 requires at least one of") { e2e.Logf("status is %s", message) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 2.0.0 should not be installed") exutil.By("8) Install version 2.0.0 with SelfCertified policy, that should work") clusterextension.Patch(oc, `{"spec":{"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, "2.0.0") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70719 2.0.0 is not installed") })
test case
openshift/openshift-tests-private
7ec3a291-21bf-4565-86bf-8ea8fa22399f
Author:bandrade-ConnectedOnly-NonHyperShiftHOST-High-70723-olmv1 downgrade version
['"context"', '"path/filepath"', '"strings"', '"time"', 'g "github.com/onsi/ginkgo/v2"', 'olmv1util "github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:bandrade-ConnectedOnly-NonHyperShiftHOST-High-70723-olmv1 downgrade version", func() { var ( baseDir = exutil.FixturePath("testdata", "olm", "v1") clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") ns = "ns-70723" sa = "sa70723" saCrb = olmv1util.SaCLusterRolebindingDescription{ Name: sa, Namespace: ns, Template: saClusterRoleBindingTemplate, } clustercatalog = olmv1util.ClusterCatalogDescription{ Name: "clustercatalog-70723", Imageref: "quay.io/openshifttest/nginxolm-operator-index:nginxolm70723", Template: clustercatalogTemplate, } clusterextension = olmv1util.ClusterExtensionDescription{ Name: "clusterextension-70723", InstallNamespace: ns, PackageName: "nginx70723", Channel: "candidate-v2", Version: "2.2.1", SaName: sa, Template: clusterextensionTemplate, } ) exutil.By("Create namespace") defer 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()) exutil.By("Create SA for clusterextension") defer saCrb.Delete(oc) saCrb.Create(oc) exutil.By("1) Create clustercatalog") defer clustercatalog.Delete(oc) clustercatalog.Create(oc) exutil.By("2) Install version 2.2.1") clusterextension.Create(oc) defer clusterextension.Delete(oc) o.Expect(clusterextension.InstalledBundle).To(o.ContainSubstring("2.2.1")) exutil.By("3) Attempt to downgrade to version 2.0.0 with CatalogProvided policy, that should fail") 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) { message, _ := olmv1util.GetNoEmpty(oc, "clusterextension", clusterextension.Name, "-o", "jsonpath={.status.conditions[*].message}") if !strings.Contains(message, "error upgrading") { e2e.Logf("message is %s", message) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70723 2.0.0 should not be installed") exutil.By("4) change UpgradeConstraintPolicy to be SelfCertified, that should work") 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, "2.0.0") { e2e.Logf("InstalledBundle is %s", clusterextension.InstalledBundle) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "nginx70723 2.0.0 is not installed") })
test case
openshift/openshift-tests-private
9ab0a3bf-0dbf-4c17-a313-3e22190ad39b
Author:bandrade-NonHyperShiftHOST-Medium-75877-Make sure that rukpak is removed from payload
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:bandrade-NonHyperShiftHOST-Medium-75877-Make sure that rukpak is removed from payload", func() { exutil.By("1) Check if bundledeployments.core.rukpak.io CRD is not installed") _, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("crd", "bundledeployments.core.rukpak.io").Output() o.Expect(err).To(o.HaveOccurred()) exutil.By("2) Check if openshift-rukpak is not created") _, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("ns", "openshift-rukpak").Output() o.Expect(err).To(o.HaveOccurred()) })
test case
openshift/openshift-tests-private
95c8e0aa-46d0-46df-a36e-96dfd1b87811
Author:bandrade-ConnectedOnly-NonHyperShiftHOST-Medium-77413-Check if ClusterCatalog is in Serving properly
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1_oprun.go
g.It("Author:bandrade-ConnectedOnly-NonHyperShiftHOST-Medium-77413-Check if ClusterCatalog is in Serving properly", func() { exutil.By("1) Check the status of each one, all of them should be in with the Serving state") newCheck("expect", asAdmin, withoutNamespace, contain, "True", ok, []string{"clustercatalog", "openshift-certified-operators", "-o=jsonpath={.status.conditions[?(@.type==\"Serving\")].status}"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, contain, "True", ok, []string{"clustercatalog", "openshift-community-operators", "-o=jsonpath={.status.conditions[?(@.type==\"Serving\")].status}"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, contain, "True", ok, []string{"clustercatalog", "openshift-redhat-operators", "-o=jsonpath={.status.conditions[?(@.type==\"Serving\")].status}"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, contain, "True", ok, []string{"clustercatalog", "openshift-redhat-marketplace", "-o=jsonpath={.status.conditions[?(@.type==\"Serving\")].status}"}).check(oc) })
file
openshift/openshift-tests-private
b7108f09-42aa-48a0-b156-c674e2053a9d
bundledeployment
import ( "context" "fmt" "time" o "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" "strings" exutil "github.com/openshift/openshift-tests-private/test/extended/util" )
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
package olmv1util import ( "context" "fmt" "time" o "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" "strings" exutil "github.com/openshift/openshift-tests-private/test/extended/util" ) type BundleDeploymentDescription struct { BdName string Address string Namespace string Template string } type ChildResource struct { Kind string Ns string Names []string } // the method is to create bundledeployment and check its status func (bd *BundleDeploymentDescription) Create(oc *exutil.CLI) { e2e.Logf("=========Create bd %v=========", bd.BdName) err := exutil.ApplyClusterResourceFromTemplateWithError(oc, "-n", "default", "--ignore-unknown-parameters=true", "-f", bd.Template, "-p", "NAME="+bd.BdName, "ADDRESS="+bd.Address, "NAMESPACE="+bd.Namespace) o.Expect(err).NotTo(o.HaveOccurred()) bd.AssertInstalled(oc, "true") bd.AssertHealthy(oc, "true") } // the method is to create bundledeployment only and do not check its status func (bd *BundleDeploymentDescription) CreateWithoutCheck(oc *exutil.CLI) { e2e.Logf("=========CreateWithoutCheck bd %v=========", bd.BdName) err := exutil.ApplyClusterResourceFromTemplateWithError(oc, "-n", "default", "--ignore-unknown-parameters=true", "-f", bd.Template, "-p", "NAME="+bd.BdName, "ADDRESS="+bd.Address, "NAMESPACE="+bd.Namespace) o.Expect(err).NotTo(o.HaveOccurred()) } // the method is to delete bundledeployment and check its child resource is removed func (bd *BundleDeploymentDescription) Delete(oc *exutil.CLI, resources []ChildResource) { e2e.Logf("=========Delete bd %v=========", bd.BdName) childs := bd.GetChildResource(oc, resources) Cleanup(oc, "bundledeployment", bd.BdName) bd.AssertChildResourceRemoved(oc, childs) } // the method is to delete bundledeployment only func (bd *BundleDeploymentDescription) DeleteWithoutCheck(oc *exutil.CLI) { e2e.Logf("=========DeleteWithoutCheck bd %v=========", bd.BdName) Cleanup(oc, "bundledeployment", bd.BdName) } // the method is to assert Installed's status with expected. // after it gets status, it does not check it consistently. func (bd *BundleDeploymentDescription) AssertInstalled(oc *exutil.CLI, expected string) { e2e.Logf("=========AssertInstalled bd %v=========", bd.BdName) bd.AssertCondition(oc, "type", "Installed", "status", expected, false) } // the method is to assert Healthy's status with expected. // after it gets status, it does not check it consistently. func (bd *BundleDeploymentDescription) AssertHealthy(oc *exutil.CLI, expected string) { e2e.Logf("=========AssertHealthy bd %v=========", bd.BdName) bd.AssertCondition(oc, "type", "Healthy", "status", expected, false) } // the method is to assert Healthy's status with expected. // after it gets status, it still checks it consistently for 10s. func (bd *BundleDeploymentDescription) AssertHealthyWithConsistent(oc *exutil.CLI, expected string) { e2e.Logf("=========AssertHealthyWithConsistent bd %v=========", bd.BdName) bd.AssertCondition(oc, "type", "Healthy", "status", expected, true) } // the method is to assert condition consistently or not with type, value, status, and expected. func (bd *BundleDeploymentDescription) AssertCondition(oc *exutil.CLI, key, value, field, expected string, consistently bool) { e2e.Logf("=========AssertTypeCondition bd %v=========", bd.BdName) var result string var err error errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { result, err = bd.GetCondition(oc, key, value, field, false) if err != nil { e2e.Logf("output is %v, error is %v, and try next", result, err) return false, nil } if !strings.Contains(strings.ToLower(result), strings.ToLower(expected)) { return false, nil } return true, nil }) if errWait != nil { GetNoEmpty(oc, "bundledeployment", bd.BdName, "-o=jsonpath-as-json={.status}") exutil.AssertWaitPollNoErr(errWait, fmt.Sprintf("the field %s of bd %s with %s=%s is not expected as %s, which is %s", field, bd.BdName, key, value, expected, result)) } if consistently { o.Consistently(func() string { result, _ = bd.GetCondition(oc, key, value, field, false) return strings.ToLower(result) }, 10*time.Second, 4*time.Second).Should(o.ContainSubstring(strings.ToLower(expected)), "the field %s of bd %s with %s=%s is not expected as %s, which is %s", field, bd.BdName, key, value, expected, result) } e2e.Logf("the field %s of bd %s with %s=%s is expected as %s, which is %s", field, bd.BdName, key, value, expected, result) } // the method is to get condition's field with type and value. func (bd *BundleDeploymentDescription) GetCondition(oc *exutil.CLI, key, value, field string, allowEmpty bool) (string, error) { e2e.Logf("=========GetCondition bd %v=========", bd.BdName) jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.%s=="%s")].%s}`, key, value, field) if allowEmpty { return Get(oc, "bundledeployment", bd.BdName, "-o", jsonpath) } else { return GetNoEmpty(oc, "bundledeployment", bd.BdName, "-o", jsonpath) } } // the method is to assert the child resource of bd removed or not. func (bd *BundleDeploymentDescription) AssertChildResourceRemoved(oc *exutil.CLI, childResources []ChildResource) { e2e.Logf("=========AssertChildResourceRemoved bd %v=========", bd.BdName) for _, child := range childResources { for _, name := range child.Names { if child.Ns == "" { o.Expect(Appearance(oc, exutil.Disappear, child.Kind, name)).To(o.BeTrue()) } else { o.Expect(Appearance(oc, exutil.Disappear, child.Kind, name, "-n", child.Ns)).To(o.BeTrue()) } } } } // the method is to get the child resource of bd per kind including cluster level or namespace level func (bd *BundleDeploymentDescription) GetChildResource(oc *exutil.CLI, childResources []ChildResource) []ChildResource { e2e.Logf("=========GetChildResource bd %v=========", bd.BdName) for _, child := range childResources { if child.Ns == "" { child.Names = bd.GetChildClusterResourceByKind(oc, child.Kind) } else { child.Names = bd.GetChildNsResourceByKind(oc, child.Kind, child.Ns) } } return childResources } // the method is to get the child resource of bd per kind for namespace level func (bd *BundleDeploymentDescription) GetChildNsResourceByKind(oc *exutil.CLI, kind, ns string) []string { e2e.Logf("=========GetChildNsResourceByKind bd %v=========", bd.BdName) jsonpath := fmt.Sprintf(`jsonpath={range .items[*].metadata}{range .ownerReferences[?(@.name=="%s")]}{.name}{" "}{end}{end}`, bd.BdName) output, err := GetNoEmpty(oc, kind, "-n", ns, "-o", jsonpath) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("can not get resource of the kind %s with ownerReferences for bd %s in ns %s", kind, bd.BdName, ns)) resourceList := strings.TrimSpace(output) return strings.Fields(resourceList) } // the method is to get the child resource of bd per kind for cluster level func (bd *BundleDeploymentDescription) GetChildClusterResourceByKind(oc *exutil.CLI, kind string) []string { e2e.Logf("=========GetChildClusterResourceByKind bd %v=========", bd.BdName) jsonpath := fmt.Sprintf(`jsonpath={range .items[*].metadata}{range .ownerReferences[?(@.name=="%s")]}{.name}{" "}{end}{end}`, bd.BdName) output, err := GetNoEmpty(oc, kind, "-o", jsonpath) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("can not get resource of the kind %s with ownerReferences for bd %s", kind, bd.BdName)) resourceList := strings.TrimSpace(output) return strings.Fields(resourceList) }
package olmv1util
function
openshift/openshift-tests-private
3ccd3a12-94bc-4328-8d84-96606197e48b
Create
['BundleDeploymentDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) Create(oc *exutil.CLI) { e2e.Logf("=========Create bd %v=========", bd.BdName) err := exutil.ApplyClusterResourceFromTemplateWithError(oc, "-n", "default", "--ignore-unknown-parameters=true", "-f", bd.Template, "-p", "NAME="+bd.BdName, "ADDRESS="+bd.Address, "NAMESPACE="+bd.Namespace) o.Expect(err).NotTo(o.HaveOccurred()) bd.AssertInstalled(oc, "true") bd.AssertHealthy(oc, "true") }
olmv1util
function
openshift/openshift-tests-private
756939ea-8848-4b22-9cf7-aacb024a4ea7
CreateWithoutCheck
['BundleDeploymentDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) CreateWithoutCheck(oc *exutil.CLI) { e2e.Logf("=========CreateWithoutCheck bd %v=========", bd.BdName) err := exutil.ApplyClusterResourceFromTemplateWithError(oc, "-n", "default", "--ignore-unknown-parameters=true", "-f", bd.Template, "-p", "NAME="+bd.BdName, "ADDRESS="+bd.Address, "NAMESPACE="+bd.Namespace) o.Expect(err).NotTo(o.HaveOccurred()) }
olmv1util
function
openshift/openshift-tests-private
d74ff729-35f4-46ad-bb8b-9751be9d2724
Delete
['BundleDeploymentDescription', 'ChildResource']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) Delete(oc *exutil.CLI, resources []ChildResource) { e2e.Logf("=========Delete bd %v=========", bd.BdName) childs := bd.GetChildResource(oc, resources) Cleanup(oc, "bundledeployment", bd.BdName) bd.AssertChildResourceRemoved(oc, childs) }
olmv1util
function
openshift/openshift-tests-private
77735fef-442a-4b70-843f-df03288b7209
DeleteWithoutCheck
['BundleDeploymentDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) DeleteWithoutCheck(oc *exutil.CLI) { e2e.Logf("=========DeleteWithoutCheck bd %v=========", bd.BdName) Cleanup(oc, "bundledeployment", bd.BdName) }
olmv1util
function
openshift/openshift-tests-private
cc3b139d-6a00-431c-bbe0-47fe47a4dd2a
AssertInstalled
['BundleDeploymentDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) AssertInstalled(oc *exutil.CLI, expected string) { e2e.Logf("=========AssertInstalled bd %v=========", bd.BdName) bd.AssertCondition(oc, "type", "Installed", "status", expected, false) }
olmv1util
function
openshift/openshift-tests-private
9ceb90c1-f233-43eb-8253-39f3b0750901
AssertHealthy
['BundleDeploymentDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) AssertHealthy(oc *exutil.CLI, expected string) { e2e.Logf("=========AssertHealthy bd %v=========", bd.BdName) bd.AssertCondition(oc, "type", "Healthy", "status", expected, false) }
olmv1util
function
openshift/openshift-tests-private
b984ea91-e4ec-4b2f-9352-9edbb9afec50
AssertHealthyWithConsistent
['BundleDeploymentDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) AssertHealthyWithConsistent(oc *exutil.CLI, expected string) { e2e.Logf("=========AssertHealthyWithConsistent bd %v=========", bd.BdName) bd.AssertCondition(oc, "type", "Healthy", "status", expected, true) }
olmv1util
function
openshift/openshift-tests-private
42a48e86-cd24-41a5-b4bb-b6fe2233ea0e
AssertCondition
['"context"', '"fmt"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', '"strings"']
['BundleDeploymentDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) AssertCondition(oc *exutil.CLI, key, value, field, expected string, consistently bool) { e2e.Logf("=========AssertTypeCondition bd %v=========", bd.BdName) var result string var err error errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { result, err = bd.GetCondition(oc, key, value, field, false) if err != nil { e2e.Logf("output is %v, error is %v, and try next", result, err) return false, nil } if !strings.Contains(strings.ToLower(result), strings.ToLower(expected)) { return false, nil } return true, nil }) if errWait != nil { GetNoEmpty(oc, "bundledeployment", bd.BdName, "-o=jsonpath-as-json={.status}") exutil.AssertWaitPollNoErr(errWait, fmt.Sprintf("the field %s of bd %s with %s=%s is not expected as %s, which is %s", field, bd.BdName, key, value, expected, result)) } if consistently { o.Consistently(func() string { result, _ = bd.GetCondition(oc, key, value, field, false) return strings.ToLower(result) }, 10*time.Second, 4*time.Second).Should(o.ContainSubstring(strings.ToLower(expected)), "the field %s of bd %s with %s=%s is not expected as %s, which is %s", field, bd.BdName, key, value, expected, result) } e2e.Logf("the field %s of bd %s with %s=%s is expected as %s, which is %s", field, bd.BdName, key, value, expected, result) }
olmv1util
function
openshift/openshift-tests-private
7b893ac6-7832-4e84-ad34-dbc7e51b6234
GetCondition
['"fmt"']
['BundleDeploymentDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) GetCondition(oc *exutil.CLI, key, value, field string, allowEmpty bool) (string, error) { e2e.Logf("=========GetCondition bd %v=========", bd.BdName) jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.%s=="%s")].%s}`, key, value, field) if allowEmpty { return Get(oc, "bundledeployment", bd.BdName, "-o", jsonpath) } else { return GetNoEmpty(oc, "bundledeployment", bd.BdName, "-o", jsonpath) } }
olmv1util
function
openshift/openshift-tests-private
c7ea802b-5a58-45a4-981e-215edc0c7170
AssertChildResourceRemoved
['BundleDeploymentDescription', 'ChildResource']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) AssertChildResourceRemoved(oc *exutil.CLI, childResources []ChildResource) { e2e.Logf("=========AssertChildResourceRemoved bd %v=========", bd.BdName) for _, child := range childResources { for _, name := range child.Names { if child.Ns == "" { o.Expect(Appearance(oc, exutil.Disappear, child.Kind, name)).To(o.BeTrue()) } else { o.Expect(Appearance(oc, exutil.Disappear, child.Kind, name, "-n", child.Ns)).To(o.BeTrue()) } } } }
olmv1util
function
openshift/openshift-tests-private
c8e83fb0-6689-41a0-bf50-ec5c9f8dc13d
GetChildResource
['BundleDeploymentDescription', 'ChildResource']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) GetChildResource(oc *exutil.CLI, childResources []ChildResource) []ChildResource { e2e.Logf("=========GetChildResource bd %v=========", bd.BdName) for _, child := range childResources { if child.Ns == "" { child.Names = bd.GetChildClusterResourceByKind(oc, child.Kind) } else { child.Names = bd.GetChildNsResourceByKind(oc, child.Kind, child.Ns) } } return childResources }
olmv1util
function
openshift/openshift-tests-private
043ab32a-5f5c-4d58-954d-d92dcd54f083
GetChildNsResourceByKind
['"fmt"', '"strings"']
['BundleDeploymentDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) GetChildNsResourceByKind(oc *exutil.CLI, kind, ns string) []string { e2e.Logf("=========GetChildNsResourceByKind bd %v=========", bd.BdName) jsonpath := fmt.Sprintf(`jsonpath={range .items[*].metadata}{range .ownerReferences[?(@.name=="%s")]}{.name}{" "}{end}{end}`, bd.BdName) output, err := GetNoEmpty(oc, kind, "-n", ns, "-o", jsonpath) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("can not get resource of the kind %s with ownerReferences for bd %s in ns %s", kind, bd.BdName, ns)) resourceList := strings.TrimSpace(output) return strings.Fields(resourceList) }
olmv1util
function
openshift/openshift-tests-private
6a8a72b2-6e2e-4c62-b58c-b7ce7c10f581
GetChildClusterResourceByKind
['"fmt"', '"strings"']
['BundleDeploymentDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/bundledeployment.go
func (bd *BundleDeploymentDescription) GetChildClusterResourceByKind(oc *exutil.CLI, kind string) []string { e2e.Logf("=========GetChildClusterResourceByKind bd %v=========", bd.BdName) jsonpath := fmt.Sprintf(`jsonpath={range .items[*].metadata}{range .ownerReferences[?(@.name=="%s")]}{.name}{" "}{end}{end}`, bd.BdName) output, err := GetNoEmpty(oc, kind, "-o", jsonpath) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("can not get resource of the kind %s with ownerReferences for bd %s", kind, bd.BdName)) resourceList := strings.TrimSpace(output) return strings.Fields(resourceList) }
olmv1util
file
openshift/openshift-tests-private
736660cc-9e00-4427-b29f-14e0e3299e44
helper
import ( "time" exutil "github.com/openshift/openshift-tests-private/test/extended/util" )
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/helper.go
package olmv1util import ( "time" exutil "github.com/openshift/openshift-tests-private/test/extended/util" ) // it is used to get OLMv1 resource's field. // if ns is needed, please add "-n" in parameters // it take 3s and 150s as default value for wait.Poll. if it is not ok later, could change it. func Get(oc *exutil.CLI, parameters ...string) (string, error) { return exutil.GetFieldWithJsonpath(oc, 3*time.Second, 150*time.Second, exutil.Immediately, exutil.AllowEmpty, exutil.AsAdmin, exutil.WithoutNamespace, parameters...) } // it is same to Get except that it does not alllow to return empty string. func GetNoEmpty(oc *exutil.CLI, parameters ...string) (string, error) { return exutil.GetFieldWithJsonpath(oc, 3*time.Second, 150*time.Second, exutil.Immediately, exutil.NotAllowEmpty, exutil.AsAdmin, exutil.WithoutNamespace, parameters...) } func Cleanup(oc *exutil.CLI, parameters ...string) { exutil.CleanupResource(oc, 4*time.Second, 160*time.Second, exutil.AsAdmin, exutil.WithoutNamespace, parameters...) } func Appearance(oc *exutil.CLI, appear bool, parameters ...string) bool { return exutil.CheckAppearance(oc, 4*time.Second, 200*time.Second, exutil.NotImmediately, exutil.AsAdmin, exutil.WithoutNamespace, appear, parameters...) }
package olmv1util
function
openshift/openshift-tests-private
bc7f2066-e42d-4c78-a3fa-faf3a3124922
Get
['"time"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/helper.go
func Get(oc *exutil.CLI, parameters ...string) (string, error) { return exutil.GetFieldWithJsonpath(oc, 3*time.Second, 150*time.Second, exutil.Immediately, exutil.AllowEmpty, exutil.AsAdmin, exutil.WithoutNamespace, parameters...) }
olmv1util
function
openshift/openshift-tests-private
0c38ce73-c9bd-4774-adb6-fe2b6ec009eb
GetNoEmpty
['"time"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/helper.go
func GetNoEmpty(oc *exutil.CLI, parameters ...string) (string, error) { return exutil.GetFieldWithJsonpath(oc, 3*time.Second, 150*time.Second, exutil.Immediately, exutil.NotAllowEmpty, exutil.AsAdmin, exutil.WithoutNamespace, parameters...) }
olmv1util
function
openshift/openshift-tests-private
a86fb91c-dc19-4f3f-a6b6-82ff2d474606
Cleanup
['"time"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/helper.go
func Cleanup(oc *exutil.CLI, parameters ...string) { exutil.CleanupResource(oc, 4*time.Second, 160*time.Second, exutil.AsAdmin, exutil.WithoutNamespace, parameters...) }
olmv1util
function
openshift/openshift-tests-private
4a4486dd-58fa-409d-8309-e6bab62a788e
Appearance
['"time"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/helper.go
func Appearance(oc *exutil.CLI, appear bool, parameters ...string) bool { return exutil.CheckAppearance(oc, 4*time.Second, 200*time.Second, exutil.NotImmediately, exutil.AsAdmin, exutil.WithoutNamespace, appear, parameters...) }
olmv1util
file
openshift/openshift-tests-private
0266545f-95f8-40bc-9be9-8be0f1c34bae
icsp
import ( "time" o "github.com/onsi/gomega" e2e "k8s.io/kubernetes/test/e2e/framework" exutil "github.com/openshift/openshift-tests-private/test/extended/util" )
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/icsp.go
package olmv1util import ( "time" o "github.com/onsi/gomega" e2e "k8s.io/kubernetes/test/e2e/framework" exutil "github.com/openshift/openshift-tests-private/test/extended/util" ) type IcspDescription struct { Name string Mirror string Source string Template string } func (icsp *IcspDescription) Create(oc *exutil.CLI) { e2e.Logf("=========Create icsp %v=========", icsp.Name) err := icsp.CreateWithoutCheck(oc) o.Expect(err).NotTo(o.HaveOccurred()) // start to update it AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 120, 5) AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 120, 5) // AssertMCPCondition(oc, "master", "Updated", "status", "False", 3, 90) // AssertMCPCondition(oc, "worker", "Updated", "status", "False", 3, 90) // finish to update it AssertMCPCondition(oc, "master", "Updating", "status", "False", 30, 900, 10) AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 900, 10) o.Expect(HealthyMCP4OLM(oc)).To(o.BeTrue()) // AssertMCPCondition(oc, "master", "Updated", "status", "True", 5, 30) // AssertMCPCondition(oc, "worker", "Updated", "status", "True", 5, 30) } func (icsp *IcspDescription) CreateWithoutCheck(oc *exutil.CLI) error { e2e.Logf("=========CreateWithoutCheck icsp %v=========", icsp.Name) paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", icsp.Template, "-p"} if len(icsp.Name) > 0 { paremeters = append(paremeters, "NAME="+icsp.Name) } if len(icsp.Mirror) > 0 { paremeters = append(paremeters, "MIRROR="+icsp.Mirror) } if len(icsp.Source) > 0 { paremeters = append(paremeters, "SOURCE="+icsp.Source) } err := exutil.ApplyClusterResourceFromTemplateWithError(oc, paremeters...) return err } func (icsp *IcspDescription) DeleteWithoutCheck(oc *exutil.CLI) { e2e.Logf("=========DeleteWithoutCheck icsp %v=========", icsp.Name) exutil.CleanupResource(oc, 4*time.Second, 160*time.Second, exutil.AsAdmin, exutil.WithoutNamespace, "ImageContentSourcePolicy", icsp.Name) } func (icsp *IcspDescription) Delete(oc *exutil.CLI) { e2e.Logf("=========Delete icsp %v=========", icsp.Name) icsp.DeleteWithoutCheck(oc) // start to update it // AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 90, 5) // AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 90, 5) // AssertMCPCondition(oc, "master", "Updated", "status", "False", 3, 90, 5) // AssertMCPCondition(oc, "worker", "Updated", "status", "False", 3, 90, 5) // finish to update it AssertMCPCondition(oc, "master", "Updating", "status", "False", 90, 900, 30) AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 900, 10) // AssertMCPCondition(oc, "master", "Updated", "status", "True", 5, 30, 5) // AssertMCPCondition(oc, "worker", "Updated", "status", "True", 5, 30, 5) o.Eventually(func() bool { return HealthyMCP4OLM(oc) }, 600*time.Second, 30*time.Second).Should(o.BeTrue(), "mcp is not recovered after delete icsp") }
package olmv1util
function
openshift/openshift-tests-private
b2ace87c-9c0c-4d9d-b3e5-b492ab8747e7
Create
['IcspDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/icsp.go
func (icsp *IcspDescription) Create(oc *exutil.CLI) { e2e.Logf("=========Create icsp %v=========", icsp.Name) err := icsp.CreateWithoutCheck(oc) o.Expect(err).NotTo(o.HaveOccurred()) // start to update it AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 120, 5) AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 120, 5) // AssertMCPCondition(oc, "master", "Updated", "status", "False", 3, 90) // AssertMCPCondition(oc, "worker", "Updated", "status", "False", 3, 90) // finish to update it AssertMCPCondition(oc, "master", "Updating", "status", "False", 30, 900, 10) AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 900, 10) o.Expect(HealthyMCP4OLM(oc)).To(o.BeTrue()) // AssertMCPCondition(oc, "master", "Updated", "status", "True", 5, 30) // AssertMCPCondition(oc, "worker", "Updated", "status", "True", 5, 30) }
olmv1util
function
openshift/openshift-tests-private
4710794e-9bdc-4fd6-b126-f876eaec9eb8
CreateWithoutCheck
['IcspDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/icsp.go
func (icsp *IcspDescription) CreateWithoutCheck(oc *exutil.CLI) error { e2e.Logf("=========CreateWithoutCheck icsp %v=========", icsp.Name) paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", icsp.Template, "-p"} if len(icsp.Name) > 0 { paremeters = append(paremeters, "NAME="+icsp.Name) } if len(icsp.Mirror) > 0 { paremeters = append(paremeters, "MIRROR="+icsp.Mirror) } if len(icsp.Source) > 0 { paremeters = append(paremeters, "SOURCE="+icsp.Source) } err := exutil.ApplyClusterResourceFromTemplateWithError(oc, paremeters...) return err }
olmv1util
function
openshift/openshift-tests-private
a16a75a7-3807-4396-a7b9-3226acb2c67b
DeleteWithoutCheck
['"time"']
['IcspDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/icsp.go
func (icsp *IcspDescription) DeleteWithoutCheck(oc *exutil.CLI) { e2e.Logf("=========DeleteWithoutCheck icsp %v=========", icsp.Name) exutil.CleanupResource(oc, 4*time.Second, 160*time.Second, exutil.AsAdmin, exutil.WithoutNamespace, "ImageContentSourcePolicy", icsp.Name) }
olmv1util
function
openshift/openshift-tests-private
0eac5e28-ba1e-49e9-ac77-ae70d96bfc45
Delete
['"time"']
['IcspDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/icsp.go
func (icsp *IcspDescription) Delete(oc *exutil.CLI) { e2e.Logf("=========Delete icsp %v=========", icsp.Name) icsp.DeleteWithoutCheck(oc) // start to update it // AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 90, 5) // AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 90, 5) // AssertMCPCondition(oc, "master", "Updated", "status", "False", 3, 90, 5) // AssertMCPCondition(oc, "worker", "Updated", "status", "False", 3, 90, 5) // finish to update it AssertMCPCondition(oc, "master", "Updating", "status", "False", 90, 900, 30) AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 900, 10) // AssertMCPCondition(oc, "master", "Updated", "status", "True", 5, 30, 5) // AssertMCPCondition(oc, "worker", "Updated", "status", "True", 5, 30, 5) o.Eventually(func() bool { return HealthyMCP4OLM(oc) }, 600*time.Second, 30*time.Second).Should(o.BeTrue(), "mcp is not recovered after delete icsp") }
olmv1util
file
openshift/openshift-tests-private
0b0d76ba-dc3d-490b-9fa6-9662d591dc47
itdms
import ( "context" "fmt" "time" o "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" exutil "github.com/openshift/openshift-tests-private/test/extended/util" )
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/itdms.go
package olmv1util import ( "context" "fmt" "time" o "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" exutil "github.com/openshift/openshift-tests-private/test/extended/util" ) type ItdmsDescription struct { Name string MirrorSite string SourceSite string MirrorNamespace string SourceNamespace string Template string } func (itdms *ItdmsDescription) Create(oc *exutil.CLI) { e2e.Logf("=========Create itdms %v=========", itdms.Name) err := itdms.CreateWithoutCheck(oc) o.Expect(err).NotTo(o.HaveOccurred()) // start to update it AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 120, 5) AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 120, 5) // AssertMCPCondition(oc, "master", "Updated", "status", "False", 3, 90) // AssertMCPCondition(oc, "worker", "Updated", "status", "False", 3, 90) // finish to update it AssertMCPCondition(oc, "master", "Updating", "status", "False", 30, 900, 10) AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 900, 10) o.Expect(HealthyMCP4OLM(oc)).To(o.BeTrue()) // AssertMCPCondition(oc, "master", "Updated", "status", "True", 5, 30) // AssertMCPCondition(oc, "worker", "Updated", "status", "True", 5, 30) } func (itdms *ItdmsDescription) CreateWithoutCheck(oc *exutil.CLI) error { e2e.Logf("=========CreateWithoutCheck itdms %v=========", itdms.Name) paremeters := getParameters(itdms) err := exutil.ApplyClusterResourceFromTemplateWithError(oc, paremeters...) return err } func (itdms *ItdmsDescription) DeleteWithoutCheck(oc *exutil.CLI) { e2e.Logf("=========DeleteWithoutCheck itdms %v=========", itdms.Name) paremeters := getParameters(itdms) var configFile string errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 9*time.Second, false, func(ctx context.Context) (bool, error) { stdout, _, err := oc.AsAdmin().Run("process").Args(paremeters...).OutputsToFiles(exutil.GetRandomString() + "config.json") if err != nil { e2e.Logf("the err:%v, and try next round", err) return false, nil } configFile = stdout return true, nil }) exutil.AssertWaitPollNoErr(errWait, fmt.Sprintf("fail to process %v", paremeters)) err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", configFile).Execute() o.Expect(err).NotTo(o.HaveOccurred()) } func (itdms *ItdmsDescription) Delete(oc *exutil.CLI) { e2e.Logf("=========Delete icsp %v=========", itdms.Name) itdms.DeleteWithoutCheck(oc) // start to update it // AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 90, 5) // AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 90, 5) // AssertMCPCondition(oc, "master", "Updated", "status", "False", 3, 90, 5) // AssertMCPCondition(oc, "worker", "Updated", "status", "False", 3, 90, 5) // finish to update it AssertMCPCondition(oc, "master", "Updating", "status", "False", 90, 900, 30) AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 900, 10) // AssertMCPCondition(oc, "master", "Updated", "status", "True", 5, 30, 5) // AssertMCPCondition(oc, "worker", "Updated", "status", "True", 5, 30, 5) o.Eventually(func() bool { return HealthyMCP4OLM(oc) }, 600*time.Second, 30*time.Second).Should(o.BeTrue(), "mcp is not recovered after delete icsp") } func getParameters(itdms *ItdmsDescription) []string { paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", itdms.Template, "-p"} if len(itdms.Name) > 0 { paremeters = append(paremeters, "NAME="+itdms.Name) } if len(itdms.MirrorSite) > 0 { paremeters = append(paremeters, "MIRRORSITE="+itdms.MirrorSite) } if len(itdms.SourceSite) > 0 { paremeters = append(paremeters, "SOURCESITE="+itdms.SourceSite) } if len(itdms.MirrorNamespace) > 0 { paremeters = append(paremeters, "MIRRORNAMESPACE="+itdms.MirrorNamespace) } if len(itdms.SourceNamespace) > 0 { paremeters = append(paremeters, "SOURCENAMESPACE="+itdms.SourceNamespace) } return paremeters }
package olmv1util
function
openshift/openshift-tests-private
4c6a6e5c-f959-400c-b2ef-26c80cdd42ab
Create
['ItdmsDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/itdms.go
func (itdms *ItdmsDescription) Create(oc *exutil.CLI) { e2e.Logf("=========Create itdms %v=========", itdms.Name) err := itdms.CreateWithoutCheck(oc) o.Expect(err).NotTo(o.HaveOccurred()) // start to update it AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 120, 5) AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 120, 5) // AssertMCPCondition(oc, "master", "Updated", "status", "False", 3, 90) // AssertMCPCondition(oc, "worker", "Updated", "status", "False", 3, 90) // finish to update it AssertMCPCondition(oc, "master", "Updating", "status", "False", 30, 900, 10) AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 900, 10) o.Expect(HealthyMCP4OLM(oc)).To(o.BeTrue()) // AssertMCPCondition(oc, "master", "Updated", "status", "True", 5, 30) // AssertMCPCondition(oc, "worker", "Updated", "status", "True", 5, 30) }
olmv1util
function
openshift/openshift-tests-private
3334e940-e9d5-42a0-b289-409627d87900
CreateWithoutCheck
['ItdmsDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/itdms.go
func (itdms *ItdmsDescription) CreateWithoutCheck(oc *exutil.CLI) error { e2e.Logf("=========CreateWithoutCheck itdms %v=========", itdms.Name) paremeters := getParameters(itdms) err := exutil.ApplyClusterResourceFromTemplateWithError(oc, paremeters...) return err }
olmv1util
function
openshift/openshift-tests-private
56b1fc71-e119-4a06-b55e-b59640d1b01c
DeleteWithoutCheck
['"context"', '"fmt"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
['ItdmsDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/itdms.go
func (itdms *ItdmsDescription) DeleteWithoutCheck(oc *exutil.CLI) { e2e.Logf("=========DeleteWithoutCheck itdms %v=========", itdms.Name) paremeters := getParameters(itdms) var configFile string errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 9*time.Second, false, func(ctx context.Context) (bool, error) { stdout, _, err := oc.AsAdmin().Run("process").Args(paremeters...).OutputsToFiles(exutil.GetRandomString() + "config.json") if err != nil { e2e.Logf("the err:%v, and try next round", err) return false, nil } configFile = stdout return true, nil }) exutil.AssertWaitPollNoErr(errWait, fmt.Sprintf("fail to process %v", paremeters)) err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", configFile).Execute() o.Expect(err).NotTo(o.HaveOccurred()) }
olmv1util
function
openshift/openshift-tests-private
063bfd18-1288-4896-9d10-90720a56deef
Delete
['"time"']
['ItdmsDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/itdms.go
func (itdms *ItdmsDescription) Delete(oc *exutil.CLI) { e2e.Logf("=========Delete icsp %v=========", itdms.Name) itdms.DeleteWithoutCheck(oc) // start to update it // AssertMCPCondition(oc, "master", "Updating", "status", "True", 3, 90, 5) // AssertMCPCondition(oc, "worker", "Updating", "status", "True", 3, 90, 5) // AssertMCPCondition(oc, "master", "Updated", "status", "False", 3, 90, 5) // AssertMCPCondition(oc, "worker", "Updated", "status", "False", 3, 90, 5) // finish to update it AssertMCPCondition(oc, "master", "Updating", "status", "False", 90, 900, 30) AssertMCPCondition(oc, "worker", "Updating", "status", "False", 30, 900, 10) // AssertMCPCondition(oc, "master", "Updated", "status", "True", 5, 30, 5) // AssertMCPCondition(oc, "worker", "Updated", "status", "True", 5, 30, 5) o.Eventually(func() bool { return HealthyMCP4OLM(oc) }, 600*time.Second, 30*time.Second).Should(o.BeTrue(), "mcp is not recovered after delete icsp") }
olmv1util
function
openshift/openshift-tests-private
571ef40f-b116-4ecc-930f-15c87fe33504
getParameters
['ItdmsDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/itdms.go
func getParameters(itdms *ItdmsDescription) []string { paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", itdms.Template, "-p"} if len(itdms.Name) > 0 { paremeters = append(paremeters, "NAME="+itdms.Name) } if len(itdms.MirrorSite) > 0 { paremeters = append(paremeters, "MIRRORSITE="+itdms.MirrorSite) } if len(itdms.SourceSite) > 0 { paremeters = append(paremeters, "SOURCESITE="+itdms.SourceSite) } if len(itdms.MirrorNamespace) > 0 { paremeters = append(paremeters, "MIRRORNAMESPACE="+itdms.MirrorNamespace) } if len(itdms.SourceNamespace) > 0 { paremeters = append(paremeters, "SOURCENAMESPACE="+itdms.SourceNamespace) } return paremeters }
olmv1util
file
openshift/openshift-tests-private
a77a2c92-536e-4ba5-9dd7-5f32eac8bc7f
mcp-helper
import ( "context" "fmt" "strings" "time" o "github.com/onsi/gomega" exutil "github.com/openshift/openshift-tests-private/test/extended/util" "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" )
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/mcp-helper.go
package olmv1util import ( "context" "fmt" "strings" "time" o "github.com/onsi/gomega" exutil "github.com/openshift/openshift-tests-private/test/extended/util" "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" ) func AssertMCPCondition(oc *exutil.CLI, name, conditionType, field, expect string, checkInterval, checkTimeout, consistentTime int) { e2e.Logf("========= assert mcp %v %s %s expect is %s =========", name, conditionType, field, expect) err := CheckMCPCondition(oc, name, conditionType, field, expect, checkInterval, checkTimeout) o.Expect(err).NotTo(o.HaveOccurred()) if consistentTime != 0 { e2e.Logf("make sure mcp %s expect is %s consistently for %ds", conditionType, expect, consistentTime) jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].%s}`, conditionType, field) o.Consistently(func() string { output, _ := GetNoEmpty(oc, "mcp", name, "-o", jsonpath) return strings.ToLower(output) }, time.Duration(consistentTime)*time.Second, 5*time.Second).Should(o.ContainSubstring(strings.ToLower(expect)), "mcp %s expected is not %s", conditionType, expect) } } func CheckMCPCondition(oc *exutil.CLI, name, conditionType, field, expect string, checkInterval, checkTimeout int) error { e2e.Logf("========= check mcp %v %s %s expect is %s =========", name, conditionType, field, expect) jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].%s}`, conditionType, field) errWait := wait.PollUntilContextTimeout(context.TODO(), time.Duration(checkInterval)*time.Second, time.Duration(checkTimeout)*time.Second, false, func(ctx context.Context) (bool, error) { output, err := GetNoEmpty(oc, "mcp", name, "-o", jsonpath) if err != nil { e2e.Logf("output is %v, error is %v, and try next", output, err) return false, nil } if !strings.Contains(strings.ToLower(output), strings.ToLower(expect)) { e2e.Logf("got is %v, not %v, and try next", output, expect) return false, nil } return true, nil }) if errWait != nil { GetNoEmpty(oc, "mcp", name, "-o=jsonpath-as-json={.status}") errWait = fmt.Errorf("error happen: %v\n mcp %s expected is not %s in %v seconds", errWait, conditionType, expect, checkTimeout) } return errWait } func HealthyMCP4OLM(oc *exutil.CLI) bool { return HealthyMCP4Module(oc, "OLM") } func HealthyMCP4Module(oc *exutil.CLI, module string) bool { output, err := GetNoEmpty(oc, "mcp", "-ojsonpath={.items..metadata.name}") if err != nil { e2e.Logf("output is %v, error is %v, and try next", output, err) return false } // if your moudle has specific checking or not same checking with OLM. you could add your module branch // and please keep OLM logic if module == "OLM" { mcpNames := strings.Fields(output) // check if there is 2 if len(mcpNames) > 2 { e2e.Logf("there is unexpect mcp: %v", mcpNames) return false } for _, name := range mcpNames { if name != "worker" && name != "master" { e2e.Logf("there is mcp %v which is not expected", name) return false } } workerStatus, err := GetMCPStatus(oc, "worker") if err != nil { e2e.Logf("error is %v", err) return false } if !(strings.Contains(workerStatus.UpdatingStatus, "False") && // strings.Contains(workerStatus.UpdatedStatus, "True") && strings.Compare(workerStatus.MachineCount, workerStatus.ReadyMachineCount) == 0 && strings.Compare(workerStatus.UnavailableMachineCount, workerStatus.DegradedMachineCount) == 0 && strings.Compare(workerStatus.DegradedMachineCount, "0") == 0) { e2e.Logf("mcp worker's status is not correct: %v", workerStatus) return false } masterStatus, err := GetMCPStatus(oc, "master") if err != nil { e2e.Logf("error is %v", err) return false } if !(strings.Contains(masterStatus.UpdatingStatus, "False") && // strings.Contains(masterStatus.UpdatedStatus, "True") && strings.Compare(masterStatus.MachineCount, masterStatus.ReadyMachineCount) == 0 && strings.Compare(masterStatus.UnavailableMachineCount, masterStatus.DegradedMachineCount) == 0 && strings.Compare(masterStatus.DegradedMachineCount, "0") == 0) { e2e.Logf("mcp master's status is not correct:%v", masterStatus) return false } } return true } type McpStatus struct { MachineCount string ReadyMachineCount string UnavailableMachineCount string DegradedMachineCount string UpdatingStatus string UpdatedStatus string } func GetMCPStatus(oc *exutil.CLI, name string) (McpStatus, error) { updatingStatus, err := GetNoEmpty(oc, "mcp", name, `-ojsonpath='{.status.conditions[?(@.type=="Updating")].status}'`) if err != nil { return McpStatus{}, err } updatedStatus, err := GetNoEmpty(oc, "mcp", name, `-ojsonpath='{.status.conditions[?(@.type=="Updated")].status}'`) if err != nil { return McpStatus{}, err } machineCount, err := GetNoEmpty(oc, "mcp", name, "-o=jsonpath={..status.machineCount}") if err != nil { return McpStatus{}, err } readyMachineCount, err := GetNoEmpty(oc, "mcp", name, "-o=jsonpath={..status.readyMachineCount}") if err != nil { return McpStatus{}, err } unavailableMachineCount, err := GetNoEmpty(oc, "mcp", name, "-o=jsonpath={..status.unavailableMachineCount}") if err != nil { return McpStatus{}, err } degradedMachineCount, err := GetNoEmpty(oc, "mcp", name, "-o=jsonpath={..status.degradedMachineCount}") if err != nil { return McpStatus{}, err } return McpStatus{ MachineCount: machineCount, ReadyMachineCount: readyMachineCount, UnavailableMachineCount: unavailableMachineCount, DegradedMachineCount: degradedMachineCount, UpdatingStatus: updatingStatus, UpdatedStatus: updatedStatus, }, nil }
package olmv1util
function
openshift/openshift-tests-private
5527f689-7c87-40dd-972f-caca35a5141c
AssertMCPCondition
['"fmt"', '"strings"', '"time"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/mcp-helper.go
func AssertMCPCondition(oc *exutil.CLI, name, conditionType, field, expect string, checkInterval, checkTimeout, consistentTime int) { e2e.Logf("========= assert mcp %v %s %s expect is %s =========", name, conditionType, field, expect) err := CheckMCPCondition(oc, name, conditionType, field, expect, checkInterval, checkTimeout) o.Expect(err).NotTo(o.HaveOccurred()) if consistentTime != 0 { e2e.Logf("make sure mcp %s expect is %s consistently for %ds", conditionType, expect, consistentTime) jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].%s}`, conditionType, field) o.Consistently(func() string { output, _ := GetNoEmpty(oc, "mcp", name, "-o", jsonpath) return strings.ToLower(output) }, time.Duration(consistentTime)*time.Second, 5*time.Second).Should(o.ContainSubstring(strings.ToLower(expect)), "mcp %s expected is not %s", conditionType, expect) } }
olmv1util
function
openshift/openshift-tests-private
d6d00714-8894-4682-8e2e-466ccd62fa69
CheckMCPCondition
['"context"', '"fmt"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/mcp-helper.go
func CheckMCPCondition(oc *exutil.CLI, name, conditionType, field, expect string, checkInterval, checkTimeout int) error { e2e.Logf("========= check mcp %v %s %s expect is %s =========", name, conditionType, field, expect) jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].%s}`, conditionType, field) errWait := wait.PollUntilContextTimeout(context.TODO(), time.Duration(checkInterval)*time.Second, time.Duration(checkTimeout)*time.Second, false, func(ctx context.Context) (bool, error) { output, err := GetNoEmpty(oc, "mcp", name, "-o", jsonpath) if err != nil { e2e.Logf("output is %v, error is %v, and try next", output, err) return false, nil } if !strings.Contains(strings.ToLower(output), strings.ToLower(expect)) { e2e.Logf("got is %v, not %v, and try next", output, expect) return false, nil } return true, nil }) if errWait != nil { GetNoEmpty(oc, "mcp", name, "-o=jsonpath-as-json={.status}") errWait = fmt.Errorf("error happen: %v\n mcp %s expected is not %s in %v seconds", errWait, conditionType, expect, checkTimeout) } return errWait }
olmv1util
function
openshift/openshift-tests-private
528921ca-0a3b-498d-9544-72d802411488
HealthyMCP4OLM
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/mcp-helper.go
func HealthyMCP4OLM(oc *exutil.CLI) bool { return HealthyMCP4Module(oc, "OLM") }
olmv1util
function
openshift/openshift-tests-private
7841c067-3d0a-4198-a96b-e66549b8a636
HealthyMCP4Module
['"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/mcp-helper.go
func HealthyMCP4Module(oc *exutil.CLI, module string) bool { output, err := GetNoEmpty(oc, "mcp", "-ojsonpath={.items..metadata.name}") if err != nil { e2e.Logf("output is %v, error is %v, and try next", output, err) return false } // if your moudle has specific checking or not same checking with OLM. you could add your module branch // and please keep OLM logic if module == "OLM" { mcpNames := strings.Fields(output) // check if there is 2 if len(mcpNames) > 2 { e2e.Logf("there is unexpect mcp: %v", mcpNames) return false } for _, name := range mcpNames { if name != "worker" && name != "master" { e2e.Logf("there is mcp %v which is not expected", name) return false } } workerStatus, err := GetMCPStatus(oc, "worker") if err != nil { e2e.Logf("error is %v", err) return false } if !(strings.Contains(workerStatus.UpdatingStatus, "False") && // strings.Contains(workerStatus.UpdatedStatus, "True") && strings.Compare(workerStatus.MachineCount, workerStatus.ReadyMachineCount) == 0 && strings.Compare(workerStatus.UnavailableMachineCount, workerStatus.DegradedMachineCount) == 0 && strings.Compare(workerStatus.DegradedMachineCount, "0") == 0) { e2e.Logf("mcp worker's status is not correct: %v", workerStatus) return false } masterStatus, err := GetMCPStatus(oc, "master") if err != nil { e2e.Logf("error is %v", err) return false } if !(strings.Contains(masterStatus.UpdatingStatus, "False") && // strings.Contains(masterStatus.UpdatedStatus, "True") && strings.Compare(masterStatus.MachineCount, masterStatus.ReadyMachineCount) == 0 && strings.Compare(masterStatus.UnavailableMachineCount, masterStatus.DegradedMachineCount) == 0 && strings.Compare(masterStatus.DegradedMachineCount, "0") == 0) { e2e.Logf("mcp master's status is not correct:%v", masterStatus) return false } } return true }
olmv1util
function
openshift/openshift-tests-private
f0c71914-1dc2-4023-86f3-d630ab9cf551
GetMCPStatus
['McpStatus']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/mcp-helper.go
func GetMCPStatus(oc *exutil.CLI, name string) (McpStatus, error) { updatingStatus, err := GetNoEmpty(oc, "mcp", name, `-ojsonpath='{.status.conditions[?(@.type=="Updating")].status}'`) if err != nil { return McpStatus{}, err } updatedStatus, err := GetNoEmpty(oc, "mcp", name, `-ojsonpath='{.status.conditions[?(@.type=="Updated")].status}'`) if err != nil { return McpStatus{}, err } machineCount, err := GetNoEmpty(oc, "mcp", name, "-o=jsonpath={..status.machineCount}") if err != nil { return McpStatus{}, err } readyMachineCount, err := GetNoEmpty(oc, "mcp", name, "-o=jsonpath={..status.readyMachineCount}") if err != nil { return McpStatus{}, err } unavailableMachineCount, err := GetNoEmpty(oc, "mcp", name, "-o=jsonpath={..status.unavailableMachineCount}") if err != nil { return McpStatus{}, err } degradedMachineCount, err := GetNoEmpty(oc, "mcp", name, "-o=jsonpath={..status.degradedMachineCount}") if err != nil { return McpStatus{}, err } return McpStatus{ MachineCount: machineCount, ReadyMachineCount: readyMachineCount, UnavailableMachineCount: unavailableMachineCount, DegradedMachineCount: degradedMachineCount, UpdatingStatus: updatingStatus, UpdatedStatus: updatedStatus, }, nil }
olmv1util
file
openshift/openshift-tests-private
ea55408d-12ed-4272-8c7c-5073d184f640
sa-clusterrolebinding
import ( "fmt" o "github.com/onsi/gomega" e2e "k8s.io/kubernetes/test/e2e/framework" exutil "github.com/openshift/openshift-tests-private/test/extended/util" )
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/sa-clusterrolebinding.go
package olmv1util import ( "fmt" o "github.com/onsi/gomega" e2e "k8s.io/kubernetes/test/e2e/framework" exutil "github.com/openshift/openshift-tests-private/test/extended/util" ) type SaCLusterRolebindingDescription struct { Name string Namespace string // if it take admin permssion, no need to setup RBACObjects and take default value RBACObjects []ChildResource Kinds string Template string } func (sacrb *SaCLusterRolebindingDescription) Create(oc *exutil.CLI) { e2e.Logf("=========Create sacrb %v=========", sacrb.Name) err := sacrb.CreateWithoutCheck(oc) o.Expect(err).NotTo(o.HaveOccurred()) if len(sacrb.RBACObjects) != 0 { for _, object := range sacrb.RBACObjects { for _, name := range object.Names { if object.Ns == "" { o.Expect(Appearance(oc, exutil.Appear, object.Kind, name)).To(o.BeTrue()) } else { o.Expect(Appearance(oc, exutil.Appear, object.Kind, name, "-n", object.Ns)).To(o.BeTrue()) } } } } else { o.Expect(Appearance(oc, exutil.Appear, "ServiceAccount", sacrb.Name, "-n", sacrb.Namespace)).To(o.BeTrue()) o.Expect(Appearance(oc, exutil.Appear, "ClusterRole", fmt.Sprintf("%s-installer-admin-clusterrole", sacrb.Name))).To(o.BeTrue()) o.Expect(Appearance(oc, exutil.Appear, "ClusterRoleBinding", fmt.Sprintf("%s-installer-admin-clusterrole-binding", sacrb.Name))).To(o.BeTrue()) } } func (sacrb *SaCLusterRolebindingDescription) CreateWithoutCheck(oc *exutil.CLI) error { e2e.Logf("=========CreateWithoutCheck sacrb %v=========", sacrb.Name) paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", sacrb.Template, "-p"} if len(sacrb.Name) > 0 { paremeters = append(paremeters, "NAME="+sacrb.Name) } if len(sacrb.Namespace) > 0 { paremeters = append(paremeters, "NAMESPACE="+sacrb.Namespace) } if len(sacrb.Kinds) > 0 { paremeters = append(paremeters, "KINDS="+sacrb.Kinds) } err := exutil.ApplyClusterResourceFromTemplateWithError(oc, paremeters...) return err } func (sacrb *SaCLusterRolebindingDescription) Delete(oc *exutil.CLI) { e2e.Logf("=========Delete sacrb %v=========", sacrb.Name) if len(sacrb.RBACObjects) != 0 { for _, object := range sacrb.RBACObjects { for _, name := range object.Names { if object.Ns == "" { Cleanup(oc, object.Kind, name) } else { Cleanup(oc, object.Kind, name, "-n", object.Ns) } } } } else { Cleanup(oc, "ClusterRoleBinding", fmt.Sprintf("%s-installer-admin-clusterrole-binding", sacrb.Name)) Cleanup(oc, "ClusterRole", fmt.Sprintf("%s-installer-admin-clusterrole", sacrb.Name)) Cleanup(oc, "ServiceAccount", sacrb.Name, "-n", sacrb.Namespace) } }
package olmv1util
function
openshift/openshift-tests-private
ee850cb7-57f2-4174-9a22-1f680af2c985
Create
['"fmt"']
['SaCLusterRolebindingDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/sa-clusterrolebinding.go
func (sacrb *SaCLusterRolebindingDescription) Create(oc *exutil.CLI) { e2e.Logf("=========Create sacrb %v=========", sacrb.Name) err := sacrb.CreateWithoutCheck(oc) o.Expect(err).NotTo(o.HaveOccurred()) if len(sacrb.RBACObjects) != 0 { for _, object := range sacrb.RBACObjects { for _, name := range object.Names { if object.Ns == "" { o.Expect(Appearance(oc, exutil.Appear, object.Kind, name)).To(o.BeTrue()) } else { o.Expect(Appearance(oc, exutil.Appear, object.Kind, name, "-n", object.Ns)).To(o.BeTrue()) } } } } else { o.Expect(Appearance(oc, exutil.Appear, "ServiceAccount", sacrb.Name, "-n", sacrb.Namespace)).To(o.BeTrue()) o.Expect(Appearance(oc, exutil.Appear, "ClusterRole", fmt.Sprintf("%s-installer-admin-clusterrole", sacrb.Name))).To(o.BeTrue()) o.Expect(Appearance(oc, exutil.Appear, "ClusterRoleBinding", fmt.Sprintf("%s-installer-admin-clusterrole-binding", sacrb.Name))).To(o.BeTrue()) } }
olmv1util
function
openshift/openshift-tests-private
346faaab-2e7f-42c7-af3a-b4aeebc21f05
CreateWithoutCheck
['SaCLusterRolebindingDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/sa-clusterrolebinding.go
func (sacrb *SaCLusterRolebindingDescription) CreateWithoutCheck(oc *exutil.CLI) error { e2e.Logf("=========CreateWithoutCheck sacrb %v=========", sacrb.Name) paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", sacrb.Template, "-p"} if len(sacrb.Name) > 0 { paremeters = append(paremeters, "NAME="+sacrb.Name) } if len(sacrb.Namespace) > 0 { paremeters = append(paremeters, "NAMESPACE="+sacrb.Namespace) } if len(sacrb.Kinds) > 0 { paremeters = append(paremeters, "KINDS="+sacrb.Kinds) } err := exutil.ApplyClusterResourceFromTemplateWithError(oc, paremeters...) return err }
olmv1util
function
openshift/openshift-tests-private
eed89924-b0cc-4b05-a096-fd656e3d0cab
Delete
['"fmt"']
['SaCLusterRolebindingDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/sa-clusterrolebinding.go
func (sacrb *SaCLusterRolebindingDescription) Delete(oc *exutil.CLI) { e2e.Logf("=========Delete sacrb %v=========", sacrb.Name) if len(sacrb.RBACObjects) != 0 { for _, object := range sacrb.RBACObjects { for _, name := range object.Names { if object.Ns == "" { Cleanup(oc, object.Kind, name) } else { Cleanup(oc, object.Kind, name, "-n", object.Ns) } } } } else { Cleanup(oc, "ClusterRoleBinding", fmt.Sprintf("%s-installer-admin-clusterrole-binding", sacrb.Name)) Cleanup(oc, "ClusterRole", fmt.Sprintf("%s-installer-admin-clusterrole", sacrb.Name)) Cleanup(oc, "ServiceAccount", sacrb.Name, "-n", sacrb.Namespace) } }
olmv1util
file
openshift/openshift-tests-private
6b82d9fd-a766-4ecc-9108-d85578e28335
catalog
import ( "context" "crypto/tls" "encoding/json" "fmt" "io" "net/http" "net/url" "os" "time" g "github.com/onsi/ginkgo/v2" o "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" "strings" exutil "github.com/openshift/openshift-tests-private/test/extended/util" )
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
package olmv1util import ( "context" "crypto/tls" "encoding/json" "fmt" "io" "net/http" "net/url" "os" "time" g "github.com/onsi/ginkgo/v2" o "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" "strings" exutil "github.com/openshift/openshift-tests-private/test/extended/util" ) const ( v1ApiPath = "api/v1" v1ApiData = "all" ) type ClusterCatalogDescription struct { Name string PullSecret string TypeName string Imageref string ContentURL string Status string PollIntervalMinutes string LabelKey string // default is olmv1-test LabelValue string // suggest to use case id Template string } func (clustercatalog *ClusterCatalogDescription) Create(oc *exutil.CLI) { e2e.Logf("=========Create clustercatalog %v=========", clustercatalog.Name) err := clustercatalog.CreateWithoutCheck(oc) o.Expect(err).NotTo(o.HaveOccurred()) clustercatalog.WaitCatalogStatus(oc, "true", "Serving", 0) clustercatalog.GetcontentURL(oc) } func (clustercatalog *ClusterCatalogDescription) CreateWithoutCheck(oc *exutil.CLI) error { paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", clustercatalog.Template, "-p"} if len(clustercatalog.Name) > 0 { paremeters = append(paremeters, "NAME="+clustercatalog.Name) } if len(clustercatalog.PullSecret) > 0 { paremeters = append(paremeters, "SECRET="+clustercatalog.PullSecret) } if len(clustercatalog.TypeName) > 0 { paremeters = append(paremeters, "TYPE="+clustercatalog.TypeName) } if len(clustercatalog.Imageref) > 0 { paremeters = append(paremeters, "IMAGE="+clustercatalog.Imageref) } if len(clustercatalog.PollIntervalMinutes) > 0 { paremeters = append(paremeters, "POLLINTERVALMINUTES="+clustercatalog.PollIntervalMinutes) } if len(clustercatalog.LabelKey) > 0 { paremeters = append(paremeters, "LABELKEY="+clustercatalog.LabelKey) } if len(clustercatalog.LabelValue) > 0 { paremeters = append(paremeters, "LABELVALUE="+clustercatalog.LabelValue) } err := exutil.ApplyClusterResourceFromTemplateWithError(oc, paremeters...) return err } func (clustercatalog *ClusterCatalogDescription) WaitCatalogStatus(oc *exutil.CLI, status string, conditionType string, consistentTime int) { e2e.Logf("========= check clustercatalog %v status is %s =========", clustercatalog.Name, status) jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].status}`, conditionType) errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { output, err := GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", jsonpath) if err != nil { e2e.Logf("output is %v, error is %v, and try next", output, err) return false, nil } if !strings.Contains(strings.ToLower(output), strings.ToLower(status)) { e2e.Logf("status is %v, not %v, and try next", output, status) clustercatalog.Status = output return false, nil } return true, nil }) if errWait != nil { GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o=jsonpath-as-json={.status}") exutil.AssertWaitPollNoErr(errWait, fmt.Sprintf("clustercatalog status is not %s", status)) } if consistentTime != 0 { e2e.Logf("make sure clustercatalog %s status is %s consistently for %ds", clustercatalog.Name, status, consistentTime) o.Consistently(func() string { output, _ := GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", jsonpath) return strings.ToLower(output) }, time.Duration(consistentTime)*time.Second, 5*time.Second).Should(o.ContainSubstring(strings.ToLower(status)), "clustercatalog %s status is not %s", clustercatalog.Name, status) } } func (clustercatalog *ClusterCatalogDescription) CheckClusterCatalogCondition(oc *exutil.CLI, conditionType, field, expect string, checkInterval, checkTimeout, consistentTime int) { e2e.Logf("========= check clustercatalog %v %s %s expect is %s =========", clustercatalog.Name, conditionType, field, expect) jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].%s}`, conditionType, field) errWait := wait.PollUntilContextTimeout(context.TODO(), time.Duration(checkInterval)*time.Second, time.Duration(checkTimeout)*time.Second, false, func(ctx context.Context) (bool, error) { output, err := GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", jsonpath) if err != nil { e2e.Logf("output is %v, error is %v, and try next", output, err) return false, nil } if !strings.Contains(strings.ToLower(output), strings.ToLower(expect)) { e2e.Logf("got is %v, not %v, and try next", output, expect) return false, nil } return true, nil }) if errWait != nil { GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o=jsonpath-as-json={.status}") exutil.AssertWaitPollNoErr(errWait, fmt.Sprintf("clustercatalog %s expected is not %s in %v seconds", conditionType, expect, checkTimeout)) } if consistentTime != 0 { e2e.Logf("make sure clustercatalog %s expect is %s consistently for %ds", conditionType, expect, consistentTime) o.Consistently(func() string { output, _ := GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", jsonpath) return strings.ToLower(output) }, time.Duration(consistentTime)*time.Second, 5*time.Second).Should(o.ContainSubstring(strings.ToLower(expect)), "clustercatalog %s expected is not %s", conditionType, expect) } } func (clustercatalog *ClusterCatalogDescription) GetcontentURL(oc *exutil.CLI) { e2e.Logf("=========Get clustercatalog %v contentURL =========", clustercatalog.Name) route, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("route", "catalogd-service", "-n", "openshift-catalogd", "-o=jsonpath={.spec.host}").Output() if err != nil && !strings.Contains(route, "NotFound") { o.Expect(err).NotTo(o.HaveOccurred()) } if route == "" || err != nil { output, err := oc.AsAdmin().WithoutNamespace().Run("create").Args("route", "reencrypt", "--service=catalogd-service", "-n", "openshift-catalogd").Output() e2e.Logf("output is %v, error is %v", output, err) errWait := wait.PollUntilContextTimeout(context.TODO(), 2*time.Second, 10*time.Second, false, func(ctx context.Context) (bool, error) { route, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("route", "catalogd-service", "-n", "openshift-catalogd", "-o=jsonpath={.spec.host}").Output() if err != nil { e2e.Logf("output is %v, error is %v, and try next", route, err) return false, nil } if route == "" { e2e.Logf("route is empty") return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "get route catalogd-service failed") } o.Expect(route).To(o.ContainSubstring("catalogd-service-openshift-catalogd")) contentURL, err := GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", "jsonpath={.status.urls.base}") o.Expect(err).NotTo(o.HaveOccurred()) contentURL = contentURL + "/" + v1ApiPath + "/" + v1ApiData clustercatalog.ContentURL = strings.Replace(contentURL, "catalogd-service.openshift-catalogd.svc", route, 1) e2e.Logf("clustercatalog contentURL is %s", clustercatalog.ContentURL) } func (clustercatalog *ClusterCatalogDescription) DeleteWithoutCheck(oc *exutil.CLI) { e2e.Logf("=========DeleteWithoutCheck clustercatalog %v=========", clustercatalog.Name) exutil.CleanupResource(oc, 4*time.Second, 160*time.Second, exutil.AsAdmin, exutil.WithoutNamespace, "clustercatalog", clustercatalog.Name) } func (clustercatalog *ClusterCatalogDescription) Delete(oc *exutil.CLI) { e2e.Logf("=========Delete clustercatalog %v=========", clustercatalog.Name) clustercatalog.DeleteWithoutCheck(oc) //add check later } func (clustercatalog *ClusterCatalogDescription) Patch(oc *exutil.CLI, patch string) { _, err := oc.AsAdmin().WithoutNamespace().Run("patch").Args("clustercatalog", clustercatalog.Name, "--type", "merge", "-p", patch).Output() o.Expect(err).NotTo(o.HaveOccurred()) } // Get clustercatalog info content func (clustercatalog *ClusterCatalogDescription) GetContent(oc *exutil.CLI) []byte { if clustercatalog.ContentURL == "" { clustercatalog.GetcontentURL(oc) } var proxy string if os.Getenv("http_proxy") != "" { proxy = os.Getenv("http_proxy") } else if os.Getenv("https_proxy") != "" { proxy = os.Getenv("https_proxy") } else if os.Getenv("HTTP_PROXY") != "" { proxy = os.Getenv("HTTP_PROXY") } else if os.Getenv("HTTPS_PROXY") != "" { proxy = os.Getenv("HTTPS_PROXY") } var tr *http.Transport if len(proxy) > 0 { e2e.Logf("take proxy to access cluster") proxyURL, err := url.Parse(proxy) o.Expect(err).NotTo(o.HaveOccurred()) tr = &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, Proxy: http.ProxyURL(proxyURL), } } else { tr = &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, } } client := &http.Client{Transport: tr} resp, err := client.Get(clustercatalog.ContentURL) defer func() { err := resp.Body.Close() if err != nil { e2e.Logf("Error closing body: %v", err) } }() if err != nil && strings.Contains(err.Error(), "Service Unavailable") { g.Skip("the service can not be accessable with Service Unavailable") } o.Expect(err).NotTo(o.HaveOccurred()) curlOutput, err := io.ReadAll(resp.Body) o.Expect(err).NotTo(o.HaveOccurred()) return curlOutput } // RelatedImagesInfo returns the relatedImages info type RelatedImagesInfo struct { Image string `json:"image"` Name string `json:"name"` } // BundleData returns the bundle info type BundleData struct { Image string `json:"image"` Name string `json:"name"` Package string `json:"package"` RelatedImages []RelatedImagesInfo `json:"relatedImages"` Schema string `json:"schema"` Properties json.RawMessage `json:"properties"` // properties data are complex and will be output as strings } func GetBundlesName(bundlesDataOut []BundleData) []string { var bundlesName []string var singleBundleData BundleData for _, singleBundleData = range bundlesDataOut { bundlesName = append(bundlesName, singleBundleData.Name) } return bundlesName } func GetBundlesNameByPakcage(bundlesDataOut []BundleData, packageName string) []string { var bundlesName []string var singleBundleData BundleData for _, singleBundleData = range bundlesDataOut { if singleBundleData.Package == packageName { bundlesName = append(bundlesName, singleBundleData.Name) } } return bundlesName } func GetBundlesImageTag(bundlesDataOut []BundleData) []string { var bundlesName []string var singleBundleData BundleData for _, singleBundleData = range bundlesDataOut { bundlesName = append(bundlesName, singleBundleData.Image) } return bundlesName } func GetBundleInfoByName(bundlesDataOut []BundleData, packageName string, bundleName string) *BundleData { var singleBundleData BundleData for _, singleBundleData = range bundlesDataOut { if singleBundleData.Name == bundleName && singleBundleData.Package == packageName { return &singleBundleData } } return nil } // EntriesInfo returns the entries info type EntriesInfo struct { Name string `json:"name"` Replaces string `json:"replaces"` Skips []string `json:"skips"` } // ChannelData returns the channel info type ChannelData struct { Entries []EntriesInfo `json:"entries"` Name string `json:"name"` Package string `json:"package"` Schema string `json:"schema"` } func GetChannelByPakcage(channelDataOut []ChannelData, packageName string) []ChannelData { var channelDataByPackage []ChannelData var singleChannelData ChannelData for _, singleChannelData = range channelDataOut { if singleChannelData.Package == packageName { channelDataByPackage = append(channelDataByPackage, singleChannelData) } } return channelDataByPackage } func GetChannelNameByPakcage(channelDataOut []ChannelData, packageName string) []string { var channelsName []string var singleChannelData ChannelData for _, singleChannelData = range channelDataOut { if singleChannelData.Package == packageName { channelsName = append(channelsName, singleChannelData.Name) } } return channelsName } // PackageData returns the package info type PackageData struct { DefaultChannel string `json:"defaultChannel"` Name string `json:"name"` Schema string `json:"schema"` } func ListPackagesName(packageDataOut []PackageData) []string { var packagesName []string var singlePackageData PackageData for _, singlePackageData = range packageDataOut { packagesName = append(packagesName, singlePackageData.Name) } return packagesName } // ReferenceInfo returns the Reference info type ReferenceInfo struct { Name string `json:"name"` Schema string `json:"schema"` } // EntriesInfo returns the entries info type DeprecatedEntriesInfo struct { Message string `json:"message"` Reference ReferenceInfo `json:"reference"` } // DeprecationData returns the deprecated info type DeprecationData struct { Entries []DeprecatedEntriesInfo `json:"entries"` Package string `json:"package"` Schema string `json:"schema"` } func GetDeprecatedChannelNameByPakcage(deprecationDataOut []DeprecationData, packageName string) []string { var channelsName []string var singleDeprecationData DeprecationData var deprecatedEntriesInfo DeprecatedEntriesInfo for _, singleDeprecationData = range deprecationDataOut { if singleDeprecationData.Package == packageName { for _, deprecatedEntriesInfo = range singleDeprecationData.Entries { if deprecatedEntriesInfo.Reference.Schema == "olm.channel" { channelsName = append(channelsName, deprecatedEntriesInfo.Reference.Name) } } } } return channelsName } func GetDeprecatedBundlesNameByPakcage(deprecationDataOut []DeprecationData, packageName string) []string { var bundlesName []string var singleDeprecationData DeprecationData var deprecatedEntriesInfo DeprecatedEntriesInfo for _, singleDeprecationData = range deprecationDataOut { if singleDeprecationData.Package == packageName { for _, deprecatedEntriesInfo = range singleDeprecationData.Entries { if deprecatedEntriesInfo.Reference.Schema == "olm.bundle" { bundlesName = append(bundlesName, deprecatedEntriesInfo.Reference.Name) } } } } return bundlesName } type ContentData struct { Packages []PackageData Channels []ChannelData Bundles []BundleData Deprecations []DeprecationData } // Unmarshal Content func (clustercatalog *ClusterCatalogDescription) UnmarshalContent(oc *exutil.CLI, schema string) (ContentData, error) { var ( singlePackageData PackageData singleChannelData ChannelData singleBundleData BundleData singleDeprecationData DeprecationData ContentData ContentData targetData interface{} err error ) switch schema { case "all": return clustercatalog.UnmarshalAllContent(oc) case "bundle": targetData = &singleBundleData case "channel": targetData = &singleChannelData case "package": targetData = &singlePackageData case "deprecations": targetData = &singleDeprecationData default: return ContentData, fmt.Errorf("unsupported schema: %s", schema) } contents := clustercatalog.GetContent(oc) lines := strings.Split(string(contents), "\n") for _, line := range lines { if strings.Contains(line, "\"schema\":\"olm."+schema+"\"") { if err = json.Unmarshal([]byte(line), targetData); err != nil { return ContentData, err } switch schema { case "bundle": ContentData.Bundles = append(ContentData.Bundles, singleBundleData) case "channel": ContentData.Channels = append(ContentData.Channels, singleChannelData) case "package": ContentData.Packages = append(ContentData.Packages, singlePackageData) case "deprecations": ContentData.Deprecations = append(ContentData.Deprecations, singleDeprecationData) } } } err = nil switch schema { case "bundle": if len(ContentData.Bundles) == 0 { err = fmt.Errorf("can not get Bundles") } case "channel": if len(ContentData.Channels) == 0 { err = fmt.Errorf("can not get Channels") } case "package": if len(ContentData.Packages) == 0 { err = fmt.Errorf("can not get Packages") } case "deprecations": if len(ContentData.Deprecations) == 0 { err = fmt.Errorf("can not get Deprecations") } } return ContentData, err } func (clustercatalog *ClusterCatalogDescription) UnmarshalAllContent(oc *exutil.CLI) (ContentData, error) { var ContentData ContentData contents := clustercatalog.GetContent(oc) lines := strings.Split(string(contents), "\n") for _, line := range lines { if strings.Contains(line, "\"schema\":\"olm.bundle\"") || strings.Contains(line, "\"schema\":\"olm.channel\"") || strings.Contains(line, "\"schema\":\"olm.package\"") || strings.Contains(line, "\"schema\":\"olm.deprecations\"") { var targetData interface{} switch { case strings.Contains(line, "\"schema\":\"olm.bundle\""): targetData = new(BundleData) case strings.Contains(line, "\"schema\":\"olm.channel\""): targetData = new(ChannelData) case strings.Contains(line, "\"schema\":\"olm.package\""): targetData = new(PackageData) case strings.Contains(line, "\"schema\":\"olm.deprecations\""): targetData = new(DeprecationData) } if err := json.Unmarshal([]byte(line), targetData); err != nil { return ContentData, err } switch data := targetData.(type) { case *BundleData: ContentData.Bundles = append(ContentData.Bundles, *data) case *ChannelData: ContentData.Channels = append(ContentData.Channels, *data) case *PackageData: ContentData.Packages = append(ContentData.Packages, *data) case *DeprecationData: ContentData.Deprecations = append(ContentData.Deprecations, *data) } } } if len(ContentData.Bundles) == 0 && len(ContentData.Channels) == 0 && len(ContentData.Packages) == 0 && len(ContentData.Deprecations) == 0 { return ContentData, fmt.Errorf("no any bundle, channel or package are got") } return ContentData, nil }
package olmv1util
function
openshift/openshift-tests-private
20eb4a16-ac7f-452b-a122-03d13242dfd8
Create
['ClusterCatalogDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func (clustercatalog *ClusterCatalogDescription) Create(oc *exutil.CLI) { e2e.Logf("=========Create clustercatalog %v=========", clustercatalog.Name) err := clustercatalog.CreateWithoutCheck(oc) o.Expect(err).NotTo(o.HaveOccurred()) clustercatalog.WaitCatalogStatus(oc, "true", "Serving", 0) clustercatalog.GetcontentURL(oc) }
olmv1util
function
openshift/openshift-tests-private
d55c2a40-652e-4de2-8aad-4d2e11d412b9
CreateWithoutCheck
['ClusterCatalogDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func (clustercatalog *ClusterCatalogDescription) CreateWithoutCheck(oc *exutil.CLI) error { paremeters := []string{"-n", "default", "--ignore-unknown-parameters=true", "-f", clustercatalog.Template, "-p"} if len(clustercatalog.Name) > 0 { paremeters = append(paremeters, "NAME="+clustercatalog.Name) } if len(clustercatalog.PullSecret) > 0 { paremeters = append(paremeters, "SECRET="+clustercatalog.PullSecret) } if len(clustercatalog.TypeName) > 0 { paremeters = append(paremeters, "TYPE="+clustercatalog.TypeName) } if len(clustercatalog.Imageref) > 0 { paremeters = append(paremeters, "IMAGE="+clustercatalog.Imageref) } if len(clustercatalog.PollIntervalMinutes) > 0 { paremeters = append(paremeters, "POLLINTERVALMINUTES="+clustercatalog.PollIntervalMinutes) } if len(clustercatalog.LabelKey) > 0 { paremeters = append(paremeters, "LABELKEY="+clustercatalog.LabelKey) } if len(clustercatalog.LabelValue) > 0 { paremeters = append(paremeters, "LABELVALUE="+clustercatalog.LabelValue) } err := exutil.ApplyClusterResourceFromTemplateWithError(oc, paremeters...) return err }
olmv1util
function
openshift/openshift-tests-private
2a53695c-da7e-4e6b-bd8b-393a05e86c36
WaitCatalogStatus
['"context"', '"encoding/json"', '"fmt"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', '"strings"']
['ClusterCatalogDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func (clustercatalog *ClusterCatalogDescription) WaitCatalogStatus(oc *exutil.CLI, status string, conditionType string, consistentTime int) { e2e.Logf("========= check clustercatalog %v status is %s =========", clustercatalog.Name, status) jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].status}`, conditionType) errWait := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { output, err := GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", jsonpath) if err != nil { e2e.Logf("output is %v, error is %v, and try next", output, err) return false, nil } if !strings.Contains(strings.ToLower(output), strings.ToLower(status)) { e2e.Logf("status is %v, not %v, and try next", output, status) clustercatalog.Status = output return false, nil } return true, nil }) if errWait != nil { GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o=jsonpath-as-json={.status}") exutil.AssertWaitPollNoErr(errWait, fmt.Sprintf("clustercatalog status is not %s", status)) } if consistentTime != 0 { e2e.Logf("make sure clustercatalog %s status is %s consistently for %ds", clustercatalog.Name, status, consistentTime) o.Consistently(func() string { output, _ := GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", jsonpath) return strings.ToLower(output) }, time.Duration(consistentTime)*time.Second, 5*time.Second).Should(o.ContainSubstring(strings.ToLower(status)), "clustercatalog %s status is not %s", clustercatalog.Name, status) } }
olmv1util
function
openshift/openshift-tests-private
9874cc77-455f-4b30-b4b9-21a3dbad7187
CheckClusterCatalogCondition
['"context"', '"encoding/json"', '"fmt"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', '"strings"']
['ClusterCatalogDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func (clustercatalog *ClusterCatalogDescription) CheckClusterCatalogCondition(oc *exutil.CLI, conditionType, field, expect string, checkInterval, checkTimeout, consistentTime int) { e2e.Logf("========= check clustercatalog %v %s %s expect is %s =========", clustercatalog.Name, conditionType, field, expect) jsonpath := fmt.Sprintf(`jsonpath={.status.conditions[?(@.type=="%s")].%s}`, conditionType, field) errWait := wait.PollUntilContextTimeout(context.TODO(), time.Duration(checkInterval)*time.Second, time.Duration(checkTimeout)*time.Second, false, func(ctx context.Context) (bool, error) { output, err := GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", jsonpath) if err != nil { e2e.Logf("output is %v, error is %v, and try next", output, err) return false, nil } if !strings.Contains(strings.ToLower(output), strings.ToLower(expect)) { e2e.Logf("got is %v, not %v, and try next", output, expect) return false, nil } return true, nil }) if errWait != nil { GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o=jsonpath-as-json={.status}") exutil.AssertWaitPollNoErr(errWait, fmt.Sprintf("clustercatalog %s expected is not %s in %v seconds", conditionType, expect, checkTimeout)) } if consistentTime != 0 { e2e.Logf("make sure clustercatalog %s expect is %s consistently for %ds", conditionType, expect, consistentTime) o.Consistently(func() string { output, _ := GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", jsonpath) return strings.ToLower(output) }, time.Duration(consistentTime)*time.Second, 5*time.Second).Should(o.ContainSubstring(strings.ToLower(expect)), "clustercatalog %s expected is not %s", conditionType, expect) } }
olmv1util
function
openshift/openshift-tests-private
1cc64147-b732-47ef-8a9e-b8f492df0ce5
GetcontentURL
['"context"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', '"strings"']
['ClusterCatalogDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func (clustercatalog *ClusterCatalogDescription) GetcontentURL(oc *exutil.CLI) { e2e.Logf("=========Get clustercatalog %v contentURL =========", clustercatalog.Name) route, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("route", "catalogd-service", "-n", "openshift-catalogd", "-o=jsonpath={.spec.host}").Output() if err != nil && !strings.Contains(route, "NotFound") { o.Expect(err).NotTo(o.HaveOccurred()) } if route == "" || err != nil { output, err := oc.AsAdmin().WithoutNamespace().Run("create").Args("route", "reencrypt", "--service=catalogd-service", "-n", "openshift-catalogd").Output() e2e.Logf("output is %v, error is %v", output, err) errWait := wait.PollUntilContextTimeout(context.TODO(), 2*time.Second, 10*time.Second, false, func(ctx context.Context) (bool, error) { route, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("route", "catalogd-service", "-n", "openshift-catalogd", "-o=jsonpath={.spec.host}").Output() if err != nil { e2e.Logf("output is %v, error is %v, and try next", route, err) return false, nil } if route == "" { e2e.Logf("route is empty") return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(errWait, "get route catalogd-service failed") } o.Expect(route).To(o.ContainSubstring("catalogd-service-openshift-catalogd")) contentURL, err := GetNoEmpty(oc, "clustercatalog", clustercatalog.Name, "-o", "jsonpath={.status.urls.base}") o.Expect(err).NotTo(o.HaveOccurred()) contentURL = contentURL + "/" + v1ApiPath + "/" + v1ApiData clustercatalog.ContentURL = strings.Replace(contentURL, "catalogd-service.openshift-catalogd.svc", route, 1) e2e.Logf("clustercatalog contentURL is %s", clustercatalog.ContentURL) }
olmv1util
function
openshift/openshift-tests-private
dbab05c5-4fd2-4d23-9bb9-1953de7b398d
DeleteWithoutCheck
['"time"']
['ClusterCatalogDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func (clustercatalog *ClusterCatalogDescription) DeleteWithoutCheck(oc *exutil.CLI) { e2e.Logf("=========DeleteWithoutCheck clustercatalog %v=========", clustercatalog.Name) exutil.CleanupResource(oc, 4*time.Second, 160*time.Second, exutil.AsAdmin, exutil.WithoutNamespace, "clustercatalog", clustercatalog.Name) }
olmv1util
function
openshift/openshift-tests-private
ae390964-d8e9-4368-94d9-92c8d4583af8
Delete
['ClusterCatalogDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func (clustercatalog *ClusterCatalogDescription) Delete(oc *exutil.CLI) { e2e.Logf("=========Delete clustercatalog %v=========", clustercatalog.Name) clustercatalog.DeleteWithoutCheck(oc) //add check later }
olmv1util
function
openshift/openshift-tests-private
a9008c12-6d8d-44a5-ad1f-20f66b37dda0
Patch
['ClusterCatalogDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func (clustercatalog *ClusterCatalogDescription) Patch(oc *exutil.CLI, patch string) { _, err := oc.AsAdmin().WithoutNamespace().Run("patch").Args("clustercatalog", clustercatalog.Name, "--type", "merge", "-p", patch).Output() o.Expect(err).NotTo(o.HaveOccurred()) }
olmv1util
function
openshift/openshift-tests-private
3168f72c-9449-4d26-bf17-b7ae8c382482
GetContent
['"crypto/tls"', '"io"', '"net/http"', '"net/url"', '"os"', '"strings"']
['ClusterCatalogDescription']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func (clustercatalog *ClusterCatalogDescription) GetContent(oc *exutil.CLI) []byte { if clustercatalog.ContentURL == "" { clustercatalog.GetcontentURL(oc) } var proxy string if os.Getenv("http_proxy") != "" { proxy = os.Getenv("http_proxy") } else if os.Getenv("https_proxy") != "" { proxy = os.Getenv("https_proxy") } else if os.Getenv("HTTP_PROXY") != "" { proxy = os.Getenv("HTTP_PROXY") } else if os.Getenv("HTTPS_PROXY") != "" { proxy = os.Getenv("HTTPS_PROXY") } var tr *http.Transport if len(proxy) > 0 { e2e.Logf("take proxy to access cluster") proxyURL, err := url.Parse(proxy) o.Expect(err).NotTo(o.HaveOccurred()) tr = &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, Proxy: http.ProxyURL(proxyURL), } } else { tr = &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, } } client := &http.Client{Transport: tr} resp, err := client.Get(clustercatalog.ContentURL) defer func() { err := resp.Body.Close() if err != nil { e2e.Logf("Error closing body: %v", err) } }() if err != nil && strings.Contains(err.Error(), "Service Unavailable") { g.Skip("the service can not be accessable with Service Unavailable") } o.Expect(err).NotTo(o.HaveOccurred()) curlOutput, err := io.ReadAll(resp.Body) o.Expect(err).NotTo(o.HaveOccurred()) return curlOutput }
olmv1util
function
openshift/openshift-tests-private
0ec52049-28db-47f3-bb86-4bf364409101
GetBundlesName
['BundleData']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func GetBundlesName(bundlesDataOut []BundleData) []string { var bundlesName []string var singleBundleData BundleData for _, singleBundleData = range bundlesDataOut { bundlesName = append(bundlesName, singleBundleData.Name) } return bundlesName }
olmv1util
function
openshift/openshift-tests-private
e013e2f1-8cb5-4fb9-86c8-c9780fa98187
GetBundlesNameByPakcage
['BundleData']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func GetBundlesNameByPakcage(bundlesDataOut []BundleData, packageName string) []string { var bundlesName []string var singleBundleData BundleData for _, singleBundleData = range bundlesDataOut { if singleBundleData.Package == packageName { bundlesName = append(bundlesName, singleBundleData.Name) } } return bundlesName }
olmv1util
function
openshift/openshift-tests-private
d35b6952-a7f7-4de1-987e-c06ca3a05e26
GetBundlesImageTag
['BundleData']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func GetBundlesImageTag(bundlesDataOut []BundleData) []string { var bundlesName []string var singleBundleData BundleData for _, singleBundleData = range bundlesDataOut { bundlesName = append(bundlesName, singleBundleData.Image) } return bundlesName }
olmv1util
function
openshift/openshift-tests-private
d12be740-3868-4a63-8b7f-70ac31cf16f0
GetBundleInfoByName
['BundleData']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func GetBundleInfoByName(bundlesDataOut []BundleData, packageName string, bundleName string) *BundleData { var singleBundleData BundleData for _, singleBundleData = range bundlesDataOut { if singleBundleData.Name == bundleName && singleBundleData.Package == packageName { return &singleBundleData } } return nil }
olmv1util
function
openshift/openshift-tests-private
8b6e40fd-7b88-4d10-9f16-a3bda08a5c40
GetChannelByPakcage
['ChannelData']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func GetChannelByPakcage(channelDataOut []ChannelData, packageName string) []ChannelData { var channelDataByPackage []ChannelData var singleChannelData ChannelData for _, singleChannelData = range channelDataOut { if singleChannelData.Package == packageName { channelDataByPackage = append(channelDataByPackage, singleChannelData) } } return channelDataByPackage }
olmv1util
function
openshift/openshift-tests-private
dbc3925c-fdd6-4872-8553-b83297ebecb4
GetChannelNameByPakcage
['ChannelData']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func GetChannelNameByPakcage(channelDataOut []ChannelData, packageName string) []string { var channelsName []string var singleChannelData ChannelData for _, singleChannelData = range channelDataOut { if singleChannelData.Package == packageName { channelsName = append(channelsName, singleChannelData.Name) } } return channelsName }
olmv1util
function
openshift/openshift-tests-private
06ea8249-ccdf-43c5-9e15-15f7a74b7803
ListPackagesName
['PackageData']
github.com/openshift/openshift-tests-private/test/extended/operators/olmv1util/catalog.go
func ListPackagesName(packageDataOut []PackageData) []string { var packagesName []string var singlePackageData PackageData for _, singlePackageData = range packageDataOut { packagesName = append(packagesName, singlePackageData.Name) } return packagesName }
olmv1util