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
3d146f16-bd8f-4805-9c3f-ad2f0ad181af
Author:jiazha-Medium-53914-OLM controller plug-in for openshift-* namespace labelling [Serial]
['"context"', '"fmt"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-Medium-53914-OLM controller plug-in for openshift-* namespace labelling [Serial]", func() { // openshifttest-53914 without openshift- prefix // openshift-test-53914 without the `security.openshift.io/scc.podSecurityLabelSync=true` label // openshift-test-53914 with the `security.openshift.io/scc.podSecurityLabelSync=true` label exutil.By("Starting ../ prepare projects") projects := []projectDescription{ {name: "openshifttest-53914", targetNamespace: ""}, {name: "openshift-test1-53914", targetNamespace: ""}, {name: "openshift-test2-53914", targetNamespace: ""}, {name: "default", targetNamespace: ""}, {name: "openshift-test3-53914", targetNamespace: ""}, {name: "openshift-operators", targetNamespace: ""}, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") for i, project := range projects { exutil.By(fmt.Sprintf("step-%d, subscribe to learn perator v0.0.3 in project %s", i, project.name)) if project.name != "default" && project.name != "openshift-operators" { project.createwithCheck(oc, itName, dr) defer func(p projectDescription) { p.deleteWithForce(oc) }(project) } // this project just for verifying the Copied CSV if project.name == "openshift-test3-53914" { continue } if project.name == "openshift-test2-53914" { _, err := oc.AsAdmin().WithoutNamespace().Run("label").Args("ns", project.name, "security.openshift.io/scc.podSecurityLabelSync=false").Output() if err != nil { e2e.Failf("Fail to label project %s with security.openshift.io/scc.podSecurityLabelSync=false, error:%v", project.name, err) } } var og operatorGroupDescription if project.name != "openshift-operators" { og = operatorGroupDescription{ name: fmt.Sprintf("og%d-53914", i), namespace: project.name, template: ogSingleTemplate, } defer og.delete(itName, dr) og.createwithCheck(oc, itName, dr) } var single bool if project.name == "openshift-operators" { single = false } else { single = true } sub := subscriptionDescription{ subName: fmt.Sprintf("sub%d-53914", i), namespace: project.name, catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: single, template: subTemplate, } defer sub.delete(itName, dr) defer func() { if sub.installedCSV == "" { sub.findInstalledCSV(oc, itName, dr) } sub.deleteCSV(itName, dr) }() sub.create(oc, itName, dr) // skip default namespace's csv status checking since it will fail due to PSA issue if project.name == "default" { // it takes a long time to update to the Failed status newCheck("present", asAdmin, withoutNamespace, true, "", ok, []string{"csv", "learn-operator.v0.0.3", "-n", project.name}).check(oc) } else { newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded-TIME-WAIT-120s", ok, []string{"csv", "learn-operator.v0.0.3", "-n", project.name, "-o=jsonpath={.status.phase}"}).check(oc) } labels, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("ns", project.name, "-o=jsonpath={.metadata.labels}").Output() if err != nil { e2e.Failf("Fail to get project %s labels, error:%v", project, err) } switch { case project.name == "openshifttest-53914": if strings.Contains(labels, "\"security.openshift.io/scc.podSecurityLabelSync\":\"true\"") { e2e.Failf("project %s should NOT be labeled with security.openshift.io/scc.podSecurityLabelSync=true, labels:%s", project.name, labels) } case project.name == "openshift-test-53914": if !strings.Contains(labels, "\"security.openshift.io/scc.podSecurityLabelSync\":\"true\"") { e2e.Failf("project %s should be labeled with security.openshift.io/scc.podSecurityLabelSync=true, labels:%s", project.name, labels) } case project.name == "openshift-test2-53914": if strings.Contains(labels, "\"security.openshift.io/scc.podSecurityLabelSync\":\"true\"") { e2e.Failf("project %s should NOT be updated with security.openshift.io/scc.podSecurityLabelSync=true, labels:%s", project.name, labels) } // project should be re-labeled with `security.openshift.io/scc.podSecurityLabelSync=true` after `security.openshift.io/scc.podSecurityLabelSync=false` removed _, err := oc.AsAdmin().WithoutNamespace().Run("label").Args("ns", project.name, "security.openshift.io/scc.podSecurityLabelSync-").Output() if err != nil { e2e.Failf("Fail to unlabel project %s with security.openshift.io/scc.podSecurityLabelSync-, error:%v", project.name, err) } err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { labels, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("ns", project.name, "-o=jsonpath={.metadata.labels}").Output() if err != nil || !strings.Contains(labels, "\"security.openshift.io/scc.podSecurityLabelSync\":\"true\"") { e2e.Logf("The label not updated, re-try: %s", err) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "Fail to re-label project openshift-test2-53914 after 60s!") case project.name == "default": if strings.Contains(labels, "\"security.openshift.io/scc.podSecurityLabelSync\":\"true\"") { e2e.Failf("project %s should NOT be labeled with security.openshift.io/scc.podSecurityLabelSync=true, labels:%s", project.name, labels) } case project.name == "openshift-operators": if !strings.Contains(labels, "\"security.openshift.io/scc.podSecurityLabelSync\":\"true\"") { e2e.Failf("project %s should be labeled with security.openshift.io/scc.podSecurityLabelSync=true, labels:%s", project.name, labels) } // The project with a copied CSV in should NOT be labeled with security.openshift.io/scc.podSecurityLabelSync=true labels, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("ns", "openshift-test3-53914", "-o=jsonpath={.metadata.labels}").Output() if err != nil { e2e.Failf("Fail to get project openshift-test3-53914 labels:%s, error:%v", err, labels) } if strings.Contains(labels, "\"security.openshift.io/scc.podSecurityLabelSync\":\"true\"") { e2e.Failf("project openshift-test-53914 should NOT be labeled with security.openshift.io/scc.podSecurityLabelSync=true since copied CSV, labels:%s", labels) } } sub.delete(itName, dr) sub.deleteCSV(itName, dr) if project.name != "openshifttest-53914" && project.name != "default" { // The `security.openshift.io/scc.podSecurityLabelSync=true` won't be removed. err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) { labels, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("ns", project.name, "-o=jsonpath={.metadata.labels}").Output() if err != nil || !strings.Contains(labels, "\"security.openshift.io/scc.podSecurityLabelSync\":\"true\"") { e2e.Logf("security.openshift.io/scc.podSecurityLabelSync=true should NOT be removed from project %s after CSV removed, labels:%s", project.name, labels) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("The security.openshift.io/scc.podSecurityLabelSync=true label of project:%s should NOT be removed!", project.name)) } } })
test case
openshift/openshift-tests-private
5392da8a-c288-41b8-8256-5e3ab3bcdc57
ConnectedOnly-Author:jiazha-DEPRECATED-High-54233-Add the PO/rukpak components to the OCP payload
['"context"', '"fmt"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:jiazha-DEPRECATED-High-54233-Add the PO/rukpak components to the OCP payload", func() { featureSet, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("featuregate", "cluster", "-o=jsonpath={.spec.featureSet}").Output() if err != nil { e2e.Failf("Fail to get the featureSet: %s, error:%v", featureSet, err) } // The FeatureGate "cluster" is invalid: spec.featureSet: Forbidden: once enabled, custom feature gates may not be disabled if featureSet != "" && featureSet != "TechPreviewNoUpgrade" { g.Skip(fmt.Sprintf("featureSet is not TechPreviewNoUpgrade, but %s", featureSet)) } // skip it if featureSet is empty if featureSet == "" { g.Skip("featureSet is empty, skip it") // _, err = oc.AsAdmin().WithoutNamespace().Run("patch").Args("featuregate", "cluster", "-p", "{\"spec\": {\"featureSet\": \"TechPreviewNoUpgrade\"}}", "--type=merge").Output() // if err != nil { // e2e.Failf("Fail to enable TechPreviewNoUpgrade, error:%v", err) // } // err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) { // _, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("platformoperator").Output() // if err != nil { // e2e.Logf("The platformoperator resource not ready, re-try: %s", err) // return false, nil // } // return true, nil // }) // exutil.AssertWaitPollNoErr(err, "The platformoperator resource not ready after 120s!") } buildPruningBaseDir := exutil.FixturePath("testdata", "olm") poTemplate := filepath.Join(buildPruningBaseDir, "platform_operator.yaml") // install an invalid platform operator: external-dns-operator, it should be failed as expected invalid_po := "external-dns-operator" err = applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", poTemplate, "-p", fmt.Sprintf("NAME=%s", invalid_po), fmt.Sprintf("PACKAGE=%s", invalid_po)) if err != nil { e2e.Failf("Failed to create PO %s: %s", invalid_po, err) } // delete it once case done defer func() { _, err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("platformoperator", invalid_po).Output() if err != nil { e2e.Failf("! fail to delete PO %s: %s", invalid_po, err) } }() err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("platformoperator", invalid_po, "-o=jsonpath={.status.conditions[0].message}").Output() if err != nil { e2e.Failf("! fail to get PO %s message: %s", invalid_po, err) } if !strings.Contains(msg, "AllNamespace install mode must be enabled") { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("PO %s not failed as expected!", invalid_po)) // install an valid platform operator: quay-operator, it should be created success err = applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", poTemplate, "-p", "NAME=quay-operator", "PACKAGE=quay-operator") if err != nil { e2e.Failf("Failed to create PO quay operator: %s", err) } // delete it once case done defer func() { _, err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("platformoperator", "quay-operator").Output() if err != nil { e2e.Failf("! fail to delete PO quay-operator: %s", err) } }() err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { status, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("platformoperator", "quay-operator", "-o=jsonpath={.status.conditions[0].status}").Output() if err != nil { e2e.Failf("! fail to PO quay operator: %s", err) } if status != "True" { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "failed to install PO quay operator!") })
test case
openshift/openshift-tests-private
dcfdd209-d932-43ef-a9e1-46251765e709
Author:jiazha-NonHyperShiftHOST-Medium-53759-Opeatorhub status shows errors after disabling default catalogSources [Disruptive]
['"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-NonHyperShiftHOST-Medium-53759-Opeatorhub status shows errors after disabling default catalogSources [Disruptive]", func() { exutil.By("1, check if the marketplace enabled") cap, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("clusterversion", "version", "-o=jsonpath={.status.capabilities.enabledCapabilities}").Output() if err != nil { e2e.Failf("Fail to get the cluster capabilities: %s, error:%v", cap, err) } if !strings.Contains(cap, "marketplace") { g.Skip("marketplace is disabled, skip...") } exutil.By("2, check if the default catalogsource disabled") disable, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("operatorhub", "cluster", "-o=jsonpath={.spec.disableAllDefaultSources}").Output() if err != nil { e2e.Failf("Fail to get operatorhub spec, error:%v", err) } if disable != "true" { exutil.By("2-1, Disable the default catalogsource") // make sure the operatorhub enabled after this test defer func() { _, err = oc.AsAdmin().WithoutNamespace().Run("patch").Args("operatorhub", "cluster", "-p", "{\"spec\": {\"disableAllDefaultSources\": false}}", "--type=merge").Output() if err != nil { e2e.Failf("Fail to re-enable operatorhub, error:%v", err) } }() _, err = oc.AsAdmin().WithoutNamespace().Run("patch").Args("operatorhub", "cluster", "-p", "{\"spec\": {\"disableAllDefaultSources\": true}}", "--type=merge").Output() if err != nil { e2e.Failf("Fail to disable operatorhub, error:%v", err) } } exutil.By("3, Check the OperatorHub status") status, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("operatorhub", "cluster", "-o=jsonpath={.status.sources}").Output() if err != nil { e2e.Failf("Fail to get operatorhub status, error:%v", err) } if strings.Contains(status, "Error") { e2e.Failf("the operatorhub status(%s) is incorrect!", status) } log, _ := oc.AsAdmin().WithoutNamespace().Run("logs").Args("deploy/marketplace-operator", "--tail", "3").Output() if strings.Contains(log, "Error processing CatalogSource") { e2e.Failf("marketplace-operator is handling operatorhub wrongly: %s", log) } })
test case
openshift/openshift-tests-private
f045107b-c5cb-41e2-8e67-ea4694039736
Author:jiazha-ROSA-OSD_CCS-ARO-ConnectedOnly-High-53758-failed to recreate SA for the CatalogSource that without poll Interval
['"context"', '"fmt"', '"path/filepath"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-ROSA-OSD_CCS-ARO-ConnectedOnly-High-53758-failed to recreate SA for the CatalogSource that without poll Interval", func() { buildPruningBaseDir := exutil.FixturePath("testdata", "olm") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By("1, Create a CatalogSource that in a random project") oc.SetupProject() csImageTemplate := filepath.Join(buildPruningBaseDir, "cs-without-interval.yaml") indexImage := "quay.io/openshifttest/nginxolm-operator-index:nginxolm99999" cs := catalogSourceDescription{ name: "cs-53758", namespace: oc.Namespace(), displayName: "QE Operators", publisher: "QE", sourceType: "grpc", address: indexImage, template: csImageTemplate, } defer cs.delete(itName, dr) cs.createWithCheck(oc, itName, dr) exutil.By("2, delete this CatalogSource's SA") _, err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("serviceaccount", cs.name, "-n", cs.namespace).Output() if err != nil { e2e.Failf("fail to delete the catalogsource SA:%s", cs.name) } exutil.By("3, check if SA is recreated") err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { _, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("serviceaccount", cs.name, "-n", cs.namespace).Output() if err != nil { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("fail to recreate the catalogsource SA %s after 60s!", cs.name)) })
test case
openshift/openshift-tests-private
0ae12156-d696-453c-ab54-e8dba065cd23
NonHyperShiftHOST-Author:jiazha-Medium-53740-CatalogSource incorrect parsing validation
['"context"', '"fmt"', '"os/exec"', '"github.com/google/go-github/github"', '"encoding/json"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2e "k8s.io/kubernetes/test/e2e/framework"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:jiazha-Medium-53740-CatalogSource incorrect parsing validation", func() { buildPruningBaseDir := exutil.FixturePath("testdata", "olm") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By("1, Create a CatalogSource that in a random project") oc.SetupProject() ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-53740", namespace: oc.Namespace(), template: ogSingleTemplate, } defer og.delete(itName, dr) og.createwithCheck(oc, itName, dr) csImageTemplate := filepath.Join(buildPruningBaseDir, "cs-image-template.yaml") ocpVersionByte, err := exec.Command("bash", "-c", "oc version -o json | jq -r '.openshiftVersion' | cut -d '.' -f1,2").Output() o.Expect(err).NotTo(o.HaveOccurred()) ocpVersion := strings.Replace(string(ocpVersionByte), "\n", "", -1) indexImage := fmt.Sprintf("quay.io/openshift-qe-optional-operators/aosqe-index:v%s", ocpVersion) cs := catalogSourceDescription{ name: "cs-53740", namespace: oc.Namespace(), displayName: "QE Operators", publisher: "QE", sourceType: "grpc", address: indexImage, interval: "15mError code", template: csImageTemplate, } defer cs.delete(itName, dr) cs.create(oc, itName, dr) var msg string err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { msg, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("catsrc", cs.name, "-n", cs.namespace, "-o=jsonpath={.status.message}").Output() if !strings.Contains(msg, "error parsing") { return false, nil } return true, nil }) if err != nil { e2e.Failf("cannot find the parsing error from CatalogSource message: %s", msg) } // No error logs print as default after refactor, details: https://github.com/operator-framework/api/blob/master/pkg/operators/v1alpha1/catalogsource_types.go#L157-L177 // log, _ := oc.AsAdmin().WithoutNamespace().Run("logs").Args("-n", "openshift-marketplace", "deploy/marketplace-operator", "--tail", "3").Output() // if !strings.Contains(log, "time: unknown unit") { // e2e.Failf("cannot find the parsing error logs from marketplace-operator: %s", log) // } })
test case
openshift/openshift-tests-private
13d0fd40-eedc-408a-97b0-07ae25dbf2ca
Author:jiazha-Medium-49687-Make the marketplace operator optional
['"fmt"', '"os/exec"', '"encoding/json"', '"path/filepath"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-Medium-49687-Make the marketplace operator optional", func() { exutil.SkipBaselineCaps(oc, "None") exutil.By("1, check if the marketplace disabled") cap, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("clusterversion", "version", "-o=jsonpath={.status.capabilities.enabledCapabilities}").Output() if err != nil { e2e.Failf("Fail to get the cluster capabilities: %s, error:%v", cap, err) } if strings.Contains(cap, "marketplace") { g.Skip("marketplace is enabled, skip...") } else { e2e.Logf("marketplace is disabled") exutil.By("2, check marketplace namespace") _, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("ns", "openshift-marketplace").Output() if err == nil { e2e.Failf("error! openshift-marketplace project still exist") } exutil.By("3, check operatorhub namespace") _, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("operatorhub").Output() if err == nil { e2e.Failf("error! operatorhub resource still exist") } buildPruningBaseDir := exutil.FixturePath("testdata", "olm") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By("4, Create a CatalogSource that in a random project") oc.SetupProject() ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-49687", namespace: oc.Namespace(), template: ogSingleTemplate, } defer og.delete(itName, dr) og.createwithCheck(oc, itName, dr) csImageTemplate := filepath.Join(buildPruningBaseDir, "cs-image-template.yaml") ocpVersionByte, err := exec.Command("bash", "-c", "oc version -o json | jq -r '.openshiftVersion' | cut -d '.' -f1,2").Output() o.Expect(err).NotTo(o.HaveOccurred()) ocpVersion := strings.Replace(string(ocpVersionByte), "\n", "", -1) indexImage := fmt.Sprintf("quay.io/openshift-qe-optional-operators/aosqe-index:v%s", ocpVersion) cs := catalogSourceDescription{ name: "cs-49687", namespace: oc.Namespace(), displayName: "QE Operators", publisher: "QE", sourceType: "grpc", address: indexImage, template: csImageTemplate, } defer cs.delete(itName, dr) cs.createWithCheck(oc, itName, dr) exutil.By("5, Subscribe to learn perator v0.0.3 in this random project") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-49687", namespace: oc.Namespace(), catalogSourceName: "cs-49687", catalogSourceNamespace: oc.Namespace(), channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) sub.create(oc, itName, dr) defer sub.deleteCSV(itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.3", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) } })
test case
openshift/openshift-tests-private
d6f42e28-b75f-434a-bf1b-bcb41df50963
NonHyperShiftHOST-Author:jiazha-Medium-49352-SNO Leader election conventions for cluster topology
['"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:jiazha-Medium-49352-SNO Leader election conventions for cluster topology", func() { exutil.By("1) get the cluster topology") infra, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("infrastructures", "cluster", "-o=jsonpath={.status.controlPlaneTopology}").Output() if err != nil { e2e.Failf("Fail to get the cluster infra: %s, error:%v", infra, err) } exutil.By("2) get the leaseDurationSeconds of the packageserver-controller-lock") leaseDurationSeconds, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("lease", "packageserver-controller-lock", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.spec.leaseDurationSeconds}").Output() if err != nil { e2e.Failf("Fail to get the leaseDurationSeconds: %s, error:%v", leaseDurationSeconds, err) } if infra == "SingleReplica" { e2e.Logf("This is a SNO cluster") if !strings.Contains(leaseDurationSeconds, "270") { e2e.Failf("The lease duration is not as expected: %s", leaseDurationSeconds) } } else { g.Skip("This is a HA cluster, skip.") } })
test case
openshift/openshift-tests-private
1abe34bf-0005-40fe-84d8-769e1ae76a21
NonHyperShiftHOST-Author:jiazha-High-49167-fatal error
['"fmt"', '"regexp"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:jiazha-High-49167-fatal error", func() { exutil.By("1) Check OLM related resources' logs") deps := []string{"catalog-operator", "olm-operator", "package-server-manager", "packageserver"} // since https://issues.redhat.com/browse/OCPBUGS-13369 closed as Wont'do. I remove the certification checking // since https://issues.redhat.com/browse/OCPBUGS-43581 fixed, I add the certification checking back, but for OCP4.18+ re1, _ := regexp.Compile("x509.*") // since https://issues.redhat.com/browse/OCPBUGS-11370, add "bad certificate" checking for prometheus pods re2, _ := regexp.Compile("bad certificate") // remove the promtheus checking since many failure not caused by OLM // prometheusLogs, err := oc.AsAdmin().WithoutNamespace().Run("logs").Args("deployment/prometheus-operator-admission-webhook", "-n", "openshift-monitoring").Output() // if err != nil { // e2e.Failf("!!! Fail to get prometheus logs:%s", err) // } // prometheusTLS := re2.FindString(prometheusLogs) // if re2.FindString(prometheusLogs) != "" { // e2e.Failf("!!! prometheus occurs TLS error: %s", prometheusTLS) // } re3, _ := regexp.Compile("fatal error.*") for _, dep := range deps { logs, err := oc.AsAdmin().WithoutNamespace().Run("logs").Args(fmt.Sprintf("deployment/%s", dep), "-n", "openshift-operator-lifecycle-manager").Output() if err != nil { e2e.Failf("!!! Fail to get %s logs.", dep) } str1 := re1.FindString(logs) str2 := re2.FindString(logs) str3 := re3.FindString(logs) if str1 != "" { e2e.Failf("!!! %s occurs x509 error: %s", dep, str1) } if str2 != "" { e2e.Failf("!!! %s occurs TLS error: %s", dep, str2) } if str3 != "" { e2e.Failf("!!! %s occurs fatal error: %s", dep, str3) } } })
test case
openshift/openshift-tests-private
92107338-c2bc-47cb-a31d-af905eb3771e
VMonly-Author:jiazha-High-25966-offline mirroring support
['"os"', '"encoding/json"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("VMonly-Author:jiazha-High-25966-offline mirroring support", func() { // This is a basic test, you can find images mirroring for disconnected cluster // in: https://gitlab.cee.redhat.com/aosqe/flexy-templates/-/blob/master/functionality-testing/aos-4_10/hosts/sync_index_images_to_qe_registry.sh exutil.By("1) mirroring an index image to the localhost registry") defer os.RemoveAll("etcd-mirror/") logs, err := oc.AsAdmin().WithoutNamespace().Run("adm").Args("catalog", "mirror", "quay.io/openshifttest/etcd-index:latest", "localhost:5000", "-a", "/home/cloud-user/auth.json", "--index-filter-by-os='.*'", "--to-manifests=etcd-mirror").Output() if err != nil || strings.Contains(logs, "error") { e2e.Failf("Fail to mirror image to localhost:5000, error:%v, logs:%v", err, logs) } })
test case
openshift/openshift-tests-private
1b8e3bfa-4c7f-4dbe-b24d-7207ade2dd89
VMonly-ConnectedOnly-Author:jiazha-High-48980-oc adm catalog mirror image to local
['"fmt"', '"os"', '"os/exec"', 'g "github.com/onsi/ginkgo/v2"', '"encoding/json"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("VMonly-ConnectedOnly-Author:jiazha-High-48980-oc adm catalog mirror image to local", func() { mirroredImage := "quay.io/olmqe/nginxolm-operator-index:v1" exutil.By("1) get the cluster auth") tokenDir := "/tmp/olm-48980" err := os.MkdirAll(tokenDir, os.ModePerm) defer os.RemoveAll(tokenDir) if err != nil { e2e.Failf("fail to create the token folder:%s", tokenDir) } _, err = oc.AsAdmin().WithoutNamespace().Run("extract").Args("secret/pull-secret", "-n", "openshift-config", fmt.Sprintf("--to=%s", tokenDir), "--confirm").Output() if err != nil { e2e.Failf("Fail to get the cluster auth %v", err) } exutil.By("2) mirror image to local") defer os.RemoveAll("v2/") defer exec.Command("bash", "-c", "rm -rf manifests-nginxolm-operator-*").Output() logs, err := oc.AsAdmin().WithoutNamespace().Run("adm").Args("catalog", "mirror", mirroredImage, "file:///local/index", "-a", fmt.Sprintf("%s/.dockerconfigjson", tokenDir)).Output() if err != nil || strings.Contains(logs, "error mirroring image") { e2e.Failf("Fail to mirror image to local, error:%v, logs:%v", err, logs) } exutil.By("3) mirror local image to the docker registry") defer os.RemoveAll("manifests-index/") logs, err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("catalog", "mirror", "file://local/index/olmqe/nginxolm-operator-index:v1", "localhost:5000/test", "-a", "/home/cloud-user/auth.json").Output() if err != nil || strings.Contains(logs, "error mirroring image") { e2e.Failf("Fail to mirror image to localhost:5000, error:%v, logs:%v", err, logs) } })
test case
openshift/openshift-tests-private
fb47cd7f-7e7a-4ae3-a593-70c463db7a2f
Author:jiazha-ROSA-OSD_CCS-ARO-ConnectedOnly-High-46964-Disable Copied CSVs Toggle [Serial]
['"context"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-ROSA-OSD_CCS-ARO-ConnectedOnly-High-46964-Disable Copied CSVs Toggle [Serial]", func() { buildPruningBaseDir := exutil.FixturePath("testdata", "olm") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By("1) Subscribe to learn operator v0.0.3 with AllNamespaces mode") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-learn-46964", namespace: "openshift-operators", catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", template: subTemplate, } defer sub.delete(itName, dr) defer func() { if sub.installedCSV == "" { sub.findInstalledCSV(oc, itName, dr) } sub.deleteCSV(itName, dr) }() sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.3", "-n", "openshift-operators", "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("2) Create testing projects and Multi OperatorGroup") ogMultiTemplate := filepath.Join(buildPruningBaseDir, "og-multins.yaml") og := operatorGroupDescription{ name: "og-46964", namespace: "", multinslabel: "label-46964", template: ogMultiTemplate, } p1 := projectDescription{ name: "test-46964", targetNamespace: "", } p2 := projectDescription{ name: "test1-46964", targetNamespace: "", } defer p1.deleteWithForce(oc) defer p2.deleteWithForce(oc) oc.SetupProject() p1.targetNamespace = oc.Namespace() p2.targetNamespace = oc.Namespace() og.namespace = oc.Namespace() exutil.By("2-1) create new projects and label them") p1.create(oc, itName, dr) p1.label(oc, "label-46964") p2.create(oc, itName, dr) p2.label(oc, "label-46964") og.create(oc, itName, dr) exutil.By("3) Subscribe to Sample operator with MultiNamespaces mode") subSample := subscriptionDescription{ subName: "sub-sample-46964", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "alpha", ipApproval: "Automatic", operatorPackage: "sample-operator", template: subTemplate, } defer subSample.delete(itName, dr) subSample.create(oc, itName, dr) defer subSample.deleteCSV(itName, dr) subSample.findInstalledCSV(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", subSample.installedCSV, "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("4) Enable this `disableCopiedCSVs` feature") patchResource(oc, asAdmin, withoutNamespace, "olmconfig", "cluster", "-p", "{\"spec\":{\"features\":{\"disableCopiedCSVs\": true}}}", "--type=merge") exutil.By("5) Check if the AllNamespaces Copied CSV are removed") err := wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { copiedCSV, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace(), "--no-headers").Output() if err != nil { e2e.Failf("Error: %v, fail to get CSVs in project: %s", err, oc.Namespace()) } if strings.Contains(copiedCSV, "learn-operator.v0.0.3") || !strings.Contains(copiedCSV, subSample.installedCSV) { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "AllNamespace Copied CSV should be remove") exutil.By("6) Disable this `disableCopiedCSVs` feature") patchResource(oc, asAdmin, withoutNamespace, "olmconfig", "cluster", "-p", "{\"spec\":{\"features\":{\"disableCopiedCSVs\": false}}}", "--type=merge") exutil.By("7) Check if the AllNamespaces Copied CSV are back") err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) { copiedCSV, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace(), "--no-headers").Output() if err != nil { e2e.Failf("Error: %v, fail to get CSVs in project: %s", err, oc.Namespace()) } if !strings.Contains(copiedCSV, "learn-operator.v0.0.3") || !strings.Contains(copiedCSV, subSample.installedCSV) { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "AllNamespaces CopiedCSV should be back") })
test case
openshift/openshift-tests-private
3203990a-dd47-40ec-ac1d-960eec457ae7
Author:jiazha-High-43487-3rd party Operator Catalog references change during an OCP Upgrade
['"context"', '"fmt"', '"os/exec"', '"regexp"', '"strconv"', '"github.com/blang/semver"', '"path/filepath"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-High-43487-3rd party Operator Catalog references change during an OCP Upgrade", func() { exutil.By("1) get the Kubernetes version") version, err := exec.Command("bash", "-c", "oc version | grep Kubernetes |awk '{print $3}'").Output() o.Expect(err).NotTo(o.HaveOccurred()) v, _ := semver.ParseTolerant(string(version)) majorVersion := strconv.FormatUint(v.Major, 10) minorVersion := strconv.FormatUint(v.Minor, 10) patchVersion := strconv.FormatUint(v.Patch, 10) dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) imageTemplates := map[string]string{ "quay.io/kube-release-v{kube_major_version}/catalog:v{kube_major_version}": majorVersion, "quay.io/kube-release-v{kube_major_version}/catalog:v{kube_major_version}.{kube_minor_version}": fmt.Sprintf("%s.%s", majorVersion, minorVersion), "quay.io/olmqe-v{kube_major_version}/etcd-index:v{kube_major_version}.{kube_minor_version}.{kube_patch_version}": fmt.Sprintf("%s.%s.%s", majorVersion, minorVersion, patchVersion), } oc.SetupProject() for k, fullV := range imageTemplates { exutil.By(fmt.Sprintf("create a CatalogSource with imageTemplate:%s", k)) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "cs-image-template.yaml") cs := catalogSourceDescription{ name: fmt.Sprintf("cs-43487-%s", fullV), namespace: oc.Namespace(), displayName: "OLM QE Operators", publisher: "Jian", sourceType: "grpc", address: "quay.io/olmqe-v1/etcd-index:v1.21", imageTemplate: k, template: csImageTemplate, } defer cs.delete(itName, dr) cs.create(oc, itName, dr) // It will fail due to "ImagePullBackOff" since no this CatalogSource image in fact, so remove the status checking // newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", oc.Namespace(), "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("3) get the real CatalogSource image version") err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { // oc get catalogsource cs-43487 -o=jsonpath={.spec.image} image, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", cs.name, "-n", oc.Namespace(), "-o=jsonpath={.spec.image}").Output() if err != nil { e2e.Failf("Fail to get the CatalogSource(%s)'s image, error: %v", cs.name, err) } if image == "" { return false, nil } reg1 := regexp.MustCompile(`.*-v(\d+).*:v(\d+(.\d+)?(.\d+)?)`) if reg1 == nil { e2e.Failf("image regexp err!") } result1 := reg1.FindAllStringSubmatch(image, -1) imageMajorVersion := result1[0][1] imageFullVersion := result1[0][2] e2e.Logf("fullVersion:%s, majorVersion:%s, imageFullVersion:%s, imageMajorVersion:%s", fullV, majorVersion, imageFullVersion, imageMajorVersion) if imageMajorVersion != majorVersion || imageFullVersion != fullV { e2e.Failf("This CatalogSource(%s) image version(%s) doesn't follow the image template(%s)!", cs.name, image, k) } return true, nil }) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("catsrc %s image version not expected", cs.name)) } })
test case
openshift/openshift-tests-private
fa52593c-5ed3-44e8-9f4a-1ed812b1cef7
Author:jiazha-Medium-43191-Medium-43271-Bundle Content Compression
['"path/filepath"', '"strings"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-Medium-43191-Medium-43271-Bundle Content Compression", func() { buildPruningBaseDir := exutil.FixturePath("testdata", "olm") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By("1) Subscribe to the Learn operator in a random project") oc.SetupProject() ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-43191", namespace: oc.Namespace(), template: ogSingleTemplate, } defer og.delete(itName, dr) og.createwithCheck(oc, itName, dr) subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-43191", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) sub.create(oc, itName, dr) defer sub.deleteCSV(itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.3", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("2) check if the extract job uses the zip flag") // ["opm","alpha","bundle","extract","-m","/bundle/","-n","openshift-marketplace","-c","9b59f03f8e8ea2f818061847881908aae51cf41836e4a3b822dcc6d3a01481c","-z"] extractCommand, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("job", "-n", "openshift-marketplace", "-o=jsonpath={.items[0].spec.template.spec.containers[0].command}").Output() if err != nil { e2e.Failf("Fail to get the jobs in the openshift-marketplace project: %v", err) } if !strings.Contains(extractCommand, "-z") { e2e.Failf("This bundle extract job doesn't use the opm compression feature!") } exutil.By("3) check if the compression content is empty") bData, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cm", "-n", "openshift-marketplace", "-o=jsonpath={.items[0].binaryData}").Output() if err != nil { e2e.Failf("Fail to get ConfigMap's binaryData: %v", err) } if bData == "" { e2e.Failf("The compression content is empty!") } })
test case
openshift/openshift-tests-private
d2e96091-b22e-4c13-a2dd-f28829a4b8e4
ConnectedOnly-Author:jiazha-High-43101-OLM blocks minor OpenShift upgrades when incompatible optional operators are installed
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"github.com/blang/semver"', '"path/filepath"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:jiazha-High-43101-OLM blocks minor OpenShift upgrades when incompatible optional operators are installed", func() { architecture.SkipNonAmd64SingleArch(oc) // consumes this index imaage: quay.io/olmqe/etcd-index:upgrade-auto, it contains the etcdoperator v0.9.2, v0.9.4, v0.9.5 exutil.By("1, create a random project") oc.SetupProject() exutil.By("1-1, create a CatalogSource in this random project") buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-opm.yaml") cs := catalogSourceDescription{ name: "cs-43101", namespace: oc.Namespace(), displayName: "OLM QE Operators", publisher: "Jian", sourceType: "grpc", address: "quay.io/olmqe/etcd-index:upgrade-fips", template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) defer cs.delete(itName, dr) cs.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", oc.Namespace(), "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("2, install the OperatorGroup in that random project") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-43101", namespace: oc.Namespace(), template: ogSingleTemplate, } defer og.delete(itName, dr) og.createwithCheck(oc, itName, dr) exutil.By("3, install the etcdoperator v0.9.2 with Manual approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-43101", namespace: oc.Namespace(), catalogSourceName: "cs-43101", catalogSourceNamespace: oc.Namespace(), channel: "singlenamespace-alpha", ipApproval: "Manual", operatorPackage: "etcd", startingCSV: "etcdoperator.v0.9.2", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) defer sub.update(oc, itName, dr) sub.create(oc, itName, dr) exutil.By("4, apprrove this etcdoperator.v0.9.2, it should be in Complete state") sub.approveSpecificIP(oc, itName, dr, "etcdoperator.v0.9.2", "Complete") newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.2", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) // olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": " "}]' exutil.By("5, this operator's olm.maxOpenShiftVersion is empty, so it should block the upgrade") CheckUpgradeStatus(oc, "False") exutil.By("6, apprrove this etcdoperator.v0.9.4, it should be in Complete state") sub.approveSpecificIP(oc, itName, dr, "etcdoperator.v0.9.4", "Complete") newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.4", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) // olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.9"}]' exutil.By("7, 4.9.0-xxx upgraded to 4.10.0-xxx < 4.10.0, or 4.9.1 upgraded to 4.9.x < 4.10.0, so it should NOT block 4.9 upgrade, but block 4.10+ upgrade") currentVersion, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("clusterversion", "version", "-o=jsonpath={.status.desired.version}").Output() if err != nil { e2e.Failf("Fail to get the OCP version") } v, _ := semver.ParseTolerant(currentVersion) maxVersion, _ := semver.ParseTolerant("4.9") // current version > the operator's max version: 4.9 if v.Compare(maxVersion) > 0 { CheckUpgradeStatus(oc, "False") } else { CheckUpgradeStatus(oc, "True") } exutil.By("8, apprrove this etcdoperator.v0.9.5, it should be in Complete state") sub.approveSpecificIP(oc, itName, dr, "etcdoperator.v0.9.5", "Complete") newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.5", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) // olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.10.0"}]' exutil.By("9, 4.9.0-xxx upgraded to 4.10.0-xxx < 4.10.0, or 4.9.1 upgraded to 4.9.x < 4.11.0, so it should NOT block 4.10 upgrade, but blocks 4.11+ upgrade") maxVersion2, _ := semver.ParseTolerant("4.10.0") // current version > the operator's max version: 4.10.0 if v.Compare(maxVersion2) > 0 { CheckUpgradeStatus(oc, "False") } else { CheckUpgradeStatus(oc, "True") } })
test case
openshift/openshift-tests-private
567f1715-285f-4b3f-a307-53ec6c6d20d8
Author:jiazha-Medium-43977-OPENSHIFT_VERSIONS in assisted operator subscription does not propagate [Serial]
['"fmt"', '"path/filepath"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-Medium-43977-OPENSHIFT_VERSIONS in assisted operator subscription does not propagate [Serial]", func() { // From 4.12, improve the ns permissions so that pod can be run successfully. // it is already privileged for default, so no need to set it. // this operator must be installed in the default project since the env variable: MY_POD_NAMESPACE = default exutil.By("1) create the OperatorGroup in the default project") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-43977", namespace: "default", template: ogSingleTemplate, } defer og.delete(itName, dr) og.createwithCheck(oc, itName, dr) exutil.By("2) subscribe to the learn-operator.v0.0.3 with ENV variables") subTemplate := filepath.Join(buildPruningBaseDir, "env-subscription.yaml") sub := subscriptionDescription{ subName: "sub-43977", namespace: "default", catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) defer func() { if sub.installedCSV == "" { sub.findInstalledCSV(oc, itName, dr) } sub.deleteCSV(itName, dr) }() // the create method fails due that timeout, but some times csv is created, so need to delete them with defer if you do not delete ns. sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded"+"InstallSucceeded", ok, []string{"csv", "learn-operator.v0.0.3", "-n", "default", "-o=jsonpath={.status.phase}{.status.reason}"}).check(oc) exutil.By("3) check those env variables") envVars := map[string]string{ "MY_POD_NAMESPACE": "default", "OPERATOR_CONDITION_NAME": "learn-operator.v0.0.3", "OPENSHIFT_VERSIONS": "4.8", } // oc get deployment etcd-operator -o=jsonpath={.spec.template.spec.containers[0].env[?(@.name==\"MY_POD_NAMESPACE\")].value} // oc get deployment etcd-operator -o=jsonpath={.spec.template.spec.containers[0].env[?(@.name==\"OPERATOR_CONDITION_NAME\")].value} // oc get deployment etcd-operator -o=jsonpath={.spec.template.spec.containers[0].env[?(@.name==\"OPENSHIFT_VERSIONS\")].value} for k, v := range envVars { jsonpath := fmt.Sprintf("-o=jsonpath={.spec.template.spec.containers[0].env[?(@.name==\"%s\")].value}", k) envVar, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "learn-operator", "-n", "default", jsonpath).Output() o.Expect(err).NotTo(o.HaveOccurred()) if !strings.Contains(envVar, v) { e2e.Failf("The value of the %s should be %s, but get %s!", k, v, envVar) } } })
test case
openshift/openshift-tests-private
a6da51ef-33dc-4321-8837-7e0ce5b81bb5
NonHyperShiftHOST-Author:jiazha-Medium-43978-Catalog pods don't report termination logs to catalog-operator
['"fmt"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:jiazha-Medium-43978-Catalog pods don't report termination logs to catalog-operator", func() { exutil.SkipBaselineCaps(oc, "None") catalogs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", "-n", "openshift-marketplace").Output() if err != nil { e2e.Failf("Fail to get the CatalogSource in openshift-marketplace project") } defaultCatalogs := []string{"certified-operators", "community-operators", "redhat-marketplace", "redhat-operators"} for i, catalog := range defaultCatalogs { exutil.By(fmt.Sprintf("%d) check CatalogSource: %s", i+1, catalog)) if strings.Contains(catalogs, catalog) { policy, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", fmt.Sprintf("olm.catalogSource=%s", catalog), "-n", "openshift-marketplace", "-o=jsonpath={.items[0].spec.containers[0].terminationMessagePolicy}").Output() if err != nil { e2e.Failf("Fail to get the policy of the CatalogSource's pod") } if policy != "FallbackToLogsOnError" { e2e.Failf("CatalogSource:%s uses the %s policy, not the FallbackToLogsOnError!", catalog, policy) } } else { e2e.Logf("CatalogSource:%s doesn't install on this cluster", catalog) } } })
test case
openshift/openshift-tests-private
f450422e-2891-4b62-9699-d32bb07e3cb4
Author:jiazha-NonHyperShiftHOST-Medium-43803-Only one of multiple subscriptions to the same package is honored
['"context"', '"regexp"', '"path/filepath"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-NonHyperShiftHOST-Medium-43803-Only one of multiple subscriptions to the same package is honored", func() { exutil.By("1) create the OperatorGroup in a random project") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) oc.SetupProject() buildPruningBaseDir := exutil.FixturePath("testdata", "olm") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-43803", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("2) subscribe to the learn-operator.v0.0.3 with Automatic approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-43803", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) sub.create(oc, itName, dr) defer sub.deleteCSV(itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.3", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("3) re-subscribe to this learn operator with another subscription name") sub2 := subscriptionDescription{ subName: "sub2-43803", namespace: oc.Namespace(), catalogSourceName: "cs-43803", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } defer sub2.delete(itName, dr) sub2.createWithoutCheck(oc, itName, dr) exutil.By("4) Check OLM logs") err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { logs, err := oc.AsAdmin().WithoutNamespace().Run("logs").Args("deploy/catalog-operator", "-n", "openshift-operator-lifecycle-manager").Output() if err != nil { e2e.Failf("Fail to get the OLM logs") } res, _ := regexp.MatchString(".*constraints not satisfiable.*subscription sub2-43803", logs) if res { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "subscription sub2-43803 constraints satisfiable") })
test case
openshift/openshift-tests-private
1606206b-9780-4dcc-aee2-b9aa492c6c06
Author:jiazha-ROSA-OSD_CCS-ARO-NonHyperShiftHOST-High-45411-packageserver isn't following the OpenShift HA conventions
['"strings"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-ROSA-OSD_CCS-ARO-NonHyperShiftHOST-High-45411-packageserver isn't following the OpenShift HA conventions", func() { exutil.By("1) get the cluster infrastructure") infra, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("infrastructures", "cluster", "-o=jsonpath={.status.infrastructureTopology}").Output() if err != nil { e2e.Failf("Fail to get the cluster infra") } num, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", "openshift-operator-lifecycle-manager", "deployment", "packageserver", "-o=jsonpath={.status.replicas}").Output() o.Expect(err).NotTo(o.HaveOccurred()) if infra == "HighlyAvailable" { e2e.Logf("This is a HA cluster!") exutil.By("2) check if there are two packageserver pods") if num != "2" { e2e.Failf("!!!Fail, should have 2 packageserver pod, but get %s!", num) } exutil.By("3) check if the two packageserver pods running on different nodes") names, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "-l", "app=packageserver", "-o", "name").Output() if err != nil { e2e.Failf("Fail to get the Packageserver pods' name") } podNames := strings.Split(names, "\n") name := "" for _, podName := range podNames { e2e.Logf("get the packageserver pod name: %s", podName) nodeName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", "openshift-operator-lifecycle-manager", podName, "-o=jsonpath={.spec.nodeName}").Output() if err != nil { e2e.Failf("Fail to get the node name") } e2e.Logf("get the node name: %s", nodeName) if name != "" && name == nodeName { e2e.Failf("!!!Fail, the two packageserver pods running on the same node: %s!", nodeName) } name = nodeName } } else { e2e.Logf("This is a SNO cluster, skip!") } })
test case
openshift/openshift-tests-private
e354f5be-dac4-4d44-b6cc-b1444dc98da2
NonHyperShiftHOST-Author:jiazha-High-Longduration-NonPreRelease-43135-PackageServer respects single-node configuration [Disruptive]
['"context"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:jiazha-High-Longduration-NonPreRelease-43135-PackageServer respects single-node configuration [Disruptive]", func() { exutil.By("1) get the cluster infrastructure") infra, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("infrastructures", "cluster", "-o=jsonpath={.status.infrastructureTopology}").Output() if err != nil { e2e.Failf("Fail to get the cluster infra") } num, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", "openshift-operator-lifecycle-manager", "deployment", "packageserver", "-o=jsonpath={.status.replicas}").Output() o.Expect(err).NotTo(o.HaveOccurred()) if infra == "SingleReplica" { e2e.Logf("This is a SNO cluster") exutil.By("2) check if only have one packageserver pod") if num != "1" { e2e.Failf("!!!Fail, should only have 1 packageserver pod, but get %s!", num) } // make sure the CVO recover if any error in the follow steps defer func() { _, err = oc.AsAdmin().WithoutNamespace().Run("scale").Args("--replicas", "1", "deployment/cluster-version-operator", "-n", "openshift-cluster-version").Output() if err != nil { e2e.Failf("Defer: fail to enable CVO") } }() exutil.By("3) stop CVO") _, err := oc.AsAdmin().WithoutNamespace().Run("scale").Args("--replicas", "0", "deployment/cluster-version-operator", "-n", "openshift-cluster-version").Output() if err != nil { e2e.Failf("Fail to stop CVO") } exutil.By("4) stop the PSM") _, err = oc.AsAdmin().WithoutNamespace().Run("scale").Args("--replicas", "0", "deployment/package-server-manager", "-n", "openshift-operator-lifecycle-manager").Output() if err != nil { e2e.Failf("Fail to stop the PSM") } exutil.By("5) patch the replica to 3") // oc get csv packageserver -o=jsonpath={.spec.install.spec.deployments[?(@.name==\"packageserver\")].spec.replicas} // oc patch csv/packageserver -p '{"spec":{"install":{"spec":{"deployments":[{"name":"packageserver", "spec":{"replicas":3, "template":{}, "selector":{"matchLabels":{"app":"packageserver"}}}}]}}}}' --type=merge // oc patch deploy/packageserver -p '{"spec":{"replicas":3}}' --type=merge // should update CSV patchResource(oc, asAdmin, withoutNamespace, "-n", "openshift-operator-lifecycle-manager", "csv", "packageserver", "-p", "{\"spec\":{\"install\":{\"spec\":{\"deployments\":[{\"name\":\"packageserver\", \"spec\":{\"replicas\":3, \"template\":{}, \"selector\":{\"matchLabels\":{\"app\":\"packageserver\"}}}}]}}}}", "--type=merge") patchResource(oc, asAdmin, withoutNamespace, "-n", "openshift-operator-lifecycle-manager", "deployment", "packageserver", "-p", "{\"spec\":{\"replicas\":3}}", "--type=merge") err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { num, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.status.availableReplicas}").Output() e2e.Logf("packageserver replicas is %s", num) if num != "3" { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "packageserver replicas is not 3") exutil.By("6) enable CVO") _, err = oc.AsAdmin().WithoutNamespace().Run("scale").Args("--replicas", "1", "deployment/cluster-version-operator", "-n", "openshift-cluster-version").Output() if err != nil { e2e.Failf("Fail to enable CVO") } exutil.By("7) check if the PSM back") err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { num, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "package-server-manager", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.status.replicas}").Output() if num != "1" { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "package-server-manager replicas is not reback to 1") exutil.By("8) check if the packageserver pods number back to 1") // for some SNO clusters, reback may take 10 mins around err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 600*time.Second, false, func(ctx context.Context) (bool, error) { num, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.status.availableReplicas}").Output() if num != "1" { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "packageserver replicas is not reback to 1") } else { // HighlyAvailable e2e.Logf("This is HA cluster, not SNO") exutil.By("2) check if only have two packageserver pods") if num != "2" { e2e.Failf("!!!Fail, should only have 2 packageserver pods, but get %s!", num) } } })
test case
openshift/openshift-tests-private
cae03fc1-ccc6-4ad5-bcda-5cbefd4a586a
ConnectedOnly-VMonly-Author:jiazha-High-37826-use an PullSecret for the private Catalog Source image [Serial]
['"fmt"', '"regexp"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"encoding/json"', '"path/filepath"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-VMonly-Author:jiazha-High-37826-use an PullSecret for the private Catalog Source image [Serial]", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipNoCapabilities(oc, "marketplace") exutil.By("1) Create a pull secert for CatalogSource") buildPruningBaseDir := exutil.FixturePath("testdata", "olm") dockerConfig := filepath.Join("/home", "cloud-user", ".docker", "auto", "config.json") _, err := oc.AsAdmin().WithoutNamespace().Run("create").Args("-n", "openshift-marketplace", "secret", "generic", "secret-37826", fmt.Sprintf("--from-file=.dockerconfigjson=%s", dockerConfig), "--type=kubernetes.io/dockerconfigjson").Output() o.Expect(err).NotTo(o.HaveOccurred()) defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", "openshift-marketplace", "secret", "secret-37826").Execute() exutil.By("2) Install this private CatalogSource in the openshift-marketplace project") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") cs := catalogSourceDescription{ name: "cs-37826", namespace: "openshift-marketplace", displayName: "OLM QE Operators", publisher: "Jian", sourceType: "grpc", address: "quay.io/olmqe/etcd-operator-private:0.9.4-index", template: csImageTemplate, secret: "secret-37826", } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) cs.create(oc, itName, dr) defer cs.delete(itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", "openshift-marketplace", "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("4) Install the etcdoperator v0.9.4 from this private image") oc.SetupProject() ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-37826", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-37826", namespace: oc.Namespace(), catalogSourceName: "cs-37826", catalogSourceNamespace: "openshift-marketplace", channel: "alpha", ipApproval: "Automatic", operatorPackage: "etcd", startingCSV: "etcdoperator.v0.9.4", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) sub.create(oc, itName, dr) defer sub.deleteCSV(itName, dr) // get the InstallPlan name ipName := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installplan.name}") if strings.Contains(ipName, "NotFound") { e2e.Failf("!!!Fail to get the InstallPlan of sub: %s/%s", sub.namespace, sub.subName) } // get the unpack job name manifest := getResource(oc, asAdmin, withoutNamespace, "installplan", "-n", sub.namespace, ipName, "-o=jsonpath={.status.plan[0].resource.manifest}") valid := regexp.MustCompile(`name":"(\S+)","namespace"`) job := valid.FindStringSubmatch(manifest) exutil.By("5) Only check if the job pod works well") // in this test case, we don't need to care about if the operator pods works well. // more details: https://bugzilla.redhat.com/show_bug.cgi?id=1909992#c5 newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"-n", "openshift-marketplace", "pods", "-l", fmt.Sprintf("job-name=%s", string(job[1])), "-o=jsonpath={.items[0].status.phase}"}).check(oc) })
test case
openshift/openshift-tests-private
06070e97-cf92-43e3-b1b9-41cc3800ba2b
Author:jiazha-ROSA-OSD_CCS-ARO-NonHyperShiftHOST-High-24028-need to set priorityClassName as system-cluster-critical
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-ROSA-OSD_CCS-ARO-NonHyperShiftHOST-High-24028-need to set priorityClassName as system-cluster-critical", func() { var deploymentResource = [3]string{"catalog-operator", "olm-operator", "packageserver"} for _, v := range deploymentResource { msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", "openshift-operator-lifecycle-manager", "deployment", v, "-o=jsonpath={.spec.template.spec.priorityClassName}").Output() e2e.Logf("%s.priorityClassName:%s", v, msg) if err != nil { e2e.Failf("Unable to get %s, error:%v", msg, err) } o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).To(o.Equal("system-cluster-critical")) } })
test case
openshift/openshift-tests-private
22512321-7448-497a-a596-5cac52a08da8
Author:jiazha-ROSA-OSD_CCS-ARO-High-21548-aggregates CR roles to standard admin/view/edit
['"fmt"', '"github.com/google/go-github/github"', 'e2e "k8s.io/kubernetes/test/e2e/framework"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-ROSA-OSD_CCS-ARO-High-21548-aggregates CR roles to standard admin/view/edit", func() { oc.SetupProject() msg, err := oc.Run("whoami").Args("").Output() o.Expect(err).NotTo(o.HaveOccurred()) e2e.Logf("oc whoami: %s", msg) o.Expect(msg).NotTo(o.Equal("system:admin")) authorizations := []struct { resource string action []string result bool }{ { resource: "subscriptions", action: []string{"create", "update", "patch", "delete", "get", "list", "watch"}, result: true, }, { resource: "installplans", action: []string{"create", "update", "patch"}, result: false, }, { resource: "installplans", action: []string{"get", "list", "watch", "delete"}, result: true, }, { resource: "catalogsources", action: []string{"get", "list", "watch", "delete"}, result: true, }, { resource: "catalogsources", action: []string{"create", "update", "patch"}, result: false, }, { resource: "clusterserviceversions", action: []string{"get", "list", "watch", "delete"}, result: true, }, { resource: "clusterserviceversions", action: []string{"create", "update", "patch"}, result: false, }, { resource: "operatorgroups", action: []string{"get", "list", "watch"}, result: true, }, { resource: "operatorgroups", action: []string{"create", "update", "patch", "delete"}, result: false, }, { resource: "packagemanifests", action: []string{"get", "list", "watch"}, result: true, }, // Based on https://github.com/openshift/operator-framework-olm/blob/master/staging/operator-lifecycle-manager/deploy/chart/templates/0000_50_olm_09-aggregated.clusterrole.yaml#L30 // But, it returns '*', I will reseach it later. // $ oc get clusterrole admin -o yaml |grep packagemanifests -A5 // - packagemanifests // verbs: // - '*' // { // resource: "packagemanifests", // action: []string{"create", "update", "patch", "delete"}, // result: false, // }, } for _, v := range authorizations { for _, act := range v.action { res, err := oc.Run("auth").Args("can-i", act, v.resource).Output() e2e.Logf(fmt.Sprintf("oc auth can-i %s %s", act, v.resource)) if res != "no" && err != nil { o.Expect(err).NotTo(o.HaveOccurred()) } if v.result { o.Expect(res).To(o.Equal("yes")) } else { o.Expect(res).To(o.Equal("no")) } } } })
test case
openshift/openshift-tests-private
78b1a724-1020-4b02-a4d3-4001db4975c7
Author:jiazha-High-37442-create a Conditions CR for each Operator it installs
['"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-High-37442-create a Conditions CR for each Operator it installs", func() { exutil.By("1) Install the OperatorGroup in a random project") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) oc.SetupProject() buildPruningBaseDir := exutil.FixturePath("testdata", "olm") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-37442", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("2) Install the learn-operator v0.9.4 with Automatic approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-37442", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.3", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("3) Check if OperatorCondition generated well") newCheck("expect", asAdmin, withoutNamespace, compare, "learn-operator", ok, []string{"operatorcondition", "learn-operator.v0.0.3", "-n", oc.Namespace(), "-o=jsonpath={.spec.deployments[0]}"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, compare, "learn-operator.v0.0.3", ok, []string{"deployment", "learn-operator", "-n", oc.Namespace(), "-o=jsonpath={.spec.template.spec.containers[*].env[?(@.name==\"OPERATOR_CONDITION_NAME\")].value}"}).check(oc) // this learn-operator.v0.0.3 role should be owned by OperatorCondition newCheck("expect", asAdmin, withoutNamespace, compare, "OperatorCondition", ok, []string{"role", "learn-operator.v0.0.3", "-n", oc.Namespace(), "-o=jsonpath={.metadata.ownerReferences[0].kind}"}).check(oc) // this learn-operator.v0.0.3 role should be added to learn-operator SA newCheck("expect", asAdmin, withoutNamespace, compare, "learn-operator", ok, []string{"rolebinding", "learn-operator.v0.0.3", "-n", oc.Namespace(), "-o=jsonpath={.subjects[0].name}"}).check(oc) exutil.By("4) delete the operator so that can check the related resource in next step") sub.delete(itName, dr) sub.deleteCSV(itName, dr) exutil.By("5) Check if the related resources are removed successfully") newCheck("present", asAdmin, withoutNamespace, notPresent, "", ok, []string{"operatorcondition", "learn-operator.v0.0.3", "-n", oc.Namespace()}).check(oc) newCheck("present", asAdmin, withoutNamespace, notPresent, "", ok, []string{"role", "learn-operator.v0.0.3", "-n", oc.Namespace()}).check(oc) newCheck("present", asAdmin, withoutNamespace, notPresent, "", ok, []string{"rolebinding", "learn-operator.v0.0.3", "-n", oc.Namespace()}).check(oc) })
test case
openshift/openshift-tests-private
21a034fb-51c1-479b-b872-097032da0047
ConnectedOnly-Author:jiazha-Medium-37710-supports the Upgradeable Supported Condition
['"context"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:jiazha-Medium-37710-supports the Upgradeable Supported Condition", func() { exutil.By("1) Install the OperatorGroup in a random project") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) oc.SetupProject() buildPruningBaseDir := exutil.FixturePath("testdata", "olm") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-37710", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("2) Install the learn-operator.v0.0.1 with Manual approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-37710", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "alpha", ipApproval: "Manual", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.1", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) defer sub.update(oc, itName, dr) sub.create(oc, itName, dr) exutil.By("3) Apprrove this learn-operator.v0.0.1, it should be in Complete state") sub.approveSpecificIP(oc, itName, dr, "learn-operator.v0.0.1", "Complete") newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.1", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) // The conditions array will be added to OperatorCondition’s spec and operator is now expected to only update the conditions in the spec to reflect its condition // and no longer push changes to OperatorCondition’s status. // $oc patch operatorcondition learn-operator.v0.0.1 -p '{"spec":{"conditions":[{"type":"Upgradeable", "observedCondition":1,"status":"False","reason":"bug","message":"not ready","lastUpdateTime":"2021-06-16T16:56:44Z","lastTransitionTime":"2021-06-16T16:56:44Z"}]}}' --type=merge exutil.By("4) Patch the spec.conditions[0].Upgradeable to False") patchResource(oc, asAdmin, withoutNamespace, "-n", oc.Namespace(), "operatorcondition", "learn-operator.v0.0.1", "-p", "{\"spec\": {\"conditions\": [{\"type\": \"Upgradeable\", \"status\": \"False\", \"reason\": \"upgradeIsNotSafe\", \"message\": \"Disable the upgrade\", \"observedCondition\":1, \"lastUpdateTime\":\"2021-06-16T16:56:44Z\",\"lastTransitionTime\":\"2021-06-16T16:56:44Z\"}]}}", "--type=merge") newCheck("expect", asAdmin, withoutNamespace, compare, "Upgradeable", ok, []string{"operatorcondition", "learn-operator.v0.0.1", "-n", oc.Namespace(), "-o=jsonpath={.status.conditions[0].type}"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, compare, "False", ok, []string{"operatorcondition", "learn-operator.v0.0.1", "-n", oc.Namespace(), "-o=jsonpath={.status.conditions[0].status}"}).check(oc) exutil.By("5) Apprrove this learn-operator.v0.0.2, the corresponding CSV should be in Pending state") sub.approveSpecificIP(oc, itName, dr, "learn-operator.v0.0.2", "Complete") newCheck("expect", asAdmin, withoutNamespace, compare, "Pending", ok, []string{"csv", "learn-operator.v0.0.2", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("6) Check the CSV message, the operator is not upgradeable") err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { msg, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", oc.Namespace(), "csv", "learn-operator.v0.0.2", "-o=jsonpath={.status.message}").Output() if !strings.Contains(msg, "operator is not upgradeable") { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "learn-operator.v0.0.2 operator is upgradeable") exutil.By("7) Patch the spec.conditions[0].Upgradeable to True") // $oc patch operatorcondition learn-operator.v0.0.1 -p '{"spec":{"conditions":[{"type":"Upgradeable", "observedCondition":1,"status":"True","reason":"bug","message":"ready","lastUpdateTime":"2021-06-16T16:56:44Z","lastTransitionTime":"2021-06-16T16:56:44Z"}]}}' --type=merge patchResource(oc, asAdmin, withoutNamespace, "-n", oc.Namespace(), "operatorcondition", "learn-operator.v0.0.1", "-p", "{\"spec\": {\"conditions\": [{\"type\": \"Upgradeable\", \"status\": \"True\", \"reason\": \"ready\", \"message\": \"enable the upgrade\", \"observedCondition\":1, \"lastUpdateTime\":\"2021-06-16T17:56:44Z\",\"lastTransitionTime\":\"2021-06-16T17:56:44Z\"}]}}", "--type=merge") exutil.By("8) the learn-operator.v0.0.1 can be upgraded to etcdoperator.v0.9.4 successfully") newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.2", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) })
test case
openshift/openshift-tests-private
e58ce103-6204-4fb0-853f-08a0442d915c
Author:jiazha-Medium-37631-Allow cluster admin to overwrite the OperatorCondition
['"context"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-Medium-37631-Allow cluster admin to overwrite the OperatorCondition", func() { exutil.By("1) Install the OperatorGroup in a random project") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) oc.SetupProject() buildPruningBaseDir := exutil.FixturePath("testdata", "olm") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-37631", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("2) Install the learn-operator.v0.0.1 with Manual approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-37631", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "alpha", ipApproval: "Manual", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.1", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) defer sub.update(oc, itName, dr) sub.create(oc, itName, dr) exutil.By("3) Apprrove this learn-operator.v0.0.1, it should be in Complete state") sub.approveSpecificIP(oc, itName, dr, "learn-operator.v0.0.1", "Complete") newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.1", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("4) Patch the OperatorCondition to set the Upgradeable to False") patchResource(oc, asAdmin, withoutNamespace, "-n", oc.Namespace(), "operatorcondition", "learn-operator.v0.0.1", "-p", "{\"spec\": {\"overrides\": [{\"type\": \"Upgradeable\", \"status\": \"False\", \"reason\": \"upgradeIsNotSafe\", \"message\": \"Disable the upgrade\"}]}}", "--type=merge") exutil.By("5) Apprrove this learn-operator.v0.0.2, the corresponding CSV should be in Pending state") sub.approveSpecificIP(oc, itName, dr, "learn-operator.v0.0.2", "Complete") newCheck("expect", asAdmin, withoutNamespace, compare, "Pending", ok, []string{"csv", "learn-operator.v0.0.2", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("6) Check the CSV message, the operator is not upgradeable") err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { msg, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", oc.Namespace(), "csv", "learn-operator.v0.0.2", "-o=jsonpath={.status.message}").Output() if !strings.Contains(msg, "operator is not upgradeable") { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "learn-operator.v0.0.2 operator is upgradeable") exutil.By("7) Change the Upgradeable of the OperatorCondition to True") patchResource(oc, asAdmin, withoutNamespace, "-n", oc.Namespace(), "operatorcondition", "learn-operator.v0.0.1", "-p", "{\"spec\": {\"overrides\": [{\"type\": \"Upgradeable\", \"status\": \"True\", \"reason\": \"upgradeIsNotSafe\", \"message\": \"Disable the upgrade\"}]}}", "--type=merge") exutil.By("8) the learn-operator.v0.0.1 should be upgraded to learn-operator.v0.0.2 successfully") newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.2", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) })
test case
openshift/openshift-tests-private
6c376fc6-0a0e-4732-a196-e339464c1034
ConnectedOnly-Author:jiazha-Medium-33450-Operator upgrades can delete existing CSV before completion
['"context"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', '"time"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:jiazha-Medium-33450-Operator upgrades can delete existing CSV before completion", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.By("1) Install a customization CatalogSource CR") buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-opm.yaml") cs := catalogSourceDescription{ name: "cs-33450", namespace: "openshift-marketplace", displayName: "OLM QE Operators", publisher: "Jian", sourceType: "grpc", address: "quay.io/olmqe/etcd-index:33450-fips", template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) cs.create(oc, itName, dr) defer cs.delete(itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", "openshift-marketplace", "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("2) Subscribe to the etcd operator with Manual approval") oc.SetupProject() ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-33450", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-33450", namespace: oc.Namespace(), catalogSourceName: "cs-33450", catalogSourceNamespace: "openshift-marketplace", channel: "alpha", ipApproval: "Manual", operatorPackage: "etcd", startingCSV: "etcdoperator.v0.9.2", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) sub.create(oc, itName, dr) exutil.By("3) Apprrove the etcdoperator.v0.9.2, it should be in Complete state") sub.approveSpecificIP(oc, itName, dr, "etcdoperator.v0.9.2", "Complete") newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.2", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("4) Apprrove the etcdoperator.v0.9.4, it should be in Failed state") sub.approveSpecificIP(oc, itName, dr, "etcdoperator.v0.9.4", "Failed") exutil.By("5) The etcdoperator.v0.9.4 CSV should be in Pending status") newCheck("expect", asAdmin, withoutNamespace, compare, "Pending", ok, []string{"csv", "etcdoperator.v0.9.4", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("6) The SA should be owned by the etcdoperator.v0.9.2") err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 10*time.Second, false, func(ctx context.Context) (bool, error) { saOwner := getResource(oc, asAdmin, withoutNamespace, "sa", "etcd-operator", "-n", sub.namespace, "-o=jsonpath={.metadata.ownerReferences[0].name}") if strings.Compare(saOwner, "etcdoperator.v0.9.2") != 0 { return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "sa etcd-operator owner is not etcdoperator.v0.9.2") })
test case
openshift/openshift-tests-private
7dac4bda-cf1f-4fb1-86c9-d41c85dad683
Author:jiazha-ConnectedOnly-NonHyperShiftHOST-High-37260-should allow to create the default CatalogSource [Disruptive]
['"context"', '"fmt"', '"os/exec"', '"encoding/json"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-ConnectedOnly-NonHyperShiftHOST-High-37260-should allow to create the default CatalogSource [Disruptive]", func() { exutil.SkipBaselineCaps(oc, "None") exutil.SkipIfDisableDefaultCatalogsource(oc) exutil.By("1) Disable the default OperatorHub") patchResource(oc, asAdmin, withoutNamespace, "operatorhub", "cluster", "-p", "{\"spec\": {\"disableAllDefaultSources\": true}}", "--type=merge") defer patchResource(oc, asAdmin, withoutNamespace, "operatorhub", "cluster", "-p", "{\"spec\": {\"disableAllDefaultSources\": false}}", "--type=merge") exutil.By("1-1) Check if the default CatalogSource resource are removed") err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { res, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", "redhat-operators", "-n", "openshift-marketplace").Output() if strings.Contains(res, "not found") { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "redhat-operators found") exutil.By("2) Create a CatalogSource with a default CatalogSource name") buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") ocpVersionByte, err := exec.Command("bash", "-c", "oc version -o json | jq -r '.openshiftVersion' | cut -d '.' -f1,2").Output() o.Expect(err).NotTo(o.HaveOccurred()) ocpVersion := strings.Replace(string(ocpVersionByte), "\n", "", -1) indexImage := fmt.Sprintf("quay.io/openshift-qe-optional-operators/aosqe-index:v%s", ocpVersion) oc.SetupProject() cs := catalogSourceDescription{ name: "redhat-operators", namespace: "openshift-marketplace", displayName: "OLM QE", publisher: "OLM QE", sourceType: "grpc", address: indexImage, template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) cs.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", cs.namespace, "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("2-1) Check if this custom CatalogSource resource works well") err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { res, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest").Output() if strings.Contains(res, "OLM QE") { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "packagemanifest does not contain OLM QE") exutil.By("3) Delete the Marketplace pods and check if the custome CatalogSource still works well") exutil.By("3-1) get the marketplace-operator pod's name") podName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", "name=marketplace-operator", "-o=jsonpath={.items..metadata.name}", "-n", "openshift-marketplace").Output() if err != nil { e2e.Failf("Failed to get the marketplace pods") } exutil.By("3-2) delete/recreate the marketplace-operator pod") _, err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("pods", podName, "-n", "openshift-marketplace").Output() o.Expect(err).NotTo(o.HaveOccurred()) // time.Sleep(30 * time.Second) // waiting for the new marketplace pod ready err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { res, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", "name=marketplace-operator", "-o=jsonpath={.items..status.phase}", "-n", "openshift-marketplace").Output() if strings.Contains(res, "Running") { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "marketplace-operator pod is not running") exutil.By("3-3) check if the custom CatalogSource still there") newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", cs.namespace, "-o=jsonpath={.status..lastObservedState}"}).check(oc) err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { res, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest").Output() if strings.Contains(res, "OLM QE") { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "packagemanifest does not contain OLM QE") exutil.By("4) Enable the default OperatorHub") patchResource(oc, true, true, "operatorhub", "cluster", "-p", "{\"spec\": {\"disableAllDefaultSources\": false}}", "--type=merge") exutil.By("4-1) Check if the default CatalogSource resource are back") newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", "redhat-operators", "-n", "openshift-marketplace", "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("4-2) Check if the default CatalogSource works and the custom one are removed") err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { res, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest").Output() if strings.Contains(res, "Red Hat Operators") && !strings.Contains(res, "OLM QE") { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "packagemanifest does contain OLM QE or has no Red Hat Operators") })
test case
openshift/openshift-tests-private
5165d85d-101b-4d6f-aada-a852c76ee71e
Author:jiazha-Medium-25922-Support spec.config.volumes and volumemount in Subscription
['"context"', '"fmt"', '"os/exec"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-Medium-25922-Support spec.config.volumes and volumemount in Subscription", func() { buildPruningBaseDir := exutil.FixturePath("testdata", "olm") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") oc.SetupProject() og := operatorGroupDescription{ name: "test-og-25922", namespace: oc.Namespace(), template: ogSingleTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By(fmt.Sprintf("1) create the OperatorGroup in project: %s", oc.Namespace())) og.createwithCheck(oc, itName, dr) exutil.By("2) install learn-operator.v0.0.3") sub := subscriptionDescription{ subName: "sub-25922", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) defer sub.update(oc, itName, dr) sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.3", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("3) create a ConfigMap") cmTemplate := filepath.Join(buildPruningBaseDir, "cm-template.yaml") cm := configMapDescription{ name: "special-config", namespace: oc.Namespace(), template: cmTemplate, } cm.create(oc, itName, dr) exutil.By("4) Patch this ConfigMap a volume") sub.patch(oc, "{\"spec\": {\"channel\":\"alpha\",\"config\":{\"volumeMounts\":[{\"mountPath\":\"/test\",\"name\":\"config-volume\"}],\"volumes\":[{\"configMap\":{\"name\":\"special-config\"},\"name\":\"config-volume\"}]},\"name\":\"learn\",\"source\":\"cs-25922\",\"sourceNamespace\":\"openshift-marketplace\"}}") err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { podName, err := oc.AsAdmin().Run("get").Args("pods", "-l", "name=learn-operator", "-o=jsonpath={.items[0].metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) e2e.Logf("4-1) Get learn operator pod name:%s", podName) result, _ := oc.AsAdmin().Run("exec").Args(podName, "--", "cat", "/test/special.how").Output() e2e.Logf("4-2) Check if the ConfigMap mount well") if strings.Contains(result, "very") { e2e.Logf("4-3) The ConfigMap: special-config mount well") return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "pod of learn-operator-alm-owned special-config not mount well") exutil.By("5) Patch a non-exist volume") sub.patch(oc, "{\"spec\":{\"channel\":\"alpha\",\"config\":{\"volumeMounts\":[{\"mountPath\":\"/test\",\"name\":\"volume1\"}],\"volumes\":[{\"persistentVolumeClaim\":{\"claimName\":\"claim1\"},\"name\":\"volume1\"}]},\"name\":\"learn\",\"source\":\"cs-25922\",\"sourceNamespace\":\"openshift-marketplace\"}}") err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { for i := 0; i < 2; i++ { exutil.By("5-1) Check the pods status") podStatus, err := oc.AsAdmin().Run("get").Args("pods", "-l", "name=learn-operator", fmt.Sprintf("-o=jsonpath={.items[%d].status.phase}", i)).Output() o.Expect(err).NotTo(o.HaveOccurred()) if podStatus == "Pending" { exutil.By("5-2) The pod status is Pending as expected") return true, nil } } return false, nil }) exutil.AssertWaitPollNoErr(err, "pod of learn-operator-alm-owned status is not Pending") })
test case
openshift/openshift-tests-private
729ff47a-5fbe-4aaf-bbf8-8ea1fe44fef8
Author:jiazha-Medium-35631-Remove OperatorSource API
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-Medium-35631-Remove OperatorSource API", func() { exutil.SkipBaselineCaps(oc, "None") exutil.By("1) Check the operatorsource resource") msg, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("operatorsource").Output() e2e.Logf("Get the expected error: %s", msg) o.Expect(msg).To(o.ContainSubstring("the server doesn't have a resource type")) // for current disconnected env, only have the default community CatalogSource CRs exutil.By("2) Check the default Community CatalogSource CRs") msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", "-n", "openshift-marketplace").Output() o.Expect(err).NotTo(o.HaveOccurred()) e2e.Logf("Get the installed CatalogSource CRs:\n %s", msg) o.Expect(msg).To(o.ContainSubstring("grpc")) // o.Expect(msg).To(o.ContainSubstring("certified-operators")) // o.Expect(msg).To(o.ContainSubstring("community-operators")) // o.Expect(msg).To(o.ContainSubstring("redhat-marketplace")) // o.Expect(msg).To(o.ContainSubstring("redhat-operators")) exutil.By("3) Check the Packagemanifest") msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "-n", "openshift-marketplace").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).NotTo(o.ContainSubstring("No resources found")) })
test case
openshift/openshift-tests-private
57b81119-ffdb-4438-a192-ce8cbf89b0a8
ConnectedOnly-Author:bandrade-Medium-31693-Check CSV information on the PackageManifest
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-Medium-31693-Check CSV information on the PackageManifest", func() { exutil.SkipBaselineCaps(oc, "None") exutil.SkipIfDisableDefaultCatalogsource(oc) exutil.By("1) The relatedImages should exist") msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "-n", "openshift-marketplace", "prometheus", "-o=jsonpath={.status.channels[?(.name=='beta')].currentCSVDesc.relatedImages}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).NotTo(o.BeEmpty()) exutil.By("2) The minKubeVersion should exist") msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "-n", "openshift-marketplace", "prometheus", "-o=jsonpath={.status.channels[?(.name=='beta')].currentCSVDesc.minKubeVersion}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).NotTo(o.BeEmpty()) exutil.By("3) In this case, nativeAPI is optional, and prometheus does not have any nativeAPIs, which is ok.") oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "-n", "openshift-marketplace", "prometheus", "-o=jsonpath={.status.channels[?(.name=='beta')].currentCSVDesc.nativeAPIs}").Output() o.Expect(err).NotTo(o.HaveOccurred()) })
test case
openshift/openshift-tests-private
5c8fcf63-7bb1-41dc-90ee-55b981b2968f
ConnectedOnly-Author:bandrade-Medium-54038-Comply with Operator Anti-Affinity definition
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-Medium-54038-Comply with Operator Anti-Affinity definition", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipIfDisableDefaultCatalogsource(oc) exutil.SkipBaselineCaps(oc, "None") var ( buildPruningBaseDir = exutil.FixturePath("testdata", "olm") subFile = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") prometheusCR = filepath.Join(buildPruningBaseDir, "prometheus-antiaffinity.yaml") ) dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) var ( og = operatorGroupDescription{ name: "test-og-54038", namespace: oc.Namespace(), template: ogSingleTemplate, } sub = subscriptionDescription{ subName: "sub-54038", namespace: oc.Namespace(), catalogSourceName: "community-operators", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "prometheus", singleNamespace: true, template: subFile, } workerNodes, _ = exutil.GetSchedulableLinuxWorkerNodes(oc) firstNode = workerNodes[0] ) exists, _ := clusterPackageExists(oc, sub) if !exists { g.Skip("SKIP:PackageMissing prometheus does not exist in catalog community-operators") } if isSNOCluster(oc) { g.Skip("SNO cluster - skipping test ...") } if len(strings.TrimSpace(firstNode.Name)) == 0 { g.Skip("Skipping becauuse there's no cluster with READY state") } exutil.By("1) Install the OperatorGroup in a random project") og.createwithCheck(oc, itName, dr) exutil.By("2) Install the Prometheus with Automatic approval") sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("3) Add app label") defer e2enode.RemoveLabelOffNode(oc.KubeFramework().ClientSet, firstNode.Name, "app_54038") e2enode.AddOrUpdateLabelOnNode(oc.KubeFramework().ClientSet, firstNode.Name, "app_54038", "dev") msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "--show-labels", "--no-headers").Output() o.Expect(err).NotTo(o.HaveOccurred()) e2e.Logf("Node labels " + msg) exutil.By("4) Install the Prometheus CR") _, err = oc.WithoutNamespace().AsAdmin().Run("create").Args("-f", prometheusCR, "-n", oc.Namespace()).Output() o.Expect(err).NotTo(o.HaveOccurred()) newCheck("expect", asAdmin, withoutNamespace, compare, "Available", ok, []string{"Prometheus", "example", "-n", oc.Namespace(), "-o=jsonpath={.status.conditions[0].type}"}).check(oc) exutil.By("5) Ensure that pod is not scheduled in the node with the defined label") deployedNode := getResource(oc, asAdmin, withoutNamespace, "pods", "prometheus-example-0", "-n", oc.Namespace(), "-o=jsonpath={.spec.nodeName}") if firstNode.Name == deployedNode { e2e.Failf("Prometheus is deployed in the same node of app_54038 label. Node: %s . Node Labels: %s", deployedNode, msg) } })
test case
openshift/openshift-tests-private
6f4504f5-388d-4989-a8f5-a43526efd681
ConnectedOnly-Author:bandrade-Medium-54036-Comply with Operator NodeAffinity definition
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-Medium-54036-Comply with Operator NodeAffinity definition", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipIfDisableDefaultCatalogsource(oc) exutil.SkipBaselineCaps(oc, "None") var ( buildPruningBaseDir = exutil.FixturePath("testdata", "olm") subFile = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") prometheusCRTemplate = filepath.Join(buildPruningBaseDir, "prometheus-nodeaffinity.yaml") ) dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) var ( og = operatorGroupDescription{ name: "test-og-54036", namespace: oc.Namespace(), template: ogSingleTemplate, } sub = subscriptionDescription{ subName: "sub-54036", namespace: oc.Namespace(), catalogSourceName: "community-operators", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "prometheus", singleNamespace: true, template: subFile, } ) workerNodes, _ := exutil.GetSchedulableLinuxWorkerNodes(oc) firstNode := "" for _, worker := range workerNodes { for _, con := range worker.Status.Conditions { _, ok := worker.Labels["node-role.kubernetes.io/edge"] if con.Type == "Ready" && con.Status == "True" && !ok { firstNode = worker.Name } } } if isSNOCluster(oc) || firstNode == "" { g.Skip("SNO cluster - skipping test ...") } if len(strings.TrimSpace(firstNode)) == 0 { g.Skip("Skipping becauuse there's no cluster with READY state") } exutil.By("1) Install the OperatorGroup in a random project") og.createwithCheck(oc, itName, dr) exists, _ := clusterPackageExists(oc, sub) if !exists { g.Skip("SKIP:PackageMissing learn does not exist in catalog qe-app-registry") } exutil.By("2) Install the Prometheus with Automatic approval") sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("3) Install the Prometheus CR") err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", prometheusCRTemplate, "-p", "NODE_NAME="+firstNode, "NAMESPACE="+oc.Namespace()) o.Expect(err).NotTo(o.HaveOccurred()) newCheck("expect", asAdmin, withoutNamespace, compare, "Available", ok, []string{"Prometheus", "example", "-n", oc.Namespace(), "-o=jsonpath={.status.conditions[0].type}"}).check(oc) exutil.By("4) Ensure that pod is scaled in the specified node") deployedNode := getResource(oc, asAdmin, withoutNamespace, "pods", "prometheus-example-0", "-n", oc.Namespace(), "-o=jsonpath={.spec.nodeName}") o.Expect(firstNode).To(o.Equal(deployedNode)) })
test case
openshift/openshift-tests-private
d087d4a4-21f6-41f0-afb7-a59fb694716a
Author:bandrade-Medium-24850-Allow users to edit the deployment of an active CSV
['"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-Medium-24850-Allow users to edit the deployment of an active CSV", func() { exutil.By("1) Install the OperatorGroup in a random project") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) oc.SetupProject() buildPruningBaseDir := exutil.FixturePath("testdata", "olm") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-24850", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("2) Install the learn operator with Automatic approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-24850", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", ipApproval: "Automatic", channel: "beta", operatorPackage: "learn", singleNamespace: true, template: subTemplate, } sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("3) Get pod name") podName, err := oc.AsAdmin().Run("get").Args("pods", "-l", "name=learn-operator", "-n", oc.Namespace(), "-o=jsonpath={.items..metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("4) Patch the deploy object by adding an environment variable") _, err = oc.AsAdmin().WithoutNamespace().Run("set").Args("env", "deploy/learn-operator", "A=B", "-n", oc.Namespace()).Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("5) Get restarted pod name") podNameAfterPatch, err := oc.AsAdmin().Run("get").Args("pods", "-l", "name=learn-operator", "-n", oc.Namespace(), "-o=jsonpath={.items..metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(podName).NotTo(o.Equal(podNameAfterPatch)) })
test case
openshift/openshift-tests-private
5ca79242-deda-4d1b-8952-f23e96951abc
Author:bandrade-ConnectedOnly-High-24387-Any CRD upgrade is allowed if there is only one owner in a cluster [Disruptive]
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-ConnectedOnly-High-24387-Any CRD upgrade is allowed if there is only one owner in a cluster [Disruptive]", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipBaselineCaps(oc, "None") var ( catName = "cs-24387" buildPruningBaseDir = exutil.FixturePath("testdata", "olm") csImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") subFile = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") ) oc.SetupProject() dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) var ( cs = catalogSourceDescription{ name: catName, namespace: "openshift-marketplace", displayName: "OLM QE Operators", publisher: "bandrade", sourceType: "grpc", address: "quay.io/olmqe/etcd-index-24387:5.0", template: csImageTemplate, } og = operatorGroupDescription{ name: "test-og-24387", namespace: oc.Namespace(), template: ogSingleTemplate, } sub = subscriptionDescription{ subName: "etcd", namespace: oc.Namespace(), catalogSourceName: "community-operators", catalogSourceNamespace: "openshift-marketplace", channel: "singlenamespace-alpha", ipApproval: "Automatic", operatorPackage: "etcd", singleNamespace: true, template: subFile, startingCSV: "etcdoperator.v0.9.4", } subModified = subscriptionDescription{ subName: "etcd", namespace: oc.Namespace(), catalogSourceName: catName, catalogSourceNamespace: "openshift-marketplace", ipApproval: "Automatic", template: subFile, channel: "singlenamespace-alpha", operatorPackage: "etcd", startingCSV: "etcdoperator.v0.9.4", singleNamespace: true, } ) exutil.By("1) Create catalog source") defer cs.delete(itName, dr) cs.create(oc, itName, dr) exutil.By("2) Create the OperatorGroup") og.createwithCheck(oc, itName, dr) exutil.By("3) Start to subscribe to the Etcd operator") sub.create(oc, itName, dr) exutil.By("4) Delete Etcd subscription and csv") sub.delete(itName, dr) sub.deleteCSV(itName, dr) exutil.By("5) Start to subscribe to the Etcd operator with the modifier crd") subModified.create(oc, itName, dr) exutil.By("6) Get property propertyIncludedTest in etcdclusters.etcd.database.coreos.com") crdYamlOutput, err := oc.AsAdmin().Run("get").Args("crd", "etcdclusters.etcd.database.coreos.com", "-o=yaml").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(crdYamlOutput).To(o.ContainSubstring("propertyIncludedTest")) })
test case
openshift/openshift-tests-private
420c7fe0-dc72-4a47-a9f3-41dfac42e995
Author:bandrade-Medium-42970-OperatorGroup status indicates cardinality conflicts - SingleNamespace
['"context"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-Medium-42970-OperatorGroup status indicates cardinality conflicts - SingleNamespace", func() { var ( buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") ) oc.SetupProject() dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() ns := oc.Namespace() dr.addIr(itName) var ( og = operatorGroupDescription{ name: "og-42970", namespace: ns, template: ogSingleTemplate, } og1 = operatorGroupDescription{ name: "og-42970-1", namespace: ns, template: ogSingleTemplate, } ) exutil.By("1) Create first OperatorGroup") og.create(oc, itName, dr) exutil.By("2) Create second OperatorGroup") og1.create(oc, itName, dr) exutil.By("3) Check OperatorGroup Status") newCheck("expect", asAdmin, withoutNamespace, compare, "MultipleOperatorGroupsFound", ok, []string{"og", og.name, "-n", ns, "-o=jsonpath={.status.conditions..reason}"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, compare, "MultipleOperatorGroupsFound", ok, []string{"og", og1.name, "-n", ns, "-o=jsonpath={.status.conditions..reason}"}).check(oc) exutil.By("4) Delete second OperatorGroup") og1.delete(itName, dr) exutil.By("5) Check OperatorGroup status") err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) { output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("og", og.name, "-n", ns, "-o=jsonpath={.status.conditions..reason}").Output() if err != nil { e2e.Logf("Fail to get og: %s, error: %s and try again", og.name, err) return false, nil } if strings.Compare(output, "") == 0 { return true, nil } e2e.Logf("The error MultipleOperatorGroupsFound still be reported in status, try gain") return false, nil }) exutil.AssertWaitPollNoErr(err, "The error MultipleOperatorGroupsFound still be reported in status") exutil.By("6) OCP-42970 SUCCESS") })
test case
openshift/openshift-tests-private
21edbc17-1607-4007-8ac3-c112e6511457
Author:bandrade-Medium-42972-OperatorGroup status should indicate if the SA named in spec not found
['"context"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-Medium-42972-OperatorGroup status should indicate if the SA named in spec not found", func() { var ( buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSAtemplate = filepath.Join(buildPruningBaseDir, "operatorgroup-serviceaccount.yaml") sa = "scoped-42972" ) oc.SetupProject() dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() ns := oc.Namespace() dr.addIr(itName) var ( og = operatorGroupDescription{ name: "og-42972", namespace: ns, template: ogSAtemplate, serviceAccountName: sa, } ) exutil.By("1) Create first OperatorGroup") og.create(oc, itName, dr) exutil.By("2) Check OperatorGroup Status") newCheck("expect", asAdmin, withoutNamespace, compare, "ServiceAccountNotFound", ok, []string{"og", og.name, "-n", ns, "-o=jsonpath={.status.conditions..reason}"}).check(oc) exutil.By("3) Check Service Account") _, err := oc.WithoutNamespace().AsAdmin().Run("create").Args("sa", sa, "-n", ns).Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("4) Check OperatorGroup status") err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) { output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("og", og.name, "-n", ns, "-o=jsonpath={.status.conditions..reason}").Output() if err != nil { e2e.Logf("Fail to get og: %s, error: %s and try again", og.name, err) return false, nil } if strings.Compare(output, "") == 0 { return true, nil } e2e.Logf("The error ServiceAccountNotFound still be reported in status, try gain") return false, nil }) exutil.AssertWaitPollNoErr(err, "The error ServiceAccountNotFound still be reported in status") })
test case
openshift/openshift-tests-private
58139857-85a7-4e58-b731-3a4a0d71d843
Author:jiazha-ConnectedOnly-Medium-33902-Catalog Weighting
['"fmt"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-ConnectedOnly-Medium-33902-Catalog Weighting", func() { architecture.SkipNonAmd64SingleArch(oc) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") oc.SetupProject() ns := oc.Namespace() // the priority ranking is bucket-test1 > bucket-test2 > community-operators(-400 default) csObjects := []struct { name string address string priority int }{ {"ocs-cs", "quay.io/olmqe/ocs-index:4.3.0", 0}, {"bucket-test1", "quay.io/olmqe/bucket-index:1.0.0", 20}, {"bucket-test2", "quay.io/olmqe/bucket-index:1.0.0", -1}, } // create the OperatorGroup resource og := operatorGroupDescription{ name: "test-og-33902", namespace: ns, template: ogSingleTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) defer func() { for _, v := range csObjects { exutil.By(fmt.Sprintf("9) Remove the %s CatalogSource", v.name)) cs := catalogSourceDescription{ name: v.name, namespace: "openshift-marketplace", displayName: "Priority Test", publisher: "OLM QE", sourceType: "grpc", address: v.address, template: csImageTemplate, priority: v.priority, } cs.delete(itName, dr) } }() for i, v := range csObjects { exutil.By(fmt.Sprintf("%d) start to create the %s CatalogSource", i+1, v.name)) cs := catalogSourceDescription{ name: v.name, namespace: "openshift-marketplace", displayName: "Priority Test", publisher: "OLM QE", sourceType: "grpc", address: v.address, template: csImageTemplate, priority: v.priority, } cs.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", cs.namespace, "-o=jsonpath={.status.connectionState.lastObservedState}"}).check(oc) } exutil.By("4) create the OperatorGroup") og.createwithCheck(oc, itName, dr) exutil.By("5) start to subscribe to the OCS operator") sub := subscriptionDescription{ subName: "ocs-sub", namespace: ns, catalogSourceName: "ocs-cs", catalogSourceNamespace: "openshift-marketplace", channel: "4.3.0", ipApproval: "Automatic", operatorPackage: "ocs-operator", singleNamespace: true, template: subTemplate, } sub.create(oc, itName, dr) exutil.By("6) check the dependce operator's subscription") depSub := subscriptionDescription{ subName: "lib-bucket-provisioner-4.3.0-bucket-test1-openshift-marketplace", namespace: ns, catalogSourceName: "bucket-test1", catalogSourceNamespace: "openshift-marketplace", channel: "4.3.0", ipApproval: "Automatic", operatorPackage: "lib-bucket-provisioner", singleNamespace: true, template: subTemplate, } // The dependence is lib-bucket-provisioner-4.3.0, it should from the bucket-test1 CatalogSource since its priority is the highest. dr.getIr(itName).add(newResource(oc, "sub", depSub.subName, requireNS, depSub.namespace)) depSub.findInstalledCSV(oc, itName, dr) exutil.By(fmt.Sprintf("7) Remove subscription:%s, %s", sub.subName, depSub.subName)) sub.delete(itName, dr) sub.deleteCSV(itName, dr) depSub.delete(itName, dr) depSub.getCSV().delete(itName, dr) })
test case
openshift/openshift-tests-private
3f5682e2-9830-47f7-9dc7-660820312af7
Author:bandrade-Medium-24771-OLM should support for user defined ServiceAccount for OperatorGroup
['"context"', '"encoding/json"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-Medium-24771-OLM should support for user defined ServiceAccount for OperatorGroup", func() { buildPruningBaseDir := exutil.FixturePath("testdata", "olm") saRoles := filepath.Join(buildPruningBaseDir, "scoped-sa-roles.yaml") oc.SetupProject() namespace := oc.Namespace() ogSAtemplate := filepath.Join(buildPruningBaseDir, "operatorgroup-serviceaccount.yaml") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") csv := "learn-operator.v0.0.3" sa := "scoped-24771" sub := subscriptionDescription{ subName: "sub-24771", namespace: namespace, catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } // create the OperatorGroup resource og := operatorGroupDescription{ name: "test-og-24771", namespace: namespace, serviceAccountName: sa, template: ogSAtemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By("1) check if this operator ready for installing") e2e.Logf("Check if %v exists in the %v catalog", sub.operatorPackage, sub.catalogSourceName) exists, err := clusterPackageExists(oc, sub) if !exists { g.Skip("SKIP:PackageMissing learn does not exist in catalog qe-app-registry") } o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("3) Create the OperatorGroup") og.createwithCheck(oc, itName, dr) exutil.By("4) Create the service account") _, err = oc.WithoutNamespace().AsAdmin().Run("create").Args("sa", sa, "-n", namespace).Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("5) Create a Subscription") sub.createWithoutCheck(oc, itName, dr) exutil.By("6) The install plan is Failed") installPlan := sub.getIP(oc) err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { message, _ := oc.AsAdmin().Run("get").Args("installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.message}").Output() if strings.Contains(message, "cannot create resource") { return true, nil } return false, nil }) if err != nil { message, _ := oc.AsAdmin().Run("get").Args("installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.message}").Output() e2e.Logf(message) conditions, _ := oc.AsAdmin().Run("get").Args("installplan", installPlan, "-n", sub.namespace, "-o=jsonpath-as-json={.status.conditions}").Output() e2e.Logf(conditions) } exutil.AssertWaitPollNoErr(err, "cannot create resource not in install plan message") exutil.By("7) Grant the proper permissions to the service account") _, err = oc.WithoutNamespace().AsAdmin().Run("create").Args("-f", saRoles, "-n", namespace).Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("8) Recreate the Subscription") sub.delete(itName, dr) sub.deleteCSV(itName, dr) sub.createWithoutCheck(oc, itName, dr) exutil.By("9) Checking the state of CSV") newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", csv, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc) })
test case
openshift/openshift-tests-private
72d888f5-1fed-46d2-a1d1-80fc2ef1ea21
ConnectedOnly-Author:bandrade-Medium-43073-Indicate dependency class in resolution constraint text
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-Medium-43073-Indicate dependency class in resolution constraint text", func() { architecture.SkipNonAmd64SingleArch(oc) oc.SetupProject() dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() catName := "cs-43073" dr.addIr(itName) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") cs := catalogSourceDescription{ name: catName, namespace: "openshift-marketplace", displayName: "OLM QE Operators", publisher: "bandrade", sourceType: "grpc", address: "quay.io/olmqe/bundle-with-dep-error-index:4.0", template: csImageTemplate, } og := operatorGroupDescription{ name: "og-43073", namespace: oc.Namespace(), template: ogSingleTemplate, } defer cs.delete(itName, dr) exutil.By("1) Create the CatalogSource") cs.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", cs.namespace, "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("2) Install the OperatorGroup in a random project") og.createwithCheck(oc, itName, dr) exutil.By("3) Install the lib-bucket-provisioner with Automatic approval") sub := subscriptionDescription{ subName: "lib-bucket-provisioner-43073", namespace: oc.Namespace(), catalogSourceName: catName, catalogSourceNamespace: "openshift-marketplace", channel: "alpha", ipApproval: "Automatic", operatorPackage: "lib-bucket-provisioner", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) sub.createWithoutCheck(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "ConstraintsNotSatisfiable", ok, []string{"subs", "lib-bucket-provisioner-43073", "-n", oc.Namespace(), "-o=jsonpath={.status.conditions[?(.type==\"ResolutionFailed\")].reason}"}).check(oc) })
test case
openshift/openshift-tests-private
c4fd89f8-0901-4b64-8913-8ac0025a424b
Author:bandrade-Medium-24772-OLM should support for user defined ServiceAccount for OperatorGroup with fine grained permission
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-Medium-24772-OLM should support for user defined ServiceAccount for OperatorGroup with fine grained permission", func() { architecture.SkipNonAmd64SingleArch(oc) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") saRoles := filepath.Join(buildPruningBaseDir, "scoped-sa-fine-grained-roles.yaml") oc.SetupProject() namespace := oc.Namespace() ogSAtemplate := filepath.Join(buildPruningBaseDir, "operatorgroup-serviceaccount.yaml") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") secTemplate := filepath.Join(buildPruningBaseDir, "secret.yaml") csv := "learn-operator.v0.0.3" sa := "scoped-24772" sub := subscriptionDescription{ subName: "sub-24772", namespace: namespace, catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } secret := secretDescription{ name: sa, namespace: namespace, saname: sa, sectype: "kubernetes.io/service-account-token", template: secTemplate, } // create the namespace project := projectDescription{ name: namespace, } // create the OperatorGroup resource og := operatorGroupDescription{ name: "test-og-24772", namespace: namespace, serviceAccountName: sa, template: ogSAtemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By("1) check if this operator ready for installing") e2e.Logf("Check if %v exists in the %v catalog", sub.operatorPackage, sub.catalogSourceName) exists, err := clusterPackageExists(oc, sub) if !exists { g.Skip("SKIP:PackageMissing learn does not exist in catalog qe-app-registry") } o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("2) Create the namespace") project.createwithCheck(oc, itName, dr) exutil.By("3) Create the OperatorGroup") og.createwithCheck(oc, itName, dr) exutil.By("4) Create the service account") _, err = oc.WithoutNamespace().AsAdmin().Run("create").Args("sa", sa, "-n", namespace).Output() o.Expect(err).NotTo(o.HaveOccurred()) secret.create(oc) exutil.By("5) Create a Subscription") sub.createWithoutCheck(oc, itName, dr) exutil.By("6) The install plan is Failed") installPlan := sub.getIP(oc) newCheck("expect", asAdmin, withoutNamespace, contain, "forbidden", ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.message}"}).check(oc) exutil.By("7) Grant the proper permissions to the service account") _, err = oc.WithoutNamespace().AsAdmin().Run("create").Args("-f", saRoles, "-n", namespace).Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("8) Recreate the Subscription") sub.delete(itName, dr) sub.deleteCSV(itName, dr) sub.createWithoutCheck(oc, itName, dr) exutil.By("9) Checking the state of CSV") newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", csv, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc) })
test case
openshift/openshift-tests-private
e8fcd61c-d01b-4d74-a374-e9bea2efd517
Author:bandrade-Medium-24886-OLM should support for user defined ServiceAccount permission changes
['"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-Medium-24886-OLM should support for user defined ServiceAccount permission changes", func() { buildPruningBaseDir := exutil.FixturePath("testdata", "olm") saRoles := filepath.Join(buildPruningBaseDir, "scoped-sa-etcd.yaml") oc.SetupProject() namespace := oc.Namespace() ogTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") ogSAtemplate := filepath.Join(buildPruningBaseDir, "operatorgroup-serviceaccount.yaml") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") secTemplate := filepath.Join(buildPruningBaseDir, "secret.yaml") csv := "learn-operator.v0.0.3" sa := "scoped-24886" sub := subscriptionDescription{ subName: "sub-24772", namespace: namespace, catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } secret := secretDescription{ name: sa, namespace: namespace, saname: sa, sectype: "kubernetes.io/service-account-token", template: secTemplate, } // create the namespace project := projectDescription{ name: namespace, } // create the OperatorGroup resource og := operatorGroupDescription{ name: "test-og-24886", namespace: namespace, template: ogTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By("1) check if this operator ready for installing") e2e.Logf("Check if %v exists in the %v catalog", sub.operatorPackage, sub.catalogSourceName) exists, err := clusterPackageExists(oc, sub) if !exists { g.Skip("SKIP:PackageMissing learn does not exist in catalog qe-app-registry") } o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("2) Create the namespace") project.createwithCheck(oc, itName, dr) exutil.By("3) Create the OperatorGroup without service account") og.createwithCheck(oc, itName, dr) exutil.By("4) Create a Subscription") sub.create(oc, itName, dr) exutil.By("5) Checking the state of CSV") newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", csv, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("6) Delete the Operator Group") og.delete(itName, dr) // create the OperatorGroup resource ogSA := operatorGroupDescription{ name: "test-og-24886", namespace: namespace, serviceAccountName: sa, template: ogSAtemplate, } exutil.By("6) Create the OperatorGroup with service account") ogSA.createwithCheck(oc, itName, dr) exutil.By("7) Create the service account") _, err = oc.WithoutNamespace().AsAdmin().Run("create").Args("sa", sa, "-n", namespace).Output() o.Expect(err).NotTo(o.HaveOccurred()) secret.create(oc) exutil.By("9) Grant the proper permissions to the service account") _, err = oc.WithoutNamespace().AsAdmin().Run("create").Args("-f", saRoles, "-n", namespace).Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("10) Recreate the Subscription") sub.delete(itName, dr) sub.deleteCSV(itName, dr) sub.create(oc, itName, dr) exutil.By("11) Checking the state of CSV") newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", csv, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc) })
test case
openshift/openshift-tests-private
61d40522-3255-4bf7-b481-e91a4fbaaac7
ConnectedOnly-Author:bandrade-Medium-30765-Operator-version based dependencies metadata
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-Medium-30765-Operator-version based dependencies metadata", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipIfDisableDefaultCatalogsource(oc) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") oc.SetupProject() exutil.By("1) Start to create the CatalogSource CR") cs := catalogSourceDescription{ name: "prometheus-dependency-cs", namespace: "openshift-marketplace", displayName: "OLM QE", publisher: "OLM QE", sourceType: "grpc", address: "quay.io/olmqe/etcd-prometheus-dependency-index:11.0", template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) defer cs.delete(itName, dr) cs.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", cs.namespace, "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("2) Install the OperatorGroup in a random project") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-30765", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("3) Install the etcdoperator v0.9.4 with Automatic approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-30765", namespace: oc.Namespace(), catalogSourceName: "prometheus-dependency-cs", catalogSourceNamespace: "openshift-marketplace", channel: "singlenamespace-alpha", ipApproval: "Automatic", operatorPackage: "etcd-service-monitor", startingCSV: "etcdoperator.v0.9.4", singleNamespace: true, template: subTemplate, } sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.4", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("4) Assert that prometheus dependency is resolved") msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace()).Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).To(o.ContainSubstring("prometheus")) })
test case
openshift/openshift-tests-private
720381bb-97e6-4c0f-9faa-12324d255e3f
ConnectedOnly-Author:bandrade-Medium-27680-OLM Bundle support for Prometheus Types [Serial]
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-Medium-27680-OLM Bundle support for Prometheus Types [Serial]", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipIfDisableDefaultCatalogsource(oc) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") exutil.By("Start to create the CatalogSource CR") cs := catalogSourceDescription{ name: "prometheus-dependency1-cs", namespace: "openshift-marketplace", displayName: "OLM QE", publisher: "OLM QE", sourceType: "grpc", address: "quay.io/olmqe/etcd-prometheus-dependency-index:11.0", template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) defer cs.delete(itName, dr) cs.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", cs.namespace, "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("Start to subscribe the Etcd operator") exutil.By("1) Install the OperatorGroup in a random project") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-27680", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("2) Install the etcdoperator v0.9.4 with Automatic approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-27680", namespace: oc.Namespace(), catalogSourceName: "prometheus-dependency1-cs", catalogSourceNamespace: "openshift-marketplace", channel: "singlenamespace-alpha", ipApproval: "Automatic", operatorPackage: "etcd-service-monitor", startingCSV: "etcdoperator.v0.9.4", singleNamespace: true, template: subTemplate, } sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.4", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("Assert that prometheus dependency is resolved") msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace()).Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).To(o.ContainSubstring("prometheus")) exutil.By("Assert that ServiceMonitor is created") msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("ServiceMonitor", "my-servicemonitor", "-n", oc.Namespace()).Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).To(o.ContainSubstring("my-servicemonitor")) exutil.By("Assert that PrometheusRule is created") msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("PrometheusRule", "my-prometheusrule", "-n", oc.Namespace()).Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).To(o.ContainSubstring("my-prometheusrule")) })
test case
openshift/openshift-tests-private
b179eb89-0833-43b3-99cc-fc4837720b8f
Author:bandrade-ConnectedOnly-Medium-24916-Operators in AllNamespaces should be granted namespace list
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-ConnectedOnly-Medium-24916-Operators in AllNamespaces should be granted namespace list", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipBaselineCaps(oc, "None") buildPruningBaseDir := exutil.FixturePath("testdata", "olm") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By("Start to subscribe the Camel-k operator") sub := subscriptionDescription{ subName: "camel-k", namespace: "openshift-operators", catalogSourceName: "community-operators", catalogSourceNamespace: "openshift-marketplace", channel: "stable-1.5", ipApproval: "Automatic", operatorPackage: "camel-k", singleNamespace: false, startingCSV: "camel-k-operator.v1.5.0", template: subTemplate, } exists, err := clusterPackageExists(oc, sub) if !exists { g.Skip("SKIP:PackageMissing camel-k does not exist in catalog community-operators") } o.Expect(err).NotTo(o.HaveOccurred()) defer sub.delete(itName, dr) defer func() { if sub.installedCSV == "" { sub.findInstalledCSV(oc, itName, dr) } sub.deleteCSV(itName, dr) }() sub.create(oc, itName, dr) exutil.By("check if camel-k is already installed") csvList := getResource(oc, asAdmin, withNamespace, "csv", "-o=jsonpath={.items[*].metadata.name}") e2e.Logf("CSV list %s ", csvList) if !strings.Contains("camel-k", csvList) { msg, err := oc.AsAdmin().WithoutNamespace().Run("policy").Args("who-can", "list", "namespaces").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).To(o.ContainSubstring("system:serviceaccount:openshift-operators:camel-k-operator")) } else { e2e.Failf("Not able to install Camel-K Operator") } })
test case
openshift/openshift-tests-private
573e6576-cc40-4fb4-aff9-e700d1e3692b
ConnectedOnly-Author:bandrade-Medium-47149-Conjunctive constraint of one packages and one GVK
['"context"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-Medium-47149-Conjunctive constraint of one packages and one GVK", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipIfDisableDefaultCatalogsource(oc) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") oc.SetupProject() namespace := oc.Namespace() ogTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") exutil.By("Start to create the CatalogSource CR") cs := catalogSourceDescription{ name: "ocp-47149", namespace: namespace, displayName: "ocp-47149", publisher: "OLM QE", sourceType: "grpc", address: "quay.io/olmqe/etcd-47149:1.0", template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) defer cs.delete(itName, dr) cs.createWithCheck(oc, itName, dr) // create the OperatorGroup resource og := operatorGroupDescription{ name: "test-og-47149", namespace: namespace, template: ogTemplate, } exutil.By("1) Create the OperatorGroup without service account") og.createwithCheck(oc, itName, dr) exutil.By("2) Create a Subscription") sub := subscriptionDescription{ subName: "etcd", namespace: namespace, catalogSourceName: "ocp-47149", catalogSourceNamespace: namespace, channel: "singlenamespace-alpha", ipApproval: "Automatic", operatorPackage: "etcd", singleNamespace: true, template: subTemplate, } sub.create(oc, itName, dr) exutil.By("3) Checking the state of CSV") waitErr := wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) { csvList, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", sub.namespace).Output() o.Expect(err).NotTo(o.HaveOccurred()) lines := strings.Split(csvList, "\n") for _, line := range lines { if strings.Contains(line, "prometheusoperator") { e2e.Logf("found csv prometheusoperator") if strings.Contains(line, "Succeeded") { e2e.Logf("the status csv prometheusoperator is Succeeded") return true, nil } e2e.Logf("the status csv prometheusoperator is not Succeeded") return false, nil } } return false, nil }) exutil.AssertWaitPollNoErr(waitErr, "csv prometheusoperator is not Succeeded") newCheck("expect", asUser, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.4", "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc) })
test case
openshift/openshift-tests-private
4373d363-eb42-45b1-a7d1-0184a5856f18
ConnectedOnly-Author:bandrade-Medium-47181-Disjunctive constraint of one package and one GVK
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-Medium-47181-Disjunctive constraint of one package and one GVK", func() { architecture.SkipNonAmd64SingleArch(oc) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") oc.SetupProject() namespace := oc.Namespace() ogTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") exutil.By("Start to create the CatalogSource CR") cs := catalogSourceDescription{ name: "ocp-47181", namespace: namespace, displayName: "ocp-47181", publisher: "OLM QE", sourceType: "grpc", address: "quay.io/olmqe/etcd-47181:1.0", template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) defer cs.delete(itName, dr) cs.createWithCheck(oc, itName, dr) // create the OperatorGroup resource og := operatorGroupDescription{ name: "test-og-47181", namespace: namespace, template: ogTemplate, } exutil.By("1) Create the OperatorGroup without service account") og.createwithCheck(oc, itName, dr) exutil.By("2) Create a Subscription") sub := subscriptionDescription{ subName: "etcd", namespace: namespace, catalogSourceName: "ocp-47181", catalogSourceNamespace: namespace, channel: "singlenamespace-alpha", ipApproval: "Automatic", operatorPackage: "etcd", singleNamespace: true, template: subTemplate, } sub.create(oc, itName, dr) exutil.By("3) Checking the state of CSV") newCheck("expect", asUser, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc) })
test case
openshift/openshift-tests-private
87174364-fe39-4dde-b8d6-dc1d99ed5599
ConnectedOnly-Author:bandrade-Medium-47179-Disjunctive constraint of one package and one GVK
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-Medium-47179-Disjunctive constraint of one package and one GVK", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipIfDisableDefaultCatalogsource(oc) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") oc.SetupProject() namespace := oc.Namespace() ogTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") exutil.By("Start to create the CatalogSource CR") cs := catalogSourceDescription{ name: "ocp-47179", namespace: namespace, displayName: "ocp-47179", publisher: "OLM QE", sourceType: "grpc", address: "quay.io/olmqe/etcd-47179:1.0", template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) defer cs.delete(itName, dr) cs.createWithCheck(oc, itName, dr) // create the OperatorGroup resource og := operatorGroupDescription{ name: "test-og-47179", namespace: namespace, template: ogTemplate, } exutil.By("1) Create the OperatorGroup without service account") og.createwithCheck(oc, itName, dr) exutil.By("2) Create a Subscription") sub := subscriptionDescription{ subName: "etcd", namespace: namespace, catalogSourceName: "ocp-47179", catalogSourceNamespace: namespace, channel: "singlenamespace-alpha", ipApproval: "Automatic", operatorPackage: "etcd", singleNamespace: true, template: subTemplate, } sub.create(oc, itName, dr) exutil.By("3) Checking the state of CSV") newCheck("expect", asUser, withoutNamespace, contain, "red-hat-camel-k-operator", ok, []string{"csv", "-n", sub.namespace}).check(oc) })
test case
openshift/openshift-tests-private
5463e221-a498-4f17-8ee0-33b7d95f908a
NonHyperShiftHOST-ConnectedOnly-Author:bandrade-Medium-49130-Default CatalogSources deployed by marketplace do not have toleration for tainted nodes
['e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-ConnectedOnly-Author:bandrade-Medium-49130-Default CatalogSources deployed by marketplace do not have toleration for tainted nodes", func() { exutil.SkipBaselineCaps(oc, "None") exutil.SkipIfDisableDefaultCatalogsource(oc) podNameCertifiedOP, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-marketplace", "-l", "olm.catalogSource=certified-operators", "-o", "name").Output() o.Expect(err).NotTo(o.HaveOccurred()) podNameCommunityOP, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-marketplace", "-l", "olm.catalogSource=community-operators", "-o", "name").Output() o.Expect(err).NotTo(o.HaveOccurred()) podNameRedhatOP, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-marketplace", "-l", "olm.catalogSource=redhat-operators", "-o", "name").Output() o.Expect(err).NotTo(o.HaveOccurred()) podNames := []string{podNameCertifiedOP, podNameCommunityOP, podNameRedhatOP} for _, name := range podNames { newCheck("expect", asAdmin, withoutNamespace, contain, "node-role.kubernetes.io/master", ok, []string{name, "-o=jsonpath={.spec.tolerations}", "-n", "openshift-marketplace"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, contain, "tolerationSeconds\":120", ok, []string{name, "-o=jsonpath={.spec.tolerations}", "-n", "openshift-marketplace"}).check(oc) } })
test case
openshift/openshift-tests-private
79dfc8ae-026f-404a-8e64-fb72506ddc4f
Author:jiazha-ROSA-OSD_CCS-ARO-NonHyperShiftHOST-High-32559-catalog operator crashed
['"context"', '"fmt"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-ROSA-OSD_CCS-ARO-NonHyperShiftHOST-High-32559-catalog operator crashed", func() { buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "cs-without-image.yaml") oc.SetupProject() namespace := oc.Namespace() csTypes := []struct { name string csType string expectedMSG string }{ {"cs-noimage", "grpc", "image and address unset"}, {"cs-noimage-cm", "configmap", "configmap name unset"}, } for _, t := range csTypes { exutil.By(fmt.Sprintf("test the %s type CatalogSource", t.csType)) cs := catalogSourceDescription{ name: t.name, namespace: namespace, displayName: "OLM QE", publisher: "OLM QE", sourceType: t.csType, template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) cs.create(oc, itName, dr) err := wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", namespace, "catalogsource", cs.name, "-o=jsonpath={.status.message}").Output() if err != nil { e2e.Logf("Fail to get CatalogSource: %s, error: %s and try again", cs.name, err) return false, nil } if strings.Contains(output, t.expectedMSG) { e2e.Logf("Get expected message: %s", t.expectedMSG) return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("catsrc of %s does not contain %v", namespace, t.expectedMSG)) status, err := oc.AsAdmin().Run("get").Args("-n", "openshift-operator-lifecycle-manager", "pods", "-l", "app=catalog-operator", "-o=jsonpath={.items[0].status.phase}").Output() o.Expect(err).NotTo(o.HaveOccurred()) if status != "Running" { e2e.Failf("The status of the CatalogSource: %s pod is: %s", cs.name, status) } } // destroy the two CatalogSource CRs for _, t := range csTypes { _, err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", namespace, "catalogsource", t.name).Output() o.Expect(err).NotTo(o.HaveOccurred()) } })
test case
openshift/openshift-tests-private
b1e102d1-1857-43af-9770-7510e89cd4c9
ConnectedOnly-Author:jiazha-LEVEL0-Critical-22070-support grpc sourcetype [Serial]
['"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:jiazha-LEVEL0-Critical-22070-support grpc sourcetype [Serial]", func() { buildPruningBaseDir := exutil.FixturePath("testdata", "olm") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) exutil.By("1) Start to subscribe the learn operator") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") catsrcName := "qe-app-registry" if isPresentResource(oc, asAdmin, withoutNamespace, present, "catsrc", "auto-release-app-registry", "-n", "openshift-marketplace") { catsrcName = "auto-release-app-registry" } oc.SetupProject() sub := subscriptionDescription{ subName: "sub-22070", namespace: "openshift-operators", catalogSourceName: catsrcName, catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: false, template: subTemplate, } defer sub.delete(itName, dr) defer func() { if sub.installedCSV == "" { sub.findInstalledCSV(oc, itName, dr) } sub.deleteCSV(itName, dr) }() sub.create(oc, itName, dr) newCheck("expect", asAdmin, withNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("3) Assert that learn operator dependency is resolved") msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace()).Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).To(o.ContainSubstring("learn-operator.v0.0.3")) })
test case
openshift/openshift-tests-private
b9c32da5-95fa-4052-9bd9-0d3121d2288c
Author:bandrade-Medium-21130-Fetching non-existent `PackageManifest` should return 404
['"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-Medium-21130-Fetching non-existent `PackageManifest` should return 404", func() { msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "--all-namespaces", "--no-headers").Output() o.Expect(err).NotTo(o.HaveOccurred()) packageserverLines := strings.Split(msg, "\n") if len(packageserverLines) > 0 { raw, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "a_package_that_not_exists", "-o yaml", "--loglevel=8").Output() o.Expect(err).To(o.HaveOccurred()) o.Expect(raw).To(o.ContainSubstring("\"code\": 404")) } else { e2e.Failf("No packages to evaluate if 404 works when a PackageManifest does not exists") } })
test case
openshift/openshift-tests-private
2407b988-c267-4566-8214-6c83c03b1aff
NonHyperShiftHOST-Author:bandrade-Low-24057-Have terminationMessagePolicy defined as FallbackToLogsOnError
['"regexp"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:bandrade-Low-24057-Have terminationMessagePolicy defined as FallbackToLogsOnError", func() { labels := [...]string{"app=packageserver", "app=catalog-operator", "app=olm-operator"} for _, l := range labels { msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-o=jsonpath={range .items[*].spec}{.containers[*].name}{\"\t\"}", "-n", "openshift-operator-lifecycle-manager", "-l", l).Output() o.Expect(err).NotTo(o.HaveOccurred()) amountOfContainers := len(strings.Split(msg, "\t")) msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-o=jsonpath={range .items[*].spec}{.containers[*].terminationMessagePolicy}{\"\t\"}", "-n", "openshift-operator-lifecycle-manager", "-l", l).Output() o.Expect(err).NotTo(o.HaveOccurred()) regexp := regexp.MustCompile("FallbackToLogsOnError") amountOfContainersWithFallbackToLogsOnError := len(regexp.FindAllStringIndex(msg, -1)) o.Expect(amountOfContainers).To(o.Equal(amountOfContainersWithFallbackToLogsOnError)) if amountOfContainers != amountOfContainersWithFallbackToLogsOnError { e2e.Failf("OLM does not have all containers definied with FallbackToLogsOnError terminationMessagePolicy") } } })
test case
openshift/openshift-tests-private
3377893d-9522-47a5-aec3-ae26c1dea343
ConnectedOnly-Author:bandrade-High-32613-Operators won't install if the CSV dependency is already installed
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-High-32613-Operators won't install if the CSV dependency is already installed", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipIfDisableDefaultCatalogsource(oc) exutil.SkipBaselineCaps(oc, "None") buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") oc.SetupProject() exutil.By("1) Start to create the CatalogSource CR") cs := catalogSourceDescription{ name: "prometheus-dependency-cs", namespace: "openshift-marketplace", displayName: "OLM QE", publisher: "OLM QE", sourceType: "grpc", address: "quay.io/olmqe/etcd-prometheus-dependency-index:11.0", template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) defer cs.delete(itName, dr) cs.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", cs.name, "-n", cs.namespace, "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("2) Install the OperatorGroup in a random project") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-32613", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("3) Install the etcdoperator v0.9.4 with Automatic approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-32613", namespace: oc.Namespace(), catalogSourceName: "prometheus-dependency-cs", catalogSourceNamespace: "openshift-marketplace", channel: "singlenamespace-alpha", ipApproval: "Automatic", operatorPackage: "etcd-service-monitor", startingCSV: "etcdoperator.v0.9.4", singleNamespace: true, template: subTemplate, } sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.4", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("4) Assert that prometheus dependency is resolved") msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace()).Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).To(o.ContainSubstring("prometheus")) sub = subscriptionDescription{ subName: "prometheus-32613", namespace: oc.Namespace(), catalogSourceName: "community-operators", catalogSourceNamespace: "openshift-marketplace", ipApproval: "Automatic", channel: "beta", operatorPackage: "prometheus", singleNamespace: true, template: subTemplate, } sub.createWithoutCheck(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, contain, "prometheus-beta-community-operators-openshift-marketplace exists", ok, []string{"subs", "prometheus-32613", "-n", oc.Namespace(), "-o=jsonpath={.status.conditions..message}"}).check(oc) })
test case
openshift/openshift-tests-private
249557d9-c54e-4bc2-88b4-705edd4558ae
ConnectedOnly-Author:bandrade-Low-24055-Check for defaultChannel mandatory field when having multiple channels
['"context"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:bandrade-Low-24055-Check for defaultChannel mandatory field when having multiple channels", func() { olmBaseDir := exutil.FixturePath("testdata", "olm") cmMapWithoutDefaultChannel := filepath.Join(olmBaseDir, "configmap-without-defaultchannel.yaml") cmMapWithDefaultChannel := filepath.Join(olmBaseDir, "configmap-with-defaultchannel.yaml") csNamespaced := filepath.Join(olmBaseDir, "catalogsource-namespace.yaml") namespace := "scenario3" defer RemoveNamespace(namespace, oc) exutil.By("1) Creating a namespace") _, err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", namespace).Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("2) Creating a ConfigMap without a default channel") _, err = oc.WithoutNamespace().AsAdmin().Run("create").Args("-f", cmMapWithoutDefaultChannel).Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("3) Creating a CatalogSource") csWithoutDefaultchannel := catalogSourceDescription{ name: "scenario3", namespace: "scenario3", } _, err = oc.WithoutNamespace().AsAdmin().Run("create").Args("-f", csNamespaced).Output() o.Expect(err).NotTo(o.HaveOccurred()) csWithoutDefaultchannel.setSCCRestricted(oc) exutil.By("4) Checking CatalogSource error statement due to the absence of a default channel") err = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l olm.catalogSource=scenario3", "-n", "scenario3").Output() if err != nil { return false, nil } if strings.Contains(output, "CrashLoopBackOff") { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "pod of olm.catalogSource=scenario3 is not CrashLoopBackOff") exutil.By("5) Changing the CatalogSource to include default channel for each package") _, err = oc.WithoutNamespace().AsAdmin().Run("apply").Args("-f", cmMapWithDefaultChannel).Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("6) Checking the state of CatalogSource(Running)") err = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l olm.catalogSource=scenario3", "-n", "scenario3").Output() if err != nil { return false, nil } if strings.Contains(output, "Running") { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "pod of olm.catalogSource=scenario3 is not running") })
test case
openshift/openshift-tests-private
345e06d9-80a8-495f-89fa-1ce6c2e1d69f
Author:jiazha-NonHyperShiftHOST-Medium-20981-contain the source commit id
['"fmt"', '"os"', '"os/exec"', '"github.com/google/go-github/github"', '"strings"', 'e2e "k8s.io/kubernetes/test/e2e/framework"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-NonHyperShiftHOST-Medium-20981-contain the source commit id", func() { if os.Getenv("GITHUB_TOKEN") == "" { g.Skip("Skip it since no GITHUB_TOKEN configured") } sameCommit := "" subPods := []string{"catalog-operator", "olm-operator", "packageserver"} for _, v := range subPods { podName, err := oc.AsAdmin().Run("get").Args("-n", "openshift-operator-lifecycle-manager", "pods", "-l", fmt.Sprintf("app=%s", v), "-o=jsonpath={.items[0].metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) e2e.Logf("get pod name:%s", podName) exutil.By(fmt.Sprintf("get olm version from the %s pod", v)) commands := []string{"-n", "openshift-operator-lifecycle-manager", "exec", podName, "--", "olm", "--version"} olmVersion, err := oc.AsAdmin().Run(commands...).Args().Output() o.Expect(err).NotTo(o.HaveOccurred()) idSlice := strings.Split(olmVersion, ":") gitCommitID := strings.TrimSpace(idSlice[len(idSlice)-1]) e2e.Logf("olm source git commit ID:%s", gitCommitID) if len(gitCommitID) != 40 { e2e.Failf(fmt.Sprintf("the length of the git commit id is %d, != 40", len(gitCommitID))) } if sameCommit == "" { sameCommit = gitCommitID exutil.By("checking this commitID in https://github.com/openshift/operator-framework-olm repo") ctx, tc := githubClient() client := github.NewClient(tc) // OLM downstream repo has been changed to: https://github.com/openshift/operator-framework-olm _, _, err := client.Git.GetCommit(ctx, "openshift", "operator-framework-olm", gitCommitID) if err != nil { e2e.Failf("Git.GetCommit returned error: %v", err) } o.Expect(err).NotTo(o.HaveOccurred()) } else if gitCommitID != sameCommit { e2e.Failf("These commitIDs inconformity!!!") } } })
test case
openshift/openshift-tests-private
02379c51-3ad6-41ec-9b6d-08aaaabee239
Author:scolange-ConnectedOnly-Medium-32862-Pods found with invalid container images not present in release payload
['"os/exec"', '"strings"', 'container "github.com/openshift/openshift-tests-private/test/extended/util/container"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:scolange-ConnectedOnly-Medium-32862-Pods found with invalid container images not present in release payload", func() { exutil.SkipBaselineCaps(oc, "None") exutil.By("Verify the version of marketplace_operator") pods, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", "openshift-marketplace", "--no-headers").Output() o.Expect(err).NotTo(o.HaveOccurred()) lines := strings.Split(pods, "\n") for _, line := range lines { e2e.Logf("line: %v", line) if strings.Contains(line, "certified-operators") || strings.Contains(line, "community-operators") || strings.Contains(line, "marketplace-operator") || strings.Contains(line, "redhat-marketplace") || strings.Contains(line, "redhat-operators") && strings.Contains(line, "1/1") { name := strings.Split(line, " ") checkRel, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args(name[0], "-n", "openshift-marketplace", "--", "cat", "/etc/redhat-release").Output() if err != nil { e2e.Logf("can not get content with error %v, and try next", err) continue } o.Expect(checkRel).To(o.ContainSubstring("Red Hat")) } } })
test case
openshift/openshift-tests-private
11b35d45-09c8-4dc8-901d-9d22c47e6125
NonHyperShiftHOST-Author:scolange-Medium-42041-Available=False despite unavailableReplicas <= maxUnavailable
['"encoding/json"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:scolange-Medium-42041-Available=False despite unavailableReplicas <= maxUnavailable", func() { exutil.By("get the cluster infrastructure") infra, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("infrastructures", "cluster", "-o=jsonpath={.status.infrastructureTopology}").Output() if err != nil { e2e.Failf("Fail to get the cluster infra") } if infra == "SingleReplica" { e2e.Logf("This is a SNO cluster") maxUnavailable, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.spec.strategy.rollingUpdate.maxUnavailable}").Output() e2e.Logf(maxUnavailable) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(maxUnavailable).NotTo(o.BeEmpty()) maxSurge, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.spec.strategy.rollingUpdate.maxSurge}").Output() e2e.Logf(maxSurge) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(maxSurge).NotTo(o.BeEmpty()) } else { maxUnavailableInCsv, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={..install.spec.deployments[0].spec.strategy.rollingUpdate.maxUnavailable}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(maxUnavailableInCsv).NotTo(o.BeEmpty()) maxSurgeInCsv, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={..install.spec.deployments[0].spec.strategy.rollingUpdate.maxSurge}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(maxSurgeInCsv).NotTo(o.BeEmpty()) _, err1 := oc.AsAdmin().WithoutNamespace().Run("patch").Args("csv", "packageserver", "-n", "openshift-operator-lifecycle-manager", "--type=json", "--patch", "[{\"op\": \"add\",\"path\": \"/spec/install/spec/deployments/0/spec/template/metadata/annotations\", \"value\": { \"custom.csv\": \"custom csv value\"} }]").Output() o.Expect(err1).NotTo(o.HaveOccurred()) maxUnavailable, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.spec.strategy.rollingUpdate.maxUnavailable}").Output() e2e.Logf(maxUnavailable) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(maxUnavailable).To(o.Equal(maxUnavailableInCsv)) maxSurge, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.spec.strategy.rollingUpdate.maxSurge}").Output() e2e.Logf(maxSurge) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(maxSurge).To(o.Equal(maxSurgeInCsv)) } })
test case
openshift/openshift-tests-private
9eabeac5-9d2d-44a1-81e4-c0437d7af88d
NonHyperShiftHOST-Author:scolange-Medium-42068-Available condition set to false on any Deployment spec change
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:scolange-Medium-42068-Available condition set to false on any Deployment spec change", func() { available, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("clusteroperator", "operator-lifecycle-manager-packageserver", "-o=jsonpath={.status.conditions[1].type}").Output() e2e.Logf(available) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(available).To(o.Equal("Available")) statusAvailable, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("clusteroperator", "operator-lifecycle-manager-packageserver", "-o=jsonpath={.status.conditions[1].status}").Output() e2e.Logf(statusAvailable) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(statusAvailable).To(o.Equal("True")) })
test case
openshift/openshift-tests-private
90a9297f-adfb-4b81-876c-89f8582f2fdc
NonHyperShiftHOST-Author:scolange-Medium-42069-component not found log should be debug level
['"context"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:scolange-Medium-42069-component not found log should be debug level", func() { var since = "--since=60s" var snooze time.Duration = 90 var tail = "--tail=10" oc.SetupProject() dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) buildPruningBaseDir := exutil.FixturePath("testdata", "olm") exutil.By("1) Install the OperatorGroup in a random project") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-42069", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("2) Install the learn-operator with Automatic approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-42069", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", ipApproval: "Automatic", channel: "beta", operatorPackage: "learn", singleNamespace: true, template: subTemplate, } sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) nameIP := sub.getIP(oc) deteleIP, err1 := oc.AsAdmin().WithoutNamespace().Run("delete").Args("installplan", nameIP, "-n", oc.Namespace()).Output() e2e.Logf(deteleIP) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(deteleIP).To(o.ContainSubstring("deleted")) catPodname, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "--selector=app=olm-operator", "-o=jsonpath={.items..metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(catPodname).NotTo(o.BeEmpty()) waitErr := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, snooze*time.Second, false, func(ctx context.Context) (bool, error) { msg, err := oc.AsAdmin().WithoutNamespace().Run("logs").Args(catPodname, "-n", "openshift-operator-lifecycle-manager", tail, since).Output() o.Expect(err).NotTo(o.HaveOccurred()) if strings.Contains(msg, "component not found") { return true, nil } return false, nil }) exutil.AssertWaitPollWithErr(waitErr, "log 'component not found' is not debug level") })
test case
openshift/openshift-tests-private
3a91dbd1-aa69-4e5e-bf3e-61f426677cb8
NonHyperShiftHOST-Author:scolange-Medium-42073-deployment sets neither CPU or memory request on the packageserver container
['"strings"', 'container "github.com/openshift/openshift-tests-private/test/extended/util/container"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:scolange-Medium-42073-deployment sets neither CPU or memory request on the packageserver container", func() { cpu, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={..containers..resources.requests.cpu}").Output() e2e.Logf(cpu) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(cpu).NotTo(o.Equal("")) memory, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={..containers..resources.requests.memory}").Output() e2e.Logf(memory) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(memory).NotTo(o.Equal("")) catPodnames, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "--selector=app=packageserver", "-o=jsonpath={.items..metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(catPodnames).NotTo(o.BeEmpty()) lines := strings.Split(catPodnames, " ") for _, line := range lines { e2e.Logf("line: %v", line) pkg1Cpu, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", line, "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.spec..resources.requests.cpu}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(pkg1Cpu).To(o.Equal(cpu)) pkg1Memory, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", line, "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.spec..resources.requests.memory}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(pkg1Memory).To(o.Equal(memory)) } })
test case
openshift/openshift-tests-private
61577653-70a8-440c-93e8-5c12d069b676
Author:tbuskey-Medium-23673-Installplan can be created while Install and uninstall operators via Marketplace for 5 times [Slow]
['"context"', '"fmt"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:tbuskey-Medium-23673-Installplan can be created while Install and uninstall operators via Marketplace for 5 times [Slow]", func() { var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") subFile = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") err error exists bool i int msgCsv string msgSub string s string waitErr error ) oc.SetupProject() var ( og = operatorGroupDescription{ name: "23673", namespace: oc.Namespace(), template: ogTemplate, } sub = subscriptionDescription{ subName: "sub-23673", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", ipApproval: "Automatic", channel: "beta", operatorPackage: "learn", singleNamespace: true, template: subFile, } ) dr := make(describerResrouce) dr.addIr(itName) exutil.By("1, check if this operator ready for installing") e2e.Logf("Check if %v exists in the %v catalog", sub.operatorPackage, sub.catalogSourceName) exists, err = clusterPackageExists(oc, sub) if !exists { g.Skip("learn operator does not exist") } o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("2, Create og") og.create(oc, itName, dr) exutil.By("3, Subscribe to operator prometheus") sub.create(oc, itName, dr) defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "AtLatestKnown", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.state}"}).check(oc) // grab the installedCSV and use as startingCSV finalCSV, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", "-n", oc.Namespace(), sub.subName, "-o", "jsonpath={.status.installedCSV}").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(finalCSV).NotTo(o.BeEmpty()) sub.startingCSV = finalCSV exutil.By("4 Unsubscribe to operator learn") sub.delete(itName, dr) sub.deleteCSV(itName, dr) msgSub, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", "-n", oc.Namespace()).Output() msgCsv, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace()).Output() if !strings.Contains(msgSub, "No resources found") && (!strings.Contains(msgCsv, "No resources found") || strings.Contains(msgCsv, finalCSV)) { e2e.Failf("Cycle #1 subscribe/unsubscribe failed %v:\n%v \n%v \n", err, msgSub, msgCsv) } exutil.By("5, subscribe/unsubscribe to operator learn 4 more times") for i = 2; i < 6; i++ { e2e.Logf("Cycle #%v starts", i) exutil.By("subscribe") sub.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", finalCSV, "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("unsubscribe") sub.delete(itName, dr) msgCsv, err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("csv", "-n", oc.Namespace(), sub.installedCSV).Output() // o.Expect(err).NotTo(o.HaveOccurred()) // sub.deleteCSV(itName, dr) // this doesn't seem to work for multiple cycles // Need to ensure its deleted before proceeding waitErr = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { msgSub, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", "-n", oc.Namespace()).Output() e2e.Logf("STEP %v sub msg: %v", i, msgSub) o.Expect(err).NotTo(o.HaveOccurred()) msgCsv, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace()).Output() e2e.Logf("STEP %v csv msg: %v", i, msgCsv) o.Expect(err).NotTo(o.HaveOccurred()) if strings.Contains(msgSub, "No resources found") && (strings.Contains(msgCsv, "No resources found") || !strings.Contains(msgCsv, finalCSV)) { return true, nil } return false, nil }) s = fmt.Sprintf("STEP error sub or csv not deleted on cycle #%v:\nsub %v\ncsv %v\n", i, msgSub, msgCsv) exutil.AssertWaitPollNoErr(waitErr, s) } exutil.By("6 FINISH") i-- e2e.Logf("Finished %v subscribe & unsubscribe cycles\n\n", i) })
test case
openshift/openshift-tests-private
362fe24e-c13c-45fe-bec8-c859b6b27361
Author:scolange-Medium-24586-Prevent Operator Conflicts in OperatorHub
['"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:scolange-Medium-24586-Prevent Operator Conflicts in OperatorHub", func() { var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") og = operatorGroupDescription{ name: "og-singlenamespace", namespace: oc.Namespace(), template: ogSingleTemplate, } sub1 = subscriptionDescription{ subName: "sub-24586-1", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", ipApproval: "Automatic", channel: "beta", operatorPackage: "learn", singleNamespace: true, template: subTemplate, } sub2 = subscriptionDescription{ subName: "sub-24586-2", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", ipApproval: "Automatic", channel: "beta", operatorPackage: "learn", singleNamespace: true, template: subTemplate, } ) dr := make(describerResrouce) dr.addIr(itName) exutil.By("Create og") og.create(oc, itName, dr) exutil.By("Create operator1") sub1.create(oc, itName, dr) newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", sub1.installedCSV, "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("Create operator2 which should fail") sub2.createWithoutCheck(oc, itName, dr) newCheck("expect", asUser, withNamespace, contain, "ConstraintsNotSatisfiable", ok, []string{"sub", sub2.subName, "-o=jsonpath={.status.conditions}"}).check(oc) })
test case
openshift/openshift-tests-private
68c3d7f8-f524-4b61-8b33-3e4f920297d8
Author:scolange-ConnectedOnly-NonHyperShiftHOST-Medium-40316-enters infinite loop if Pending CSV replaces itself [Serial]
['"context"', '"strconv"', '"encoding/json"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:scolange-ConnectedOnly-NonHyperShiftHOST-Medium-40316-enters infinite loop if Pending CSV replaces itself [Serial]", func() { var buildPruningBaseDir = exutil.FixturePath("testdata", "olm") var operatorGroup = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") var pkgServer = filepath.Join(buildPruningBaseDir, "packageserver.yaml") defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("ns", "test40316").Execute() exutil.By("create new namespace") var err = oc.AsAdmin().WithoutNamespace().Run("create").Args("ns", "test40316").Execute() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("create new OperatorGroup") ogFile, err := oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", operatorGroup, "-p", "NAME=test-operator", "NAMESPACE=test40316").OutputToFile("config-40316.json") o.Expect(err).NotTo(o.HaveOccurred()) err = oc.AsAdmin().WithoutNamespace().Run("create").Args("-f", ogFile).Execute() o.Expect(err).NotTo(o.HaveOccurred()) configFile, err := oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", pkgServer, "-p", "NAME=packageserver", "NAMESPACE=test40316").OutputToFile("config-40316.json") o.Expect(err).NotTo(o.HaveOccurred()) err = oc.AsAdmin().WithoutNamespace().Run("create").Args("-f", configFile).Execute() o.Expect(err).NotTo(o.HaveOccurred()) statusCsv, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", "test40316").Output() e2e.Logf("CSV prometheus %v", statusCsv) o.Expect(err).NotTo(o.HaveOccurred()) err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) { checkRel, _ := oc.AsAdmin().WithoutNamespace().Run("adm").Args("top", "pods", "-l", "app=olm-operator", "-n", "openshift-operator-lifecycle-manager", "--no-headers").Output() e2e.Logf("result: %v", checkRel) if !strings.Contains(checkRel, "olm-operator-") { e2e.Logf("get cpu usage failed: output is %s", checkRel) return false, nil } linesTop := strings.Split(checkRel, "\n") for _, lineTop := range linesTop { if strings.Contains(lineTop, "olm-operator-") { cpu := strings.Fields(lineTop)[1] e2e.Logf("cpu: %v", cpu) intcpu, _ := strconv.Atoi(strings.ReplaceAll(cpu, "m", "")) e2e.Logf("cpu: %v", intcpu) if intcpu <= 98 { return true, nil } } } e2e.Logf("get cpu usage failed: output is %s", checkRel) return false, nil }) exutil.AssertWaitPollNoErr(err, "get cpu usage failed") })
test case
openshift/openshift-tests-private
32268750-7e44-4717-8c94-e3e5f40965d9
ConnectedOnly-Author:xzha-Medium-24075-The packagemanifest labels provider value should be correct
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:xzha-Medium-24075-The packagemanifest labels provider value should be correct ", func() { provider, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "learn", "-o", "jsonpath={.status.provider.name}", "-n", "openshift-marketplace").Output() o.Expect(err).NotTo(o.HaveOccurred()) providerInLabels, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "learn", "-o", "jsonpath={.metadata.labels.provider}", "-n", "openshift-marketplace").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(provider).To(o.Equal(providerInLabels)) })
test case
openshift/openshift-tests-private
41e80564-60b4-49e5-8088-1ce3868d67e2
ConnectedOnly-Author:scolange-Medium-41283-Marketplace extract container request CPU or memory
['"context"', '"path/filepath"', '"time"', 'container "github.com/openshift/openshift-tests-private/test/extended/util/container"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:scolange-Medium-41283-Marketplace extract container request CPU or memory", func() { var buildPruningBaseDir = exutil.FixturePath("testdata", "olm") var subFile = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") var ogFile = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") var operatorWait = 150 * time.Second namespace := oc.Namespace() dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) og := operatorGroupDescription{ name: "test-operators-og", namespace: namespace, template: ogFile, } og.createwithCheck(oc, itName, dr) exutil.By("Verify inside the jobs the value of spec.containers[].resources.requests field are setted") sub := subscriptionDescription{ subName: "sub-41283", namespace: namespace, catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", ipApproval: "Automatic", channel: "beta", operatorPackage: "learn", singleNamespace: true, template: subFile, } defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) sub.create(oc, itName, dr) err := wait.PollUntilContextTimeout(context.TODO(), 60*time.Second, operatorWait, false, func(ctx context.Context) (bool, error) { checknameCsv, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("jobs", "-n", "openshift-marketplace", "-o", "jsonpath={.items[*].spec.template.spec.containers[*].resources.requests.cpu}").Output() o.Expect(err).NotTo(o.HaveOccurred()) e2e.Logf(checknameCsv) if checknameCsv == "" { e2e.Logf("jobs KO Limit not setted ") return false, nil } e2e.Logf("jobs OK Limit setted ") return true, nil }) exutil.AssertWaitPollNoErr(err, "jobs KO Limit not setted") })
test case
openshift/openshift-tests-private
d067c831-b591-43ed-8104-2bfbfcad1ed8
ConnectedOnly-Author:scolange-Medium-21534-Check OperatorGroups on console
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:scolange-Medium-21534-Check OperatorGroups on console", func() { ogNamespace, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("og", "global-operators", "-n", "openshift-operators", "-o", "jsonpath={.status.namespaces}").Output() e2e.Logf(ogNamespace) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(ogNamespace).To(o.Equal("[\"\"]")) })
test case
openshift/openshift-tests-private
d9da4ce5-10bf-49f2-806e-52e096c9a24d
Author:scolange-Medium-24587-Add InstallPlan conditions to Subscription status
['"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:scolange-Medium-24587-Add InstallPlan conditions to Subscription status", func() { var buildPruningBaseDir = exutil.FixturePath("testdata", "olm") var Sub = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") var og1 = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") oc.SetupProject() namespace := oc.Namespace() dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) og := operatorGroupDescription{ name: "og-24587", namespace: namespace, template: og1, } og.createwithCheck(oc, itName, dr) sub := subscriptionDescription{ subName: "sub-24587", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", ipApproval: "Manual", channel: "beta", operatorPackage: "learn", singleNamespace: true, template: Sub, } defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) sub.create(oc, itName, dr) // the InstallPlan should Manual on sub newCheck("expect", asAdmin, withoutNamespace, compare, "Manual", ok, []string{"sub", "-n", namespace, "-o=jsonpath={.items[*].spec.installPlanApproval}"}).check(oc) // the InstallPlan should Manual on ip newCheck("expect", asAdmin, withoutNamespace, compare, "Manual", ok, []string{"installplan", sub.getIP(oc), "-n", sub.namespace, "-o=jsonpath={.spec.approval}"}).check(oc) // the InstallPlan patched patchIP, err2 := oc.AsAdmin().WithoutNamespace().Run("patch").Args("installplan", sub.getIP(oc), "-n", namespace, "--type=merge", "-p", "{\"spec\":{\"approved\": true}}").Output() o.Expect(err2).NotTo(o.HaveOccurred()) o.Expect(patchIP).To(o.ContainSubstring("patched")) // the InstallPlan should be approved on sub newCheck("expect", asAdmin, withoutNamespace, compare, "AtLatestKnown", ok, []string{"sub", "-n", namespace, "-o=jsonpath={.items[*].status.state}"}).check(oc) // the delete InstallPlan deteleIP, err1 := oc.AsAdmin().WithoutNamespace().Run("delete").Args("installplan", sub.getIP(oc), "-n", namespace).Output() e2e.Logf(deteleIP) o.Expect(err1).NotTo(o.HaveOccurred()) o.Expect(deteleIP).To(o.ContainSubstring("deleted")) // the InstallPlan should InstallPlanMissing on sub newCheck("expect", asAdmin, withoutNamespace, contain, "InstallPlanMissing", ok, []string{"sub", "-n", namespace, "-o=jsonpath={.items[*].status.conditions[*].type}"}).check(oc) })
test case
openshift/openshift-tests-private
9d4e42fb-de14-4af2-a67d-e9c64ec3aa1a
ConnectedOnly-Author:scolange-Medium-41565-Resolution fails to sort channel if inner entry does not satisfy predicate
['"context"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:scolange-Medium-41565-Resolution fails to sort channel if inner entry does not satisfy predicate", func() { architecture.SkipNonAmd64SingleArch(oc) exutil.SkipIfDisableDefaultCatalogsource(oc) var buildPruningBaseDir = exutil.FixturePath("testdata", "olm") var Sub = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") var og1 = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") var catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml") oc.SetupProject() namespace := oc.Namespace() dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) catsrc := catalogSourceDescription{ name: "catsrc-41565-operator", namespace: namespace, displayName: "Test Catsrc 41565 Operators", publisher: "Red Hat", sourceType: "grpc", address: "quay.io/olmqe/ditto-index:41565-cache", template: catsrcImageTemplate, } exutil.By("Create catsrc") catsrc.createWithCheck(oc, itName, dr) exutil.By("Create og") og := operatorGroupDescription{ name: "test-operators-og", namespace: namespace, template: og1, } og.createwithCheck(oc, itName, dr) sub := subscriptionDescription{ subName: "sub-41565", namespace: namespace, catalogSourceName: catsrc.name, catalogSourceNamespace: catsrc.namespace, channel: "alpha", ipApproval: "Automatic", operatorPackage: "ditto-operator", singleNamespace: true, template: Sub, } sub.create(oc, itName, dr) e2e.Logf("Check operator") err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) { csv := getResource(oc, asAdmin, withoutNamespace, "csv", "-n", sub.namespace) if strings.Contains(csv, "ditto-operator") && strings.Contains(csv, "planetscale-operator") { return true, nil } return false, nil }) if err != nil { logDebugInfo(oc, sub.namespace, "pod", "ip", "csv", "events") } exutil.AssertWaitPollNoErr(err, "failed to create ditto operator") })
test case
openshift/openshift-tests-private
e377dc11-7a3e-42b0-b686-ded7422bd6c6
NonHyperShiftHOST-Author:xzha-Medium-25674-restart the marketplace-operator when the cluster is in bad state [Disruptive]
['"os/exec"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:xzha-Medium-25674-restart the marketplace-operator when the cluster is in bad state [Disruptive]", func() { exutil.SkipBaselineCaps(oc, "None") var buildPruningBaseDir = exutil.FixturePath("testdata", "olm") var Sub = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") var og1 = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") oc.SetupProject() namespace := oc.Namespace() dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) og := operatorGroupDescription{ name: "test-operators-og", namespace: namespace, template: og1, } og.createwithCheck(oc, itName, dr) sub := subscriptionDescription{ subName: "sub-25674", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", ipApproval: "Automatic", channel: "beta", operatorPackage: "learn", singleNamespace: true, template: Sub, } defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) sub.createWithoutCheck(oc, itName, dr) e2e.Logf("Check 1 first") newCheck("expect", asAdmin, withoutNamespace, compare, "", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.items[*].spec.name}"}).check(oc) exutil.By("delete pod of marketplace") output, err := doAction(oc, "delete", asAdmin, withoutNamespace, "pod", "--selector=name=marketplace-operator", "-n", "openshift-marketplace") o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(output).To(o.ContainSubstring("deleted")) exec.Command("bash", "-c", "sleep 10").Output() exutil.By("pod of marketplace restart") newCheck("expect", asAdmin, withoutNamespace, compare, "TrueFalseFalse", ok, []string{"clusteroperator", "marketplace", "-o=jsonpath={.status.conditions[?(@.type==\"Available\")].status}{.status.conditions[?(@.type==\"Progressing\")].status}{.status.conditions[?(@.type==\"Degraded\")].status}"}).check(oc) })
test case
openshift/openshift-tests-private
dc6d47a8-e907-41fd-a015-6e8952cb7a31
NonHyperShiftHOST-ConnectedOnly-Author:scolange-Medium-23395-Deleted catalog registry pods and verify if them are recreated automatically [Disruptive]
['"context"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-ConnectedOnly-Author:scolange-Medium-23395-Deleted catalog registry pods and verify if them are recreated automatically [Disruptive]", func() { exutil.SkipBaselineCaps(oc, "None") exutil.SkipIfDisableDefaultCatalogsource(oc) exutil.By("get pod of marketplace") podName := getResource(oc, asAdmin, withoutNamespace, "pod", "--selector=olm.catalogSource=redhat-operators", "-n", "openshift-marketplace", "-o=jsonpath={...metadata.name}") o.Expect(podName).NotTo(o.BeEmpty()) exutil.By("delete pod of marketplace") _, err := doAction(oc, "delete", asAdmin, withoutNamespace, "pod", podName, "-n", "openshift-marketplace") o.Expect(err).NotTo(o.HaveOccurred()) err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { res, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "--selector=olm.catalogSource=redhat-operators", "-o=jsonpath={.items..status.phase}", "-n", "openshift-marketplace").Output() if strings.Contains(res, "Running") { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "fails to get pod of redhat-operators") })
test case
openshift/openshift-tests-private
3b4f61f2-7611-40bd-93f3-3f495f459939
Author:scolange-Medium-43057-Enable continuous heap profiling by default
['"fmt"', '"os/exec"', '"encoding/json"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:scolange-Medium-43057-Enable continuous heap profiling by default", func() { exutil.By("get pod of marketplace") configMaps := getResource(oc, asAdmin, withoutNamespace, "configmaps", "-l olm.openshift.io/pprof", "-n", "openshift-operator-lifecycle-manager") o.Expect(configMaps).NotTo(o.BeEmpty()) e2e.Logf(configMaps) linesconfigMaps := strings.Split(configMaps, "\n") for i := 1; i < len(linesconfigMaps); i++ { e2e.Logf("i: %v", i) configMap := strings.Split(linesconfigMaps[i], " ") e2e.Logf("configMap: %v", configMap[0]) binaryConfigMap, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("configmaps", configMap[0], "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.binaryData.*}").OutputToFile("config-43057.json") o.Expect(err).NotTo(o.HaveOccurred()) e2e.Logf("binaryConfigMap: %v", binaryConfigMap) resultBase64, err := exec.Command("bash", "-c", fmt.Sprintf("cat %s | base64 -d", binaryConfigMap)).Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(resultBase64).NotTo(o.BeEmpty()) } })
test case
openshift/openshift-tests-private
7174f533-785e-40f6-b6f3-a7145f050b58
Author:jiazha-Medium-21126-OLM Subscription status says CSV is installed when it is not
['"path/filepath"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:jiazha-Medium-21126-OLM Subscription status says CSV is installed when it is not", func() { exutil.By("1) Install the OperatorGroup in a random project") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) oc.SetupProject() buildPruningBaseDir := exutil.FixturePath("testdata", "olm") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-21126", namespace: oc.Namespace(), template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("2) Install learn-operator.v0.0.3 with Manual approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-21126", namespace: oc.Namespace(), catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Manual", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } defer sub.delete(itName, dr) sub.create(oc, itName, dr) exutil.By("3) Check the learn-operator.v0.0.3 related resources") // the installedCSV should be NULL newCheck("expect", asAdmin, withoutNamespace, compare, "", ok, []string{"sub", "sub-21126", "-n", oc.Namespace(), "-o=jsonpath={.status.installedCSV}"}).check(oc) // the state should be UpgradePending newCheck("expect", asAdmin, withoutNamespace, compare, "UpgradePending", ok, []string{"sub", "sub-21126", "-n", oc.Namespace(), "-o=jsonpath={.status.state}"}).check(oc) // the InstallPlan should not approved newCheck("expect", asAdmin, withoutNamespace, compare, "false", ok, []string{"installplan", sub.getIP(oc), "-n", oc.Namespace(), "-o=jsonpath={.spec.approved}"}).check(oc) // should no etcdoperator.v0.9.4 CSV found msg, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "learn-operator.v0.0.3", "-n", oc.Namespace()).Output() if !strings.Contains(msg, "not found") { e2e.Failf("still found the learn-operator.v0.0.3 in namespace:%s, msg:%v", oc.Namespace(), msg) } })
test case
openshift/openshift-tests-private
2aa46983-53c8-438b-89de-681b8bdac58a
NonPreRelease-PreChkUpgrade-Author:xzha-High-22615-prepare to check the OLM status
['"context"', '"fmt"', '"encoding/json"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonPreRelease-PreChkUpgrade-Author:xzha-High-22615-prepare to check the OLM status", func() { exutil.By("cover OCPBUGS-23538 to check the ConfigMap if labeled with the olm.managed=true") configMaps, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cm", "-n", "openshift-marketplace", "--no-headers").Output() o.Expect(err).NotTo(o.HaveOccurred()) lines := strings.Split(configMaps, "\n") for _, line := range lines { configMap := strings.Fields(line)[0] kind, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cm", "-n", "openshift-marketplace", configMap, "-o=jsonpath={.metadata.ownerReferences[0].kind}").Output() o.Expect(err).NotTo(o.HaveOccurred()) if kind != "CatalogSource" { continue } managed, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cm", "-n", "openshift-marketplace", configMap, `-o=jsonpath={.metadata.labels.olm\.managed}`).Output() o.Expect(err).NotTo(o.HaveOccurred()) if managed != "true" { e2e.Failf("the configMap(%s) doesn't managed by OLM", configMap) } } exutil.By("1) check version of the OLM related resource") olmRelatedResource := []string{"operator-lifecycle-manager", "operator-lifecycle-manager-catalog", "operator-lifecycle-manager-packageserver"} clusterversion := getResource(oc, asAdmin, withoutNamespace, "clusterversion", "version", "-o=jsonpath={.status.desired.version}") for _, resource := range olmRelatedResource { version := getResource(oc, asAdmin, withoutNamespace, "clusteroperator", resource, "-o=jsonpath={.status.versions[?(@.name==\"operator\")].version}") o.Expect(version).NotTo(o.BeEmpty()) o.Expect(clusterversion).To(o.Equal(version)) } exutil.By("2) subscribe to an operator: learn-operator, the multi-arch one") dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) // Create a project here so that it can be keeped after this prepare case done. _, err = oc.AsAdmin().WithoutNamespace().Run("new-project").Args("olm-upgrade-22615").Output() if err != nil { e2e.Failf("Fail to create project, error:%v", err) } buildPruningBaseDir := exutil.FixturePath("testdata", "olm") ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og := operatorGroupDescription{ name: "og-22615", namespace: "olm-upgrade-22615", template: ogSingleTemplate, } og.createwithCheck(oc, itName, dr) exutil.By("2-1) subscribe to the learn-operator v0.0.3 with Automatic approval") subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") sub := subscriptionDescription{ subName: "sub-22615", namespace: "olm-upgrade-22615", catalogSourceName: "qe-app-registry", catalogSourceNamespace: "openshift-marketplace", channel: "beta", ipApproval: "Automatic", operatorPackage: "learn", startingCSV: "learn-operator.v0.0.3", singleNamespace: true, template: subTemplate, } // keep the resource so that checking it after upgrading // defer sub.delete(itName, dr) sub.createWithoutCheck(oc, itName, dr) err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) { state := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.state}") if strings.Compare(state, "AtLatestKnown") == 0 { return true, nil } e2e.Logf("sub %s state is %s, not AtLatestKnown", sub.subName, state) return false, nil }) if err != nil { getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath-as-json={.status}") getResource(oc, asAdmin, withoutNamespace, "pod", "-n", sub.catalogSourceNamespace) logDebugInfo(oc, sub.namespace, "pod", "ip", "csv", "events") } exutil.AssertWaitPollNoErr(err, fmt.Sprintf("sub %s stat is not AtLatestKnown", sub.subName)) // keep the resource so that checking it after upgrading // defer sub.deleteCSV(itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.3", "-n", "olm-upgrade-22615", "-o=jsonpath={.status.phase}"}).check(oc) // This step cover a upgrade bug: https://bugzilla.redhat.com/show_bug.cgi?id=2015950 exutil.By("3) Create 300 secret in openshift-operator-lifecycle-manager project") for i := 1; i <= 300; i++ { logs, err := oc.AsAdmin().WithoutNamespace().Run("create").Args("secret", "generic", fmt.Sprintf("test%d", i), "-n", "openshift-operator-lifecycle-manager").Output() if err != nil && !strings.Contains(logs, "already exists") { e2e.Failf("Fail to create secret: %s, error:%v", fmt.Sprintf("test%d", i), err) } } exutil.By("4) check status of OLM cluster operators") for _, resource := range olmRelatedResource { newCheck("expect", asAdmin, withoutNamespace, compare, "TrueFalseFalse", ok, []string{"clusteroperator", resource, "-o=jsonpath={.status.conditions[?(@.type==\"Available\")].status}{.status.conditions[?(@.type==\"Progressing\")].status}{.status.conditions[?(@.type==\"Degraded\")].status}"}).check(oc) upgradeableStatus := getResource(oc, asAdmin, withoutNamespace, "clusteroperator", resource, "-o=jsonpath={.status.conditions[?(@.type==\"Upgradeable\")].status}") if strings.Compare(upgradeableStatus, "True") != 0 { getResource(oc, asAdmin, withoutNamespace, "clusteroperator", resource, "-o=jsonpath-as-json={.status.conditions}") o.Expect(upgradeableStatus).To(o.Equal("True")) } } })
test case
openshift/openshift-tests-private
4c74d995-3a8b-4528-a984-1e7a40c40310
NonPreRelease-PstChkUpgrade-Author:xzha-High-22615-Post check the OLM status
['"fmt"', '"github.com/tidwall/gjson"', '"github.com/blang/semver"', '"encoding/json"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonPreRelease-PstChkUpgrade-Author:xzha-High-22615-Post check the OLM status", func() { exutil.By("1) check version of the OLM related resource") olmRelatedResource := []string{"operator-lifecycle-manager", "operator-lifecycle-manager-catalog", "operator-lifecycle-manager-packageserver"} clusterversion := getResource(oc, asAdmin, withoutNamespace, "clusterversion", "version", "-o=jsonpath={.status.desired.version}") for _, resource := range olmRelatedResource { version := getResource(oc, asAdmin, withoutNamespace, "clusteroperator", resource, "-o=jsonpath={.status.versions[?(@.name==\"operator\")].version}") o.Expect(version).NotTo(o.BeEmpty()) o.Expect(clusterversion).To(o.Equal(version)) } exutil.By("2) check status of OLM cluster operators") e2e.Logf("check csv maxOpenShiftVersion") upgradeableExpect := "True" clusterversionSemver, err := semver.Make(clusterversion) o.Expect(err).NotTo(o.HaveOccurred()) csvList := getAllCSV(oc) for _, csvIndex := range csvList { nsName := strings.Split(csvIndex, ":")[0] csvName := strings.Split(csvIndex, ":")[1] properties := getResource(oc, asAdmin, withoutNamespace, "csv", csvName, "-n", nsName, `-o=jsonpath={.metadata.annotations.operatorframework\.io/properties}`) if strings.Contains(properties, "olm.maxOpenShiftVersion") { maxOpenShiftVersion := gjson.Get(properties, `properties.#(type%"*maxOpenShiftVersion*").value`).String() e2e.Logf("%s: %s, maxOpenShiftVersion: %s", nsName, csvName, maxOpenShiftVersion) if len(strings.Split(maxOpenShiftVersion, ".")) < 3 { maxOpenShiftVersion = maxOpenShiftVersion + ".0" } maxOpenShiftVersionSemver, err := semver.Make(maxOpenShiftVersion) o.Expect(err).NotTo(o.HaveOccurred()) if clusterversionSemver.GTE(maxOpenShiftVersionSemver) { e2e.Logf("clusterversion %s is greater than maxOpenShiftVersion %s", clusterversion, maxOpenShiftVersion) upgradeableExpect = "False" break } } } e2e.Logf("upgradeableExpect is %s", upgradeableExpect) upgradeableStatus := getResource(oc, asAdmin, withoutNamespace, "clusteroperator", "operator-lifecycle-manager", "-o=jsonpath={.status.conditions[?(@.type==\"Upgradeable\")].status}") if strings.Compare(upgradeableStatus, upgradeableExpect) != 0 { getResource(oc, asAdmin, withoutNamespace, "clusteroperator", "operator-lifecycle-manager", "-o=jsonpath-as-json={.status.conditions}") o.Expect(upgradeableStatus).To(o.Equal(upgradeableExpect)) } for _, resource := range olmRelatedResource { newCheck("expect", asAdmin, withoutNamespace, compare, "TrueFalseFalse", ok, []string{"clusteroperator", resource, "-o=jsonpath={.status.conditions[?(@.type==\"Available\")].status}{.status.conditions[?(@.type==\"Progressing\")].status}{.status.conditions[?(@.type==\"Degraded\")].status}"}).check(oc) if strings.Compare(resource, "operator-lifecycle-manager") != 0 { upgradeableStatus := getResource(oc, asAdmin, withoutNamespace, "clusteroperator", resource, "-o=jsonpath={.status.conditions[?(@.type==\"Upgradeable\")].status}") if strings.Compare(upgradeableStatus, "True") != 0 { getResource(oc, asAdmin, withoutNamespace, "clusteroperator", resource, "-o=jsonpath-as-json={.status.conditions}") o.Expect(upgradeableStatus).To(o.Equal("True")) } } } exutil.By("3) Check the installed operator status") newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.3", "-n", "olm-upgrade-22615", "-o=jsonpath={.status.phase}"}).check(oc) _, err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("project", "olm-upgrade-22615").Output() if err != nil { e2e.Failf("Fail to delete project, error:%v", err) } exutil.By("4) Remove those 300 secrets in openshift-operator-lifecycle-manager project") for i := 1; i <= 300; i++ { _, err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("secret", fmt.Sprintf("test%d", i), "-n", "openshift-operator-lifecycle-manager").Output() if err != nil { e2e.Failf("Fail to delete secret %s, error:%v", fmt.Sprintf("test%d", i), err) } } })
test case
openshift/openshift-tests-private
48b9568a-5ecf-4277-a07c-4d87741fe939
NonHyperShiftHOST-NonPreRelease-PreChkUpgrade-Author:xzha-High-22618-prepare to check the marketplace status
['"context"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-NonPreRelease-PreChkUpgrade-Author:xzha-High-22618-prepare to check the marketplace status", func() { exutil.SkipBaselineCaps(oc, "None") exutil.By("1) check version of marketplace operator") marketplaceVersion := getResource(oc, asAdmin, withoutNamespace, "clusteroperator", "marketplace", "-o=jsonpath={.status.versions[?(@.name==\"operator\")].version}") o.Expect(marketplaceVersion).NotTo(o.BeEmpty()) clusterversion := getResource(oc, asAdmin, withoutNamespace, "clusterversion", "version", "-o=jsonpath={.status.desired.version}") o.Expect(clusterversion).To(o.Equal(marketplaceVersion)) exutil.By("2) check status of marketplace operator") newCheck("expect", asAdmin, withoutNamespace, compare, "TrueFalseFalse", ok, []string{"clusteroperator", "marketplace", "-o=jsonpath={.status.conditions[?(@.type==\"Available\")].status}{.status.conditions[?(@.type==\"Progressing\")].status}{.status.conditions[?(@.type==\"Degraded\")].status}"}).check(oc) upgradeableStatus := getResource(oc, asAdmin, withoutNamespace, "clusteroperator", "marketplace", "-o=jsonpath={.status.conditions[?(@.type==\"Upgradeable\")].status}") o.Expect(upgradeableStatus).To(o.Equal("True")) exutil.By("3) check status of marketplace operator") err := wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) { catsrcS := getResource(oc, asAdmin, withoutNamespace, "catsrc", "-n", "openshift-marketplace", "-o=jsonpath={..metadata.name}") packages := getResource(oc, asAdmin, withoutNamespace, "packagemanifests", "-n", "openshift-marketplace") if catsrcS == "" || packages == "" { e2e.Logf("get catsrc or packagemanifests failed") return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "check packagemanifests failed") exutil.By("4) upgrade prepare 22618 SUCCESS") })
test case
openshift/openshift-tests-private
f668b9fd-dcd4-4e3f-8d36-6b03ceef2f66
ConnectedOnly-NonPreRelease-PreChkUpgrade-Author:xzha-High-22618-prepare to check the catalogsource status of catalogsource
['"context"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-NonPreRelease-PreChkUpgrade-Author:xzha-High-22618-prepare to check the catalogsource status of catalogsource", func() { exutil.SkipBaselineCaps(oc, "None") exutil.SkipIfDisableDefaultCatalogsource(oc) exutil.By("1) Create a CatalogSource in the openshift-marketplace project") buildPruningBaseDir := exutil.FixturePath("testdata", "olm") csImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") // Create a project here so that it can be keeped after this prepare case done. ns := "olm-upgrade-22618" _, err := oc.AsAdmin().WithoutNamespace().Run("create").Args("ns", ns).Output() if err != nil { e2e.Failf("Fail to create project, error:%v", err) } cs := catalogSourceDescription{ name: "cs-22618", namespace: ns, displayName: "22618 Operators", publisher: "OLM QE", sourceType: "grpc", address: "quay.io/olmqe/nginxolm-operator-index:v1", template: csImageTemplate, } dr := make(describerResrouce) itName := g.CurrentSpecReport().FullText() dr.addIr(itName) cs.createWithCheck(oc, itName, dr) exutil.By("2) check status of marketplace operator") catalogstrings := map[string]string{"certified-operators": "Certified Operators", "community-operators": "Community Operators", "redhat-operators": "Red Hat Operators", "redhat-marketplace": "Red Hat Marketplace"} err = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) { catsrcS, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catsrc", "-n", "openshift-marketplace", "-o=jsonpath={..metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) if catsrcS == "" { e2e.Logf("get catsrc failed") return false, nil } for catsrcIndex := range catalogstrings { if !strings.Contains(catsrcS, catsrcIndex) { e2e.Logf("cannot get catsrc for %s", catsrcIndex) return false, nil } } packages, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifests", "-A").Output() o.Expect(err).NotTo(o.HaveOccurred()) if packages == "" { e2e.Logf("get catsrc or packagemanifests failed") return false, nil } for catsrcIndex := range catalogstrings { if !strings.Contains(packages, catalogstrings[catsrcIndex]) { e2e.Logf("cannot get packagemanifests for %s", catsrcIndex) return false, nil } } if !strings.Contains(packages, cs.displayName) { e2e.Logf("cannot get packagemanifests for %s", cs.name) return false, nil } return true, nil }) if err != nil { getResource(oc, asAdmin, withoutNamespace, "catsrc", "-n", "openshift-marketplace") getResource(oc, asAdmin, withoutNamespace, "pod", "-n", "openshift-marketplace") getResource(oc, asAdmin, withoutNamespace, "catsrc", "-n", ns) getResource(oc, asAdmin, withoutNamespace, "pod", "-n", ns) } exutil.AssertWaitPollNoErr(err, "check packagemanifests failed") exutil.By("3) upgrade prepare 22618 SUCCESS") })
test case
openshift/openshift-tests-private
8fbfdcea-8ed1-47f0-969d-4e7ddc3e94f7
NonHyperShiftHOST-NonPreRelease-PstChkUpgrade-Author:xzha-High-22618-Post check the marketplace status
['"context"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-NonPreRelease-PstChkUpgrade-Author:xzha-High-22618-Post check the marketplace status", func() { exutil.SkipBaselineCaps(oc, "None") exutil.By("1) check version of marketplace operator") marketplaceVersion := getResource(oc, asAdmin, withoutNamespace, "clusteroperator", "marketplace", "-o=jsonpath={.status.versions[?(@.name==\"operator\")].version}") o.Expect(marketplaceVersion).NotTo(o.BeEmpty()) clusterversion := getResource(oc, asAdmin, withoutNamespace, "clusterversion", "version", "-o=jsonpath={.status.desired.version}") o.Expect(clusterversion).To(o.Equal(marketplaceVersion)) exutil.By("2) check status of marketplace operator") newCheck("expect", asAdmin, withoutNamespace, compare, "TrueFalseFalse", ok, []string{"clusteroperator", "marketplace", "-o=jsonpath={.status.conditions[?(@.type==\"Available\")].status}{.status.conditions[?(@.type==\"Progressing\")].status}{.status.conditions[?(@.type==\"Degraded\")].status}"}).check(oc) upgradeableStatus := getResource(oc, asAdmin, withoutNamespace, "clusteroperator", "marketplace", "-o=jsonpath={.status.conditions[?(@.type==\"Upgradeable\")].status}") o.Expect(upgradeableStatus).To(o.Equal("True")) exutil.By("3) check status of marketplace operator") err := wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) { catsrcS := getResource(oc, asAdmin, withoutNamespace, "catsrc", "-n", "openshift-marketplace", "-o=jsonpath={..metadata.name}") packages := getResource(oc, asAdmin, withoutNamespace, "packagemanifests", "-n", "openshift-marketplace") if catsrcS == "" || packages == "" { e2e.Logf("get catsrc or packagemanifests failed") return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "check packagemanifests failed") exutil.By("4) post check upgrade 22618 SUCCESS") })
test case
openshift/openshift-tests-private
b0483f65-a72a-4dd9-8216-83320467054c
ConnectedOnly-NonPreRelease-PstChkUpgrade-Author:xzha-High-22618-Post check the catalogsource status of catalogsource
['"context"', '"encoding/json"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-NonPreRelease-PstChkUpgrade-Author:xzha-High-22618-Post check the catalogsource status of catalogsource", func() { exutil.SkipBaselineCaps(oc, "None") exutil.SkipIfDisableDefaultCatalogsource(oc) ns := "olm-upgrade-22618" defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("ns", ns).Output() exutil.By("0) update catsrc cs-22618 ") err := oc.AsAdmin().WithoutNamespace().Run("patch").Args("catsrc", "cs-22618", "-n", ns, "--type=merge", "-p", `{"spec":{"grpcPodConfig":{"securityContextConfig":"restricted"}}}`).Execute() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("1) check status of marketplace operator") catalogstrings := map[string]string{"certified-operators": "Certified Operators", "community-operators": "Community Operators", "redhat-operators": "Red Hat Operators", "redhat-marketplace": "Red Hat Marketplace", "cs-22618": "22618 Operators"} err = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) { catsrcS, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("catsrc", "-A").Output() if catsrcS == "" { e2e.Logf("get catsrc failed") return false, nil } for catsrcIndex := range catalogstrings { if !strings.Contains(catsrcS, catsrcIndex) { e2e.Logf("cannot get catsrc for %s", catsrcIndex) return false, nil } } packages, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifests", "-A").Output() if packages == "" { e2e.Logf("get catsrc or packagemanifests failed") return false, nil } for catsrcIndex := range catalogstrings { if !strings.Contains(packages, catalogstrings[catsrcIndex]) { e2e.Logf("cannot get packagemanifests for %s", catsrcIndex) return false, nil } } return true, nil }) if err != nil { getResource(oc, asAdmin, withoutNamespace, "catsrc", "certified-operators", "-n", "openshift-marketplace", "-o=jsonpath-as-json={.status}") getResource(oc, asAdmin, withoutNamespace, "catsrc", "community-operators", "-n", "openshift-marketplace", "-o=jsonpath-as-json={.status}") getResource(oc, asAdmin, withoutNamespace, "catsrc", "redhat-operators", "-n", "openshift-marketplace", "-o=jsonpath-as-json={.status}") getResource(oc, asAdmin, withoutNamespace, "catsrc", "redhat-marketplace", "-n", "openshift-marketplace", "-o=jsonpath-as-json={.status}") getResource(oc, asAdmin, withoutNamespace, "catsrc", "cs-22618", "-n", ns, "-o=jsonpath-as-json={.status}") getResource(oc, asAdmin, withoutNamespace, "pod", "-n", "openshift-marketplace") getResource(oc, asAdmin, withoutNamespace, "catsrc", "-n", ns) getResource(oc, asAdmin, withoutNamespace, "pod", "-n", ns) } exutil.AssertWaitPollNoErr(err, "check packagemanifests failed") exutil.By("2) delete catsrc cs-22618") _, err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("catsrc", "cs-22618", "-n", ns).Output() o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("3) 22618 Post check SUCCESS") })
test case
openshift/openshift-tests-private
34d72e1e-631d-423e-aeda-86e8d13da42e
Author:xzha-NonHyperShiftHOST-Longduration-NonPreRelease-Medium-43975-olm operator serviceaccount should not rely on external networking for health check[Disruptive][Slow]
['"context"', '"fmt"', '"os/exec"', '"regexp"', '"strconv"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:xzha-NonHyperShiftHOST-Longduration-NonPreRelease-Medium-43975-olm operator serviceaccount should not rely on external networking for health check[Disruptive][Slow]", func() { exutil.By("1) get the cluster infrastructure") infra, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("infrastructures", "cluster", "-o=jsonpath={.status.infrastructureTopology}").Output() if err != nil { e2e.Failf("Fail to get the cluster infra") } if infra == "SingleReplica" { originProfile := getResource(oc, asAdmin, withoutNamespace, "apiserver", "cluster", "-o=jsonpath={.spec.audit.profile}") o.Expect(originProfile).NotTo(o.BeEmpty()) if strings.Compare(originProfile, "Default") == 0 { exutil.By("2) get revision number") revisionNumber1 := 0 reg := regexp.MustCompile(`nodes are at revision (\d+)`) if reg == nil { e2e.Failf("get revision number regexp err!") } output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("kubeapiserver", "-o=jsonpath={..status.conditions[?(@.type==\"NodeInstallerProgressing\")]}").Output() if err != nil { e2e.Failf("Fail to get kubeapiserver") } result := reg.FindAllStringSubmatch(output, -1) if result != nil { revisionNumberStr1 := result[0][1] revisionNumber1, _ = strconv.Atoi(revisionNumberStr1) e2e.Logf("origin revision number is : %v", revisionNumber1) } else { e2e.Failf("Fail to get revision number") } exutil.By("3) Configuring the audit log policy to AllRequestBodies") defer func() { pathJSON := fmt.Sprintf("{\"spec\":{\"audit\":{\"profile\":\"%s\"}}}", originProfile) e2e.Logf("recover to be %v", pathJSON) patchResource(oc, asAdmin, withoutNamespace, "apiserver", "cluster", "-p", pathJSON, "--type=merge") output = getResource(oc, asAdmin, withoutNamespace, "apiserver", "cluster", "-o=jsonpath={.spec.audit.profile}") o.Expect(output).To(o.Equal("Default")) }() patchResource(oc, asAdmin, withoutNamespace, "apiserver", "cluster", "-p", "{\"spec\":{\"audit\":{\"profile\":\"AllRequestBodies\"}}}", "--type=merge") output = getResource(oc, asAdmin, withoutNamespace, "apiserver", "cluster", "-o=jsonpath={.spec.audit.profile}") o.Expect(output).To(o.Equal("AllRequestBodies")) exutil.By("4) Wait for api rollout") err = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 600*time.Second, false, func(ctx context.Context) (bool, error) { output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("kubeapiserver", "-o=jsonpath={..status.conditions[?(@.type==\"NodeInstallerProgressing\")]}").Output() e2e.Logf(output) if err != nil { e2e.Logf("Fail to get kubeapiserver status, go next round") return false, nil } if !strings.Contains(output, "AllNodesAtLatestRevision") { e2e.Logf("the api is rolling, go next round") return false, nil } result := reg.FindAllStringSubmatch(output, -1) if result != nil { revisionNumberStr2 := result[0][1] revisionNumber2, _ := strconv.Atoi(revisionNumberStr2) e2e.Logf("revision number is : %v", revisionNumber2) if revisionNumber2 > revisionNumber1 { return true, nil } e2e.Logf("revision number is not changed, go next round") return false, nil } e2e.Logf("Fail to get revision number, go next round") return false, nil }) exutil.AssertWaitPollNoErr(err, "api not rollout") // According to the case steps, wait for 5 minutes, then check the audit log doesn't contain olm-operator-serviceaccount. exutil.By("Wait for 5 minutes, then check the audit log") time.Sleep(5 * time.Minute) } exutil.By("check the audit log") nodeName, err := exutil.GetFirstMasterNode(oc) e2e.Logf(nodeName) o.Expect(err).NotTo(o.HaveOccurred()) auditlogPath := "43975.log" defer exec.Command("bash", "-c", "rm -fr "+auditlogPath).Output() outputPath, err := oc.AsAdmin().WithoutNamespace().Run("adm").Args("node-logs", nodeName, "--path=kube-apiserver/audit.log").OutputToFile(auditlogPath) o.Expect(err).NotTo(o.HaveOccurred()) commandParserLog := "cat " + outputPath + " |grep -i health | grep -i subjectaccessreviews | grep -v Unhealth | jq . -C | less -r | grep 'username' | sort | uniq" resultParserLog, err := exec.Command("bash", "-c", commandParserLog).Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(resultParserLog).NotTo(o.ContainSubstring("olm-operator-serviceaccount")) } else { g.Skip("Not SNO cluster - skipping test ...") } })
test case
openshift/openshift-tests-private
ae5c473e-843c-437a-b83e-79d3495dd408
ConnectedOnly-Author:kuiwang-Low-73695-PO is disable
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:kuiwang-Low-73695-PO is disable", func() { if !exutil.IsTechPreviewNoUpgrade(oc) { g.Skip("PO is supported in TP only currently, so skip it") } _, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("co", "platform-operators-aggregated").Output() o.Expect(err).To(o.HaveOccurred(), "PO is not disable") })
test case
openshift/openshift-tests-private
6b4ca83f-219f-476e-877c-99de87111bbf
Author:tbuskey-Low-24058-components should have resource limits defined
['"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:tbuskey-Low-24058-components should have resource limits defined", func() { olmUnlimited := 0 olmNames := []string{""} olmNamespace := "openshift-operator-lifecycle-manager" olmJpath := "-o=jsonpath={range .items[*]}{@.metadata.name}{','}{@.spec.containers[0].resources.requests.*}{'\\n'}" msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", olmNamespace, olmJpath).Output() if err != nil { e2e.Failf("Unable to get pod -n %v %v.", olmNamespace, olmJpath) } o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(msg).NotTo(o.ContainSubstring("No resources found")) lines := strings.Split(msg, "\n") for _, line := range lines { name := strings.Split(line, ",") // e2e.Logf("Line is %v, len %v, len name %v, name0 %v, name1 %v\n", line, len(line), len(name), name[0], name[1]) if strings.Contains(line, "packageserver") { continue } else { if len(line) > 1 { if len(name) > 1 && len(name[1]) < 1 { olmUnlimited++ olmNames = append(olmNames, name[0]) } } } } if olmUnlimited > 0 && len(olmNames) > 0 { e2e.Failf("There are no limits set on %v of %v OLM components: %v", olmUnlimited, len(lines), olmNames) } })
test case
openshift/openshift-tests-private
bf3c5c2f-28cf-4980-8b58-72a3ee935aba
NonHyperShiftHOST-Author:kuiwang-Medium-22259-marketplace operator CR status on a running cluster [Exclusive]
['"os/exec"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:kuiwang-Medium-22259-marketplace operator CR status on a running cluster [Exclusive]", func() { exutil.SkipForSNOCluster(oc) exutil.SkipNoCapabilities(oc, "marketplace") exutil.By("check marketplace status") newCheck("expect", asAdmin, withoutNamespace, compare, "TrueFalseFalse", ok, []string{"clusteroperator", "marketplace", "-o=jsonpath={.status.conditions[?(@.type==\"Available\")].status}{.status.conditions[?(@.type==\"Progressing\")].status}{.status.conditions[?(@.type==\"Degraded\")].status}"}).check(oc) exutil.By("get pod of marketplace") podName := getResource(oc, asAdmin, withoutNamespace, "pod", "--selector=name=marketplace-operator", "-n", "openshift-marketplace", "-o=jsonpath={...metadata.name}") o.Expect(podName).NotTo(o.BeEmpty()) exutil.By("delete pod of marketplace") _, err := doAction(oc, "delete", asAdmin, withoutNamespace, "pod", podName, "-n", "openshift-marketplace") o.Expect(err).NotTo(o.HaveOccurred()) exec.Command("bash", "-c", "sleep 10").Output() exutil.By("pod of marketplace restart") newCheck("expect", asAdmin, withoutNamespace, compare, "TrueFalseFalse", ok, []string{"clusteroperator", "marketplace", "-o=jsonpath={.status.conditions[?(@.type==\"Available\")].status}{.status.conditions[?(@.type==\"Progressing\")].status}{.status.conditions[?(@.type==\"Degraded\")].status}"}).check(oc) })
test case
openshift/openshift-tests-private
eb76ab14-c9ca-4966-be5f-e1cf8d568e2f
Author:kuiwang-NonHyperShiftHOST-ROSA-OSD_CCS-ARO-ProdrunBoth-Medium-24076-check the version of olm operator is appropriate in ClusterOperator
['"fmt"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:kuiwang-NonHyperShiftHOST-ROSA-OSD_CCS-ARO-ProdrunBoth-Medium-24076-check the version of olm operator is appropriate in ClusterOperator", func() { var ( olmClusterOperatorName = "operator-lifecycle-manager" ) exutil.By("get the version of olm operator") olmVersion := getResource(oc, asAdmin, withoutNamespace, "clusteroperator", olmClusterOperatorName, "-o=jsonpath={.status.versions[?(@.name==\"operator\")].version}") o.Expect(olmVersion).NotTo(o.BeEmpty()) exutil.By("Check if it is appropriate in ClusterOperator") newCheck("expect", asAdmin, withoutNamespace, compare, olmVersion, ok, []string{"clusteroperator", fmt.Sprintf("-o=jsonpath={.items[?(@.metadata.name==\"%s\")].status.versions[?(@.name==\"operator\")].version}", olmClusterOperatorName)}).check(oc) })
test case
openshift/openshift-tests-private
fa06a3d3-f661-4da1-bf63-59679185797c
NonHyperShiftHOST-Author:xzha-Medium-62945-OLM version rule is clear
['"fmt"', '"os/exec"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-Author:xzha-Medium-62945-OLM version rule is clear", func() { exutil.By("get the cluster version") clusterVersion, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("clusterversion", "version", "-o=jsonpath={.status.desired.version}").Output() o.Expect(clusterVersion).NotTo(o.BeEmpty()) o.Expect(err).NotTo(o.HaveOccurred()) clusterVersionShort := strings.Split(clusterVersion, "-")[0] e2e.Logf("cluster verison is %s", clusterVersionShort) clusterVersionMajorMinor := strings.Split(clusterVersionShort, ".")[0] + "." + strings.Split(clusterVersionShort, ".")[1] subPods := []string{"catalog-operator", "olm-operator", "packageserver"} for _, v := range subPods { podName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", "openshift-operator-lifecycle-manager", "pods", "-l", fmt.Sprintf("app=%s", v), "-o=jsonpath={.items[0].metadata.name}").Output() o.Expect(err).NotTo(o.HaveOccurred()) e2e.Logf("get pod name:%s", podName) exutil.By(fmt.Sprintf("get olm version from the %s pod", v)) commands := []string{"-n", "openshift-operator-lifecycle-manager", "exec", podName, "--", "olm", "--version"} output, err := oc.AsAdmin().WithoutNamespace().Run(commands...).Args().Output() o.Expect(output).NotTo(o.BeEmpty()) o.Expect(err).NotTo(o.HaveOccurred()) olmVersionString := strings.Split(output, "\n")[0] olmVersion := strings.TrimSpace(strings.Split(olmVersionString, ":")[1]) e2e.Logf("olm verison is %s", olmVersion) o.Expect(strings.HasPrefix(olmVersion, clusterVersionMajorMinor)).To(o.BeTrue()) } clusterOperators := []string{"operator-lifecycle-manager", "operator-lifecycle-manager-catalog"} for _, co := range clusterOperators { version, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("co", co, `-o=jsonpath={.status.versions[?(@.name=="operator-lifecycle-manager")].version}`).Output() e2e.Logf("verison is %s", version) o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(strings.HasPrefix(version, clusterVersionMajorMinor)).To(o.BeTrue()) } })
test case
openshift/openshift-tests-private
0d42f78e-efbe-475e-9a39-01f69a08c9d0
ConnectedOnly-Author:kuiwang-Medium-29775-Medium-29786-as oc user on linux to mirror catalog image
['"os/exec"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:kuiwang-Medium-29775-Medium-29786-as oc user on linux to mirror catalog image", func() { var ( bundleIndex1 = "quay.io/kuiwang/operators-all:v1" bundleIndex2 = "quay.io/kuiwang/operators-dockerio:v1" operatorAllPath = "operators-all-manifests-" + getRandomString() operatorDockerioPath = "operators-dockerio-manifests-" + getRandomString() ) defer exec.Command("bash", "-c", "rm -fr ./"+operatorAllPath).Output() defer exec.Command("bash", "-c", "rm -fr ./"+operatorDockerioPath).Output() exutil.By("mirror to quay.io/kuiwang") output, err := oc.AsAdmin().WithoutNamespace().Run("adm", "catalog", "mirror").Args("--manifests-only", "--to-manifests="+operatorAllPath, bundleIndex1, "quay.io/kuiwang").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(output).To(o.ContainSubstring("operators-all-manifests")) exutil.By("check mapping.txt") result, err := exec.Command("bash", "-c", "cat ./"+operatorAllPath+"/mapping.txt|grep -E \"atlasmap-atlasmap-operator:0.1.0|quay.io/kuiwang/jmckind-argocd-operator:[a-z0-9][a-z0-9]|redhat-cop-cert-utils-operator:latest\"").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(result).To(o.ContainSubstring("atlasmap-atlasmap-operator:0.1.0")) o.Expect(result).To(o.ContainSubstring("redhat-cop-cert-utils-operator:latest")) o.Expect(result).To(o.ContainSubstring("quay.io/kuiwang/jmckind-argocd-operator")) exutil.By("check icsp yaml") result, err = exec.Command("bash", "-c", "cat ./"+operatorAllPath+"/imageContentSourcePolicy.yaml | grep -E \"quay.io/kuiwang/strimzi-operator|docker.io/strimzi/operator$\"").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(result).To(o.ContainSubstring("- quay.io/kuiwang/strimzi-operator")) o.Expect(result).To(o.ContainSubstring("source: docker.io/strimzi/operator")) exutil.By("mirror to localhost:5000") output, err = oc.AsAdmin().WithoutNamespace().Run("adm", "catalog", "mirror").Args("--manifests-only", "--to-manifests="+operatorDockerioPath, bundleIndex2, "localhost:5000").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(output).To(o.ContainSubstring("operators-dockerio-manifests")) exutil.By("check mapping.txt to localhost:5000") result, err = exec.Command("bash", "-c", "cat ./"+operatorDockerioPath+"/mapping.txt|grep -E \"localhost:5000/atlasmap/atlasmap-operator:0.1.0|localhost:5000/strimzi/operator:[a-z0-9][a-z0-9]\"").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(result).To(o.ContainSubstring("localhost:5000/atlasmap/atlasmap-operator:0.1.0")) o.Expect(result).To(o.ContainSubstring("localhost:5000/strimzi/operator")) exutil.By("check icsp yaml to localhost:5000") result, err = exec.Command("bash", "-c", "cat ./"+operatorDockerioPath+"/imageContentSourcePolicy.yaml | grep -E \"localhost:5000/strimzi/operator|docker.io/strimzi/operator$\"").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(result).To(o.ContainSubstring("- localhost:5000/strimzi/operator")) o.Expect(result).To(o.ContainSubstring("source: docker.io/strimzi/operator")) o.Expect(result).NotTo(o.ContainSubstring("docker.io/atlasmap/atlasmap-operator")) })
test case
openshift/openshift-tests-private
4528b8bd-0011-479c-be1c-9095a6ff399e
ConnectedOnly-Author:kuiwang-Medium-33452-oc adm catalog mirror does not mirror the index image itself
['"os/exec"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:kuiwang-Medium-33452-oc adm catalog mirror does not mirror the index image itself", func() { var ( bundleIndex1 = "quay.io/olmqe/olm-api@sha256:71cfd4deaa493d31cd1d8255b1dce0fb670ae574f4839c778f2cfb1bf1f96995" manifestPath = "manifests-olm-api-" + getRandomString() ) defer exec.Command("bash", "-c", "rm -fr ./"+manifestPath).Output() exutil.By("mirror to localhost:5000/test") output, err := oc.AsAdmin().WithoutNamespace().Run("adm", "catalog", "mirror").Args("--manifests-only", "--to-manifests="+manifestPath, bundleIndex1, "localhost:5000/test").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(output).To(o.ContainSubstring("manifests-olm-api")) exutil.By("check mapping.txt to localhost:5000") result, err := exec.Command("bash", "-c", "cat ./"+manifestPath+"/mapping.txt|grep -E \"quay.io/olmqe/olm-api\"").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(result).To(o.ContainSubstring("quay.io/olmqe/olm-api")) exutil.By("check icsp yaml to localhost:5000") result, err = exec.Command("bash", "-c", "cat ./"+manifestPath+"/imageContentSourcePolicy.yaml | grep -E \"quay.io/olmqe/olm-api\"").Output() o.Expect(err).NotTo(o.HaveOccurred()) o.Expect(result).To(o.ContainSubstring("quay.io/olmqe/olm-api")) })
test case
openshift/openshift-tests-private
de2d8f1f-cf44-459b-a293-f48bf0cf526d
Author:kuiwang-NonHyperShiftHOST-ROSA-OSD_CCS-ARO-ConnectedOnly-Medium-21825-Certs for packageserver can be rotated successfully
['"context"', '"fmt"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:kuiwang-NonHyperShiftHOST-ROSA-OSD_CCS-ARO-ConnectedOnly-Medium-21825-Certs for packageserver can be rotated successfully", func() { exutil.SkipBaselineCaps(oc, "None") exutil.SkipIfDisableDefaultCatalogsource(oc) var ( packageserverName = "packageserver" ) exutil.By("Get certsRotateAt and APIService name") resources := strings.Fields(getResource(oc, asAdmin, withoutNamespace, "csv", packageserverName, "-n", "openshift-operator-lifecycle-manager", fmt.Sprintf("-o=jsonpath={.status.certsRotateAt}{\" \"}{.status.requirementStatus[?(@.kind==\"%s\")].name}", "APIService"))) o.Expect(resources).NotTo(o.BeEmpty()) apiServiceName := resources[1] certsRotateAt, err := time.Parse(time.RFC3339, resources[0]) o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("Get caBundle") caBundle := getResource(oc, asAdmin, withoutNamespace, "apiservices", apiServiceName, "-o=jsonpath={.spec.caBundle}") o.Expect(caBundle).NotTo(o.BeEmpty()) exutil.By("Change caBundle") patchResource(oc, asAdmin, withoutNamespace, "apiservices", apiServiceName, "-p", fmt.Sprintf("{\"spec\":{\"caBundle\":\"test%s\"}}", caBundle)) exutil.By("Check updated certsRotataAt") err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { updatedCertsRotateAt, err := time.Parse(time.RFC3339, getResource(oc, asAdmin, withoutNamespace, "csv", packageserverName, "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.status.certsRotateAt}")) if err != nil { e2e.Logf("the get error is %v, and try next", err) return false, nil } if !updatedCertsRotateAt.Equal(certsRotateAt) { e2e.Logf("wait update, and try next") return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("csv %s cert is not updated", packageserverName)) newCheck("expect", asAdmin, withoutNamespace, contain, "redhat-operators", ok, []string{"packagemanifest", fmt.Sprintf("--selector=catalog=%s", "redhat-operators"), "-o=jsonpath={.items[*].status.catalogSource}"}).check(oc) })
test case
openshift/openshift-tests-private
83a66a9f-6edb-47c1-b154-5d222db09e0a
ConnectedOnly-Author:kuiwang-High-24870-can not create csv without operator group
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:kuiwang-High-24870-can not create csv without operator group", func() { architecture.SkipNonAmd64SingleArch(oc) var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") og = operatorGroupDescription{ name: "og-singlenamespace", namespace: "", template: ogSingleTemplate, } catsrc = catalogSourceDescription{ name: "catsrc-operator", namespace: "", displayName: "Test Catsrc Operators", publisher: "Red Hat", sourceType: "grpc", address: "quay.io/olmqe/olm-index:OLM-2378-Oadp-GoodOne-withCache", template: catsrcImageTemplate, } sub = subscriptionDescription{ subName: "oadp-operator", namespace: "", channel: "alpha", ipApproval: "Automatic", operatorPackage: "oadp-operator", catalogSourceName: catsrc.name, catalogSourceNamespace: "", startingCSV: "", currentCSV: "", installedCSV: "", template: subTemplate, singleNamespace: true, } ) og.namespace = oc.Namespace() sub.namespace = oc.Namespace() catsrc.namespace = oc.Namespace() sub.catalogSourceNamespace = catsrc.namespace exutil.By("create catalog source") catsrc.createWithCheck(oc, itName, dr) exutil.By("Create csv with failure because of no operator group") sub.currentCSV = "oadp-operator.v0.5.3" sub.createWithoutCheck(oc, itName, dr) newCheck("present", asUser, withNamespace, notPresent, "", ok, []string{"csv", sub.currentCSV}).check(oc) sub.delete(itName, dr) exutil.By("Create opertor group and then csv is created with success") og.create(oc, itName, dr) sub.create(oc, itName, dr) newCheck("expect", asUser, withNamespace, compare, "Succeeded"+"InstallSucceeded", ok, []string{"csv", sub.installedCSV, "-o=jsonpath={.status.phase}{.status.reason}"}).check(oc) })
test case
openshift/openshift-tests-private
7a8552dd-967c-4be0-9cff-5d535f62eb64
NonHyperShiftHOST-ConnectedOnly-Author:kuiwang-High-25855-Add the channel field to subscription_sync_count [Serial]
['"context"', '"fmt"', '"os"', '"os/exec"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-ConnectedOnly-Author:kuiwang-High-25855-Add the channel field to subscription_sync_count [Serial]", func() { architecture.SkipNonAmd64SingleArch(oc) infra, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("infrastructures", "cluster", "-o=jsonpath={.status.infrastructureTopology}").Output() o.Expect(err).NotTo(o.HaveOccurred()) if infra == "SingleReplica" { g.Skip("it is not supported") } exutil.SkipBaselineCaps(oc, "None") exutil.SkipForSNOCluster(oc) platform := exutil.CheckPlatform(oc) proxy, errProxy := oc.AsAdmin().WithoutNamespace().Run("get").Args("proxy", "cluster", "-o=jsonpath={.status.httpProxy}{.status.httpsProxy}").Output() o.Expect(errProxy).NotTo(o.HaveOccurred()) if proxy != "" || strings.Contains(platform, "openstack") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "vsphere") || exutil.Is3MasterNoDedicatedWorkerNode(oc) || os.Getenv("HTTP_PROXY") != "" || os.Getenv("HTTPS_PROXY") != "" || os.Getenv("http_proxy") != "" || os.Getenv("https_proxy") != "" { g.Skip("it is not supported") } var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") og = operatorGroupDescription{ name: "og-singlenamespace", namespace: "", template: ogSingleTemplate, } catsrc = catalogSourceDescription{ name: "catsrc-operator", namespace: "", displayName: "Test Catsrc Operators", publisher: "Red Hat", sourceType: "grpc", address: "quay.io/olmqe/olm-index:OLM-2378-Oadp-GoodOne-withCache", template: catsrcImageTemplate, } sub = subscriptionDescription{ subName: "oadp-operator", namespace: "", channel: "alpha", ipApproval: "Automatic", operatorPackage: "oadp-operator", catalogSourceName: catsrc.name, catalogSourceNamespace: "", startingCSV: "", currentCSV: "", installedCSV: "", template: subTemplate, singleNamespace: true, } ) og.namespace = oc.Namespace() sub.namespace = oc.Namespace() catsrc.namespace = oc.Namespace() sub.catalogSourceNamespace = catsrc.namespace exutil.By("create catalog source") catsrc.createWithCheck(oc, itName, dr) exutil.By("Create og") og.create(oc, itName, dr) exutil.By("Create operator") sub.create(oc, itName, dr) newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("get information of catalog operator pod") output := getResource(oc, asAdmin, withoutNamespace, "pods", "-l", "app=catalog-operator", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.items[0].metadata.name}{\" \"}{.items[0].status.podIP}{\":\"}{.items[0].spec.containers[0].ports[?(@.name==\"metrics\")].containerPort}") o.Expect(output).NotTo(o.BeEmpty()) infoCatalogOperator := strings.Fields(output) exutil.By("check the subscription_sync_total") var subscriptionSyncTotal []byte var errExec error err = wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) { subscriptionSyncTotal, errExec = exec.Command("bash", "-c", "oc exec -c catalog-operator "+infoCatalogOperator[0]+" -n openshift-operator-lifecycle-manager -- curl -s -k -H 'Authorization: Bearer $(oc create token prometheus-k8s -n openshift-monitoring)' https://"+infoCatalogOperator[1]+"/metrics").Output() if !strings.Contains(string(subscriptionSyncTotal), sub.installedCSV) { e2e.Logf("the metric is not counted and try next round") return false, nil } return true, nil }) if err != nil { e2e.Logf("the output: %v \n the err: %v", string(subscriptionSyncTotal), errExec) } exutil.AssertWaitPollNoErr(err, fmt.Sprintf("csv %s is not included in metric", sub.installedCSV)) })
test case
openshift/openshift-tests-private
ed2bda39-8775-40c2-afcf-973884afcb80
Author:kuiwang-ROSA-OSD_CCS-ARO-Medium-29231-Medium-29277-label to target namespace of group
['"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:kuiwang-ROSA-OSD_CCS-ARO-Medium-29231-Medium-29277-label to target namespace of group", func() { var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") og1 = operatorGroupDescription{ name: "og1-singlenamespace", namespace: "", template: ogSingleTemplate, } og2 = operatorGroupDescription{ name: "og2-singlenamespace", namespace: "", template: ogSingleTemplate, } ) oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach og1.namespace = oc.Namespace() og2.namespace = oc.Namespace() exutil.By("Create og1 and check the label of target namespace of og1 is created") og1.create(oc, itName, dr) og1Uid := getResource(oc, asAdmin, withNamespace, "og", og1.name, "-o=jsonpath={.metadata.uid}") newCheck("expect", asAdmin, withoutNamespace, contain, "olm.operatorgroup.uid/"+og1Uid, ok, []string{"ns", og1.namespace, "-o=jsonpath={.metadata.labels}"}).check(oc) newCheck("expect", asAdmin, withoutNamespace, contain, "olm.operatorgroup.uid/"+og1Uid, nok, []string{"ns", "openshift-operators", "-o=jsonpath={.metadata.labels}"}).check(oc) exutil.By("Delete og1 and check the label of target namespace of og1 is removed") og1.delete(itName, dr) newCheck("expect", asAdmin, withoutNamespace, contain, "olm.operatorgroup.uid/"+og1Uid, nok, []string{"ns", og1.namespace, "-o=jsonpath={.metadata.labels}"}).check(oc) exutil.By("Create og2 and recreate og1 and check the label") og2.create(oc, itName, dr) og2Uid := getResource(oc, asAdmin, withNamespace, "og", og2.name, "-o=jsonpath={.metadata.uid}") og1.create(oc, itName, dr) og1Uid = getResource(oc, asAdmin, withNamespace, "og", og1.name, "-o=jsonpath={.metadata.uid}") labelNs := getResource(oc, asAdmin, withoutNamespace, "ns", og1.namespace, "-o=jsonpath={.metadata.labels}") o.Expect(labelNs).To(o.ContainSubstring(og2Uid)) o.Expect(labelNs).To(o.ContainSubstring(og1Uid)) // OCP-29277 exutil.By("Check no label of global operator group ") globalOgUID := getResource(oc, asAdmin, withoutNamespace, "og", "global-operators", "-n", "openshift-operators", "-o=jsonpath={.metadata.uid}") newCheck("expect", asAdmin, withoutNamespace, contain, "olm.operatorgroup.uid/"+globalOgUID, nok, []string{"ns", "default", "-o=jsonpath={.metadata.labels}"}).check(oc) })
test case
openshift/openshift-tests-private
ad6450cd-b869-437a-9c98-f3ec2e662047
ConnectedOnly-Author:kuiwang-Medium-23170-API labels should be hash
['"regexp"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:kuiwang-Medium-23170-API labels should be hash", func() { architecture.SkipNonAmd64SingleArch(oc) var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogD = operatorGroupDescription{ name: "og-singlenamespace", namespace: "", template: ogSingleTemplate, } catsrc = catalogSourceDescription{ name: "catsrc-operator", namespace: "", displayName: "Test Catsrc Operators", publisher: "Red Hat", sourceType: "grpc", address: "quay.io/olmqe/nginx-ok-index:vokv23170", template: catsrcImageTemplate, } subD = subscriptionDescription{ subName: "nginx-ok-v23170", namespace: "", channel: "alpha", ipApproval: "Automatic", operatorPackage: "nginx-ok-v23170", catalogSourceName: catsrc.name, catalogSourceNamespace: "", startingCSV: "", currentCSV: "", installedCSV: "", template: subTemplate, singleNamespace: true, } og = ogD sub = subD ) oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach og.namespace = oc.Namespace() sub.namespace = oc.Namespace() catsrc.namespace = oc.Namespace() sub.catalogSourceNamespace = catsrc.namespace exutil.By("create catalog source") catsrc.createWithCheck(oc, itName, dr) exutil.By("Create og") og.create(oc, itName, dr) exutil.By("Create operator") sub.create(oc, itName, dr) exutil.By("Check the API labes should be hash") apiLabels := getResource(oc, asUser, withNamespace, "csv", sub.installedCSV, "-o=jsonpath={.metadata.labels}") o.Expect(len(apiLabels)).NotTo(o.BeZero()) pattern, err := regexp.Compile(`^[a-fA-F0-9]{16}$|^[a-fA-F0-9]{15}$`) o.Expect(err).NotTo(o.HaveOccurred()) for _, v := range strings.Split(strings.Trim(apiLabels, "{}"), ",") { if strings.Contains(v, "olm.api") { hash := strings.Trim(strings.Split(strings.Split(v, ":")[0], ".")[2], "\"") // calling regexp.MatchString in a loop has poor performance, consider using regexp.Compile (SA6000) // match, err := regexp.MatchString(`^[a-fA-F0-9]{16}$|^[a-fA-F0-9]{15}$`, hash) // o.Expect(err).NotTo(o.HaveOccurred()) // o.Expect(match).To(o.BeTrue()) res := pattern.Find([]byte(hash)) o.Expect(string(res)).NotTo(o.BeEmpty()) } } })
test case
openshift/openshift-tests-private
ea8496d6-499e-4e2f-95c7-2fe189653a7d
Author:kuiwang-NonHyperShiftHOST-ConnectedOnly-Medium-20979-only one IP is generated
['"context"', '"os"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"encoding/json"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:kuiwang-NonHyperShiftHOST-ConnectedOnly-Medium-20979-only one IP is generated", func() { architecture.SkipNonAmd64SingleArch(oc) if isAks, _ := exutil.IsAKSCluster(context.TODO(), oc); isAks { g.Skip("skip for ask cluster") } exutil.SkipNoCapabilities(oc, "marketplace") node, errGet := oc.AsAdmin().WithoutNamespace().Run("get").Args("node", "-o=jsonpath={.items[0].metadata.name}").Output() o.Expect(errGet).NotTo(o.HaveOccurred()) errGet = exutil.SetNamespacePrivileged(oc, oc.Namespace()) o.Expect(errGet).NotTo(o.HaveOccurred()) efips, errGet := oc.AsAdmin().WithoutNamespace().Run("debug").Args("node/"+node, "--to-namespace="+oc.Namespace(), "--", "chroot", "/host", "fips-mode-setup", "--check").Output() if errGet != nil || strings.Contains(efips, "FIPS mode is enabled") { g.Skip("skip it without impacting function") } platform := exutil.CheckPlatform(oc) proxy, errProxy := oc.AsAdmin().WithoutNamespace().Run("get").Args("proxy", "cluster", "-o=jsonpath={.status.httpProxy}{.status.httpsProxy}").Output() o.Expect(errProxy).NotTo(o.HaveOccurred()) if proxy != "" || strings.Contains(platform, "openstack") || strings.Contains(platform, "none") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "vsphere") || exutil.Is3MasterNoDedicatedWorkerNode(oc) || os.Getenv("HTTP_PROXY") != "" || os.Getenv("HTTPS_PROXY") != "" || os.Getenv("http_proxy") != "" || os.Getenv("https_proxy") != "" { g.Skip("it is not supported") } var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogD = operatorGroupDescription{ name: "og-singlenamespace", namespace: "", template: ogSingleTemplate, } catsrc = catalogSourceDescription{ name: "catsrc-operator", namespace: "", displayName: "Test Catsrc Operators", publisher: "Red Hat", sourceType: "grpc", address: "quay.io/olmqe/nginx-ok-index:vokv20979", template: catsrcImageTemplate, } subD = subscriptionDescription{ subName: "nginx-ok-v20979", namespace: "", channel: "alpha", ipApproval: "Automatic", operatorPackage: "nginx-ok-v20979", catalogSourceName: catsrc.name, catalogSourceNamespace: "", startingCSV: "", currentCSV: "", installedCSV: "", template: subTemplate, singleNamespace: true, } og = ogD sub = subD ) oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach og.namespace = oc.Namespace() sub.namespace = oc.Namespace() catsrc.namespace = oc.Namespace() sub.catalogSourceNamespace = catsrc.namespace exutil.By("create catalog source") catsrc.create(oc, itName, dr) err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) { status, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("catsrc", catsrc.name, "-n", catsrc.namespace, "-o=jsonpath={.status..lastObservedState}").Output() if strings.Compare(status, "READY") != 0 { e2e.Logf("catsrc %s lastObservedState is %s, not READY", catsrc.name, status) return false, nil } return true, nil }) if err != nil { output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("catsrc", catsrc.name, "-n", catsrc.namespace, "-o=jsonpath={.status}").Output() e2e.Logf(output) logDebugInfo(oc, catsrc.namespace, "pod", "events") g.Skip("catsrc is not ready, so skip") } exutil.By("Create og") og.create(oc, itName, dr) exutil.By("Create operator") sub.create(oc, itName, dr) newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("Check there is only one ip") ips := getResource(oc, asAdmin, withoutNamespace, "installplan", "-n", sub.namespace, "--no-headers") ipList := strings.Split(ips, "\n") for _, ip := range ipList { name := strings.Fields(ip)[0] getResource(oc, asAdmin, withoutNamespace, "installplan", name, "-n", sub.namespace, "-o=json") } o.Expect(strings.Count(ips, sub.installedCSV)).To(o.Equal(1)) })
test case
openshift/openshift-tests-private
0c491f4a-c51b-4e23-a97f-8ce33a5aabf1
Author:kuiwang-NonHyperShiftHOST-ConnectedOnly-Medium-25757-High-22656-manual approval strategy apply to subsequent releases
['"context"', '"fmt"', '"os"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:kuiwang-NonHyperShiftHOST-ConnectedOnly-Medium-25757-High-22656-manual approval strategy apply to subsequent releases", func() { architecture.SkipNonAmd64SingleArch(oc) if isAks, _ := exutil.IsAKSCluster(context.TODO(), oc); isAks { g.Skip("skip for ask cluster") } exutil.SkipNoCapabilities(oc, "marketplace") node, errGet := oc.AsAdmin().WithoutNamespace().Run("get").Args("node", "-o=jsonpath={.items[0].metadata.name}").Output() o.Expect(errGet).NotTo(o.HaveOccurred()) errGet = exutil.SetNamespacePrivileged(oc, oc.Namespace()) o.Expect(errGet).NotTo(o.HaveOccurred()) efips, errGet := oc.AsAdmin().WithoutNamespace().Run("debug").Args("node/"+node, "--to-namespace="+oc.Namespace(), "--", "chroot", "/host", "fips-mode-setup", "--check").Output() if errGet != nil || strings.Contains(efips, "FIPS mode is enabled") { g.Skip("skip it without impacting function") } infra, errGet := oc.AsAdmin().WithoutNamespace().Run("get").Args("infrastructures", "cluster", "-o=jsonpath={.status.infrastructureTopology}").Output() o.Expect(errGet).NotTo(o.HaveOccurred()) if infra == "SingleReplica" { g.Skip("it is not supported") } platform := exutil.CheckPlatform(oc) proxy, errProxy := oc.AsAdmin().WithoutNamespace().Run("get").Args("proxy", "cluster", "-o=jsonpath={.status.httpProxy}{.status.httpsProxy}").Output() o.Expect(errProxy).NotTo(o.HaveOccurred()) if proxy != "" || strings.Contains(platform, "openstack") || strings.Contains(platform, "none") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "vsphere") || exutil.Is3MasterNoDedicatedWorkerNode(oc) || os.Getenv("HTTP_PROXY") != "" || os.Getenv("HTTPS_PROXY") != "" || os.Getenv("http_proxy") != "" || os.Getenv("https_proxy") != "" { g.Skip("it is not supported") } var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogD = operatorGroupDescription{ name: "og-singlenamespace", namespace: "", template: ogSingleTemplate, } catsrc = catalogSourceDescription{ name: "catsrc-operator", namespace: "", displayName: "Test Catsrc Operators", publisher: "Red Hat", sourceType: "grpc", address: "quay.io/olmqe/olm-index:OLM-2378-Oadp-Good", template: catsrcImageTemplate, } subD = subscriptionDescription{ subName: "oadp-operator", namespace: "", channel: "alpha", ipApproval: "Automatic", operatorPackage: "oadp-operator", catalogSourceName: catsrc.name, catalogSourceNamespace: "", startingCSV: "", currentCSV: "", installedCSV: "", template: subTemplate, singleNamespace: true, } og = ogD sub = subD ) oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach og.namespace = oc.Namespace() sub.namespace = oc.Namespace() catsrc.namespace = oc.Namespace() sub.catalogSourceNamespace = catsrc.namespace exutil.By("create catalog source") catsrc.createWithCheck(oc, itName, dr) exutil.By("Create og") og.create(oc, itName, dr) exutil.By("prepare for manual approval") sub.ipApproval = "Manual" sub.startingCSV = "oadp-operator.v0.5.5" exutil.By("Create Sub which apply manual approve install plan") sub.create(oc, itName, dr) exutil.By("the install plan is RequiresApproval") installPlan := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installplan.name}") o.Expect(installPlan).NotTo(o.BeEmpty()) newCheck("expect", asAdmin, withoutNamespace, compare, "RequiresApproval", ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("manually approve sub") sub.approve(oc, itName, dr) exutil.By("the target CSV is created with upgrade") err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) { currentCSV := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.currentCSV}") if strings.Compare(currentCSV, sub.startingCSV) != 0 { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, fmt.Sprintf("the installedCSV %v is not expected", sub.installedCSV)) })
test case
openshift/openshift-tests-private
99c465d3-7f45-4682-b137-c04cc03c16c2
Author:bandrade-LEVEL0-Critical-41026-OCS should only one installplan generated when creating subscription
['"context"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-LEVEL0-Critical-41026-OCS should only one installplan generated when creating subscription", func() { var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") og = operatorGroupDescription{ name: "og-41026-singlenamespace", namespace: "", template: ogSingleTemplate, } sub = subscriptionDescription{ subName: "sub-41026", namespace: oc.Namespace(), catalogSourceName: "", catalogSourceNamespace: "openshift-marketplace", ipApproval: "Automatic", channel: "beta", operatorPackage: "learn", singleNamespace: true, template: subTemplate, } ) catsrcName := "qe-app-registry" if isPresentResource(oc, asAdmin, withoutNamespace, present, "catsrc", "auto-release-app-registry", "-n", "openshift-marketplace") { catsrcName = "auto-release-app-registry" } // project and its resource are deleted automatically when out of It, so no need defer or AfterEach oc.SetupProject() og.namespace = oc.Namespace() sub.namespace = oc.Namespace() sub.catalogSourceName = catsrcName exutil.By("Create og") defer og.delete(itName, dr) og.create(oc, itName, dr) exutil.By("Create operator") defer sub.delete(itName, dr) defer sub.deleteCSV(itName, dr) sub.create(oc, itName, dr) newCheck("expect", asAdmin, withNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("Check there is only one ip") // waiting for the InstallPlan updated err := wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { ips := getResource(oc, asAdmin, withoutNamespace, "installplan", "-n", sub.namespace, "--no-headers") ipList := strings.Split(ips, "\n") count := 0 for _, ip := range ipList { name := strings.Fields(ip)[0] CSVs := getResource(oc, asAdmin, withoutNamespace, "installplan", name, "-n", sub.namespace, "-o=jsonpath={.spec.clusterServiceVersionNames}") e2e.Logf("CSVs is \n%s", CSVs) e2e.Logf("sub.installedCSV is \n%s", sub.installedCSV) if strings.Contains(CSVs, sub.installedCSV) { count++ } } if count != 1 { e2e.Logf("the install plan is \n%s", ips) return false, nil } return true, nil }) exutil.AssertWaitPollNoErr(err, "the generated InstallPlan != 1") exutil.By("Waiting for install plan Complete") // if installplan status is Installing, csv will be re-created. installPlan := sub.getIP(oc) o.Expect(installPlan).NotTo(o.BeEmpty()) newCheck("expect", asAdmin, withoutNamespace, compare, "Complete", ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc) })
test case
openshift/openshift-tests-private
7d772999-eb57-479c-9582-9a43bf20786f
Author:bandrade-ConnectedOnly-NonHyperShiftHOST-Medium-68521-Check failureThreshold of redhat-operators catalog
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-ConnectedOnly-NonHyperShiftHOST-Medium-68521-Check failureThreshold of redhat-operators catalog", func() { architecture.SkipNonAmd64SingleArch(oc) redhatOperators, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", "redhat-operators", "-n", "openshift-marketplace").Output() if err != nil && strings.Contains(redhatOperators, "not found") { g.Skip("redhat-operators catalog does not exist in the cluster") } o.Expect(err).NotTo(o.HaveOccurred()) newCheck("expect", asAdmin, withoutNamespace, contain, "10", ok, []string{"pods", "-n", "openshift-marketplace", "-l olm.catalogSource=redhat-operators", "-o=jsonpath='{..spec.containers[0].startupProbe.failureThreshold}'"}).check(oc) })
test case
openshift/openshift-tests-private
263e47f4-2f25-4370-81bc-8f377b81d431
Author:bandrade-ConnectedOnly-NonHyperShiftHOST-Medium-68901-Packageserver pod should not crash if pdateStrategy is incorrect
['"context"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:bandrade-ConnectedOnly-NonHyperShiftHOST-Medium-68901-Packageserver pod should not crash if pdateStrategy is incorrect", func() { var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image-incorrect-updatestrategy.yaml") catsrc = catalogSourceDescription{ name: "catsrc-68901", namespace: oc.Namespace(), displayName: "Test Catsrc Operators", publisher: "Red Hat", sourceType: "grpc", address: "quay.io/olmqe/nginxolm-operator-index:v1", template: catsrcImageTemplate, } ) oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach catsrc.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "InvalidIntervalError", ok, []string{"catsrc", catsrc.name, "-n", catsrc.namespace, "-o=jsonpath={.status.reason}"}).check(oc) err := wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 20*time.Second, false, func(ctx context.Context) (bool, error) { status, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "-l", "app=catalog-operator", "-o=jsonpath={..status.phase}").Output() if strings.Compare(status, "Running") != 0 { return true, nil } return false, nil }) exutil.AssertWaitPollWithErr(err, "catalog-operator pod crash") err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) { status, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "-l", "app=packageserver", "-o=jsonpath={..status.phase}").Output() if strings.Compare(status, "Running Running") == 0 { return true, nil } return false, nil }) exutil.AssertWaitPollNoErr(err, "package-server-manager pod crash") })
test case
openshift/openshift-tests-private
ad81910b-5ad5-4cb7-998a-e22fb4943b2f
NonHyperShiftHOST-ConnectedOnly-Author:kuiwang-Medium-24438-check subscription CatalogSource Status
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("NonHyperShiftHOST-ConnectedOnly-Author:kuiwang-Medium-24438-check subscription CatalogSource Status", func() { architecture.SkipNonAmd64SingleArch(oc) platform := exutil.CheckPlatform(oc) if strings.Contains(platform, "openstack") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "vsphere") || strings.Contains(platform, "none") || exutil.Is3MasterNoDedicatedWorkerNode(oc) { g.Skip("it is not supported") } var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogD = operatorGroupDescription{ name: "og-singlenamespace", namespace: "", template: ogSingleTemplate, } catsrc = catalogSourceDescription{ name: "catsrc-test-operator", namespace: "", displayName: "Test Catsrc Operators", publisher: "Red Hat", sourceType: "grpc", address: "", template: catsrcImageTemplate, } subD = subscriptionDescription{ subName: "oadp-operator", namespace: "", channel: "alpha", ipApproval: "Automatic", operatorPackage: "oadp-operator", catalogSourceName: "test", catalogSourceNamespace: "", startingCSV: "", currentCSV: "", installedCSV: "", template: subTemplate, singleNamespace: true, } og = ogD sub = subD ) oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach og.namespace = oc.Namespace() sub.namespace = oc.Namespace() catsrc.namespace = oc.Namespace() sub.catalogSourceName = catsrc.name sub.catalogSourceNamespace = catsrc.namespace exutil.By("Create og") og.create(oc, itName, dr) exutil.By("create sub with the above catalogsource") sub.createWithoutCheck(oc, itName, dr) exutil.By("check its condition is UnhealthyCatalogSourceFound") newCheck("expect", asUser, withoutNamespace, contain, "UnhealthyCatalogSourceFound", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].reason}"}).check(oc) exutil.By("create catalogsource") catsrc.address = "quay.io/olmqe/olm-index:OLM-2378-Oadp-GoodOne-withCache" catsrc.create(oc, itName, dr) newCheck("expect", asAdmin, withoutNamespace, compare, "READY", ok, []string{"catsrc", catsrc.name, "-n", catsrc.namespace, "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("check its condition is AllCatalogSourcesHealthy and csv is created") newCheck("expect", asUser, withoutNamespace, contain, "AllCatalogSourcesHealthy", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].reason}"}).check(oc) sub.findInstalledCSV(oc, itName, dr) })
test case
openshift/openshift-tests-private
c1ac84b6-2a9d-44a1-8d29-b6cdad420a34
ConnectedOnly-Author:kuiwang-Medium-24027-can create and delete catalogsource and sub repeatedly
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', '"time"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:kuiwang-Medium-24027-can create and delete catalogsource and sub repeatedly", func() { architecture.SkipNonAmd64SingleArch(oc) platform := exutil.CheckPlatform(oc) if strings.Contains(platform, "openstack") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "vsphere") || strings.Contains(platform, "none") || exutil.Is3MasterNoDedicatedWorkerNode(oc) { g.Skip("it is not supported") } var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogD = operatorGroupDescription{ name: "og-singlenamespace", namespace: "", template: ogSingleTemplate, } subD = subscriptionDescription{ subName: "nginx-ok-v24027", namespace: "", channel: "alpha", ipApproval: "Automatic", operatorPackage: "nginx-ok-v24027", catalogSourceName: "", catalogSourceNamespace: "", startingCSV: "nginx-ok-v24027.v0.0.1", currentCSV: "", installedCSV: "", template: subTemplate, singleNamespace: true, } catsrc = catalogSourceDescription{ name: "catsrc-test-operator", namespace: "", displayName: "Test Catsrc Operators", publisher: "Red Hat", sourceType: "grpc", address: "quay.io/olmqe/nginx-ok-index:vokv24027", template: catsrcImageTemplate, } repeatedCount = 2 og = ogD sub = subD ) oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach og.namespace = oc.Namespace() sub.namespace = oc.Namespace() catsrc.namespace = oc.Namespace() sub.catalogSourceName = catsrc.name sub.catalogSourceNamespace = catsrc.namespace exutil.By("Create og") og.create(oc, itName, dr) for i := 0; i < repeatedCount; i++ { exutil.By("Create Catalogsource") catsrc.create(oc, itName, dr) newCheck("expect", asUser, withoutNamespace, compare, "READY", ok, []string{"catsrc", catsrc.name, "-n", catsrc.namespace, "-o=jsonpath={.status..lastObservedState}"}).check(oc) exutil.By("Create sub with the above catalogsource") sub.create(oc, itName, dr) newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("Remove catalog and sub") sub.delete(itName, dr) sub.deleteCSV(itName, dr) catsrc.delete(itName, dr) if i < repeatedCount-1 { time.Sleep(20 * time.Second) } } })
test case
openshift/openshift-tests-private
ae93b360-5784-48b1-85be-2e9ac7912bd7
ConnectedOnly-Author:kuiwang-Medium-21404-csv will be RequirementsNotMet after sa is delete
['"context"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"encoding/json"', '"path/filepath"', '"strings"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("ConnectedOnly-Author:kuiwang-Medium-21404-csv will be RequirementsNotMet after sa is delete", func() { if isAks, _ := exutil.IsAKSCluster(context.TODO(), oc); isAks { g.Skip("skip for ask cluster") } architecture.SkipNonAmd64SingleArch(oc) exutil.SkipBaselineCaps(oc, "None") exutil.SkipForSNOCluster(oc) platform := exutil.CheckPlatform(oc) proxy, errProxy := oc.AsAdmin().WithoutNamespace().Run("get").Args("proxy", "cluster", "-o=jsonpath={.status.httpProxy}{.status.httpsProxy}").Output() o.Expect(errProxy).NotTo(o.HaveOccurred()) if proxy != "" || strings.Contains(platform, "openstack") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "vsphere") || strings.Contains(platform, "none") || exutil.Is3MasterNoDedicatedWorkerNode(oc) { g.Skip("it is not supported") } var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") ogD = operatorGroupDescription{ name: "og-singlenamespace", namespace: "", template: ogSingleTemplate, } catsrc = catalogSourceDescription{ name: "catsrc-operator", namespace: "", displayName: "Test Catsrc Operators", publisher: "Red Hat", sourceType: "grpc", address: "quay.io/olmqe/olm-index:OLM-2378-Oadp-GoodOne-withCache", template: catsrcImageTemplate, } subD = subscriptionDescription{ subName: "oadp-operator", namespace: "", channel: "alpha", ipApproval: "Automatic", operatorPackage: "oadp-operator", catalogSourceName: catsrc.name, catalogSourceNamespace: "", startingCSV: "", currentCSV: "", installedCSV: "", template: subTemplate, singleNamespace: true, } og = ogD sub = subD ) oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach og.namespace = oc.Namespace() sub.namespace = oc.Namespace() catsrc.namespace = oc.Namespace() sub.catalogSourceNamespace = catsrc.namespace exutil.By("create catalog source") catsrc.createWithCheck(oc, itName, dr) exutil.By("Create og") og.create(oc, itName, dr) exutil.By("Create operator") sub.create(oc, itName, dr) newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-o=jsonpath={.status.phase}"}).check(oc) exutil.By("Get SA of csv") getResource(oc, asUser, withNamespace, "csv", sub.installedCSV, "-o=json") sa := newSa(strings.Fields(getResource(oc, asUser, withNamespace, "csv", sub.installedCSV, "-o=jsonpath={.status.requirementStatus[?(@.kind==\"ServiceAccount\")].name}"))[0], sub.namespace) exutil.By("Delete sa of csv") sa.getDefinition(oc) sa.delete(oc) newCheck("expect", asUser, withNamespace, compare, "RequirementsNotMet", ok, []string{"csv", sub.installedCSV, "-o=jsonpath={.status.reason}"}).check(oc) exutil.By("Recovery sa of csv") sa.reapply(oc) newCheck("expect", asUser, withNamespace, compare, "Succeeded+2+Installing", ok, []string{"csv", sub.installedCSV, "-o=jsonpath={.status.phase}"}).check(oc) })
test case
openshift/openshift-tests-private
cf833eb9-f178-42fe-bf9b-37c280983f79
Author:kuiwang-ConnectedOnly-ROSA-OSD_CCS-ARO-Medium-29723-As cluster admin find abnormal status condition via components of operator resource
['"fmt"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"encoding/json"', '"path/filepath"']
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
g.It("Author:kuiwang-ConnectedOnly-ROSA-OSD_CCS-ARO-Medium-29723-As cluster admin find abnormal status condition via components of operator resource", func() { architecture.SkipNonAmd64SingleArch(oc) var ( itName = g.CurrentSpecReport().FullText() buildPruningBaseDir = exutil.FixturePath("testdata", "olm") ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml") catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml") subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml") og = operatorGroupDescription{ name: "og-singlenamespace", namespace: "", template: ogSingleTemplate, } catsrc = catalogSourceDescription{ name: "catsrc-29723-operator", namespace: "", displayName: "Test Catsrc 29723 Operators", publisher: "Red Hat", sourceType: "grpc", address: "quay.io/olmqe/nginx-ok-index:v1399-fbc-multi", template: catsrcImageTemplate, } sub = subscriptionDescription{ subName: "nginx-ok1-1399", namespace: "", channel: "alpha", ipApproval: "Automatic", operatorPackage: "nginx-ok1-1399", catalogSourceName: catsrc.name, catalogSourceNamespace: "", startingCSV: "nginx-ok1-1399.v0.0.4", currentCSV: "", installedCSV: "", template: subTemplate, singleNamespace: true, } ) oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach og.namespace = oc.Namespace() catsrc.namespace = oc.Namespace() sub.namespace = oc.Namespace() sub.catalogSourceNamespace = catsrc.namespace exutil.By("create catalog source") catsrc.createWithCheck(oc, itName, dr) exutil.By("Create og") og.create(oc, itName, dr) exutil.By("install perator") sub.create(oc, itName, dr) exutil.By("delete catalog source") catsrc.delete(itName, dr) exutil.By("delete sa") _, err := doAction(oc, "delete", asAdmin, withoutNamespace, "sa", "nginx-ok1-1399-controller-manager", "-n", sub.namespace) o.Expect(err).NotTo(o.HaveOccurred()) exutil.By("check abnormal status") output := getResource(oc, asAdmin, withoutNamespace, "operator.operators.coreos.com", sub.operatorPackage+"."+sub.namespace, "-o=json") o.Expect(output).NotTo(o.BeEmpty()) newCheck("expect", asAdmin, withoutNamespace, contain, "CatalogSourcesUnhealthy", ok, []string{"operator.operators.coreos.com", sub.operatorPackage + "." + sub.namespace, fmt.Sprintf("-o=jsonpath={.status.components.refs[?(@.name==\"%s\")].conditions[*].type}", sub.subName)}).check(oc) newCheck("expect", asAdmin, withoutNamespace, contain, "RequirementsNotMet+2+InstallWaiting", ok, []string{"operator.operators.coreos.com", sub.operatorPackage + "." + sub.namespace, fmt.Sprintf("-o=jsonpath={.status.components.refs[?(@.name==\"%s\")].conditions[*].reason}", sub.installedCSV)}).check(oc) })