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
|
7d22de56-c323-4b28-9a3e-6c81e9ca17aa
|
ConnectedOnly-Author:kuiwang-Medium-30762-installs bundles with v1 CRDs
|
['"os"', '"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-30762-installs bundles with v1 CRDs", func() {
architecture.SkipNonAmd64SingleArch(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())
e2e.Logf("platform: %v", platform)
if proxy != "" || strings.Contains(platform, "openstack") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "none") ||
strings.Contains(platform, "vsphere") || strings.Contains(platform, "osp") || strings.Contains(platform, "ibmcloud") || strings.Contains(platform, "nutanix") ||
os.Getenv("HTTP_PROXY") != "" || os.Getenv("HTTPS_PROXY") != "" || os.Getenv("http_proxy") != "" || os.Getenv("https_proxy") != "" ||
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")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-30762-operator",
namespace: "",
displayName: "Test Catsrc 30762 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginx-ok-index:vokv30762",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-ok-v30762",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-ok-v30762",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "nginx-ok-v30762.v0.0.1",
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("check csv")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
de997d96-1930-4de0-b4ae-a915e754dddc
|
ConnectedOnly-Author:kuiwang-Medium-27683-InstallPlans can install from extracted bundles
|
['"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-Medium-27683-InstallPlans can install from extracted bundles", 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-27683-operator",
namespace: "",
displayName: "Test Catsrc 27683 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginx-ok-index:vokv27683",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-ok-v27683",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-ok-v27683",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "nginx-ok-v27683.v0.0.1",
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("check csv")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("get bundle package from ip")
installPlan := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installplan.name}")
o.Expect(installPlan).NotTo(o.BeEmpty())
ipBundle := getResource(oc, asAdmin, withoutNamespace, "installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.bundleLookups[0].path}")
o.Expect(ipBundle).NotTo(o.BeEmpty())
exutil.By("get bundle package from job")
jobName := getResource(oc, asAdmin, withoutNamespace, "job", "-n", catsrc.namespace, "-o=jsonpath={.items[0].metadata.name}")
o.Expect(jobName).NotTo(o.BeEmpty())
jobBundle := getResource(oc, asAdmin, withoutNamespace, "pod", "-l", "job-name="+jobName, "-n", catsrc.namespace, "-o=jsonpath={.items[0].status.initContainerStatuses[*].image}")
o.Expect(jobName).NotTo(o.BeEmpty())
o.Expect(jobBundle).To(o.ContainSubstring(ipBundle))
})
| |||||
test case
|
openshift/openshift-tests-private
|
9585e02b-f3f6-4a7b-9087-20f989a6a1bd
|
ConnectedOnly-Author:kuiwang-Medium-24513-Operator config support env only
|
['"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-24513-Operator config support env only", 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-extract.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-24513-operator",
namespace: "",
displayName: "Test Catsrc 24513 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginx-ok-index:v1399-1-arg",
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.5",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
// opename = "build-operator"
)
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("check csv")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("get parameter of deployment")
getResource(oc, asAdmin, withoutNamespace, "deployment", "-n", sub.namespace, "-o=yaml")
// newCheck("expect", asAdmin, withoutNamespace, contain, "ARGS1", ok, []string{"deployment", opename, "-n", sub.namespace, "-o=jsonpath={.spec.template.spec.containers[0].command}"}).check(oc)
exutil.By("patch env for sub")
sub.patch(oc, "{\"spec\": {\"config\": {\"env\": [{\"name\": \"EMPTY_ENV\"},{\"name\": \"ARGS1\",\"value\": \"-v=4\"}]}}}")
exutil.By("check the empty env")
// newCheck("expect", asAdmin, withoutNamespace, contain, "EMPTY_ENV", ok, []string{"deployment", opename, "-n", sub.namespace, "-o=jsonpath={.spec.template.spec.containers[0].env[*].name}"}).check(oc)
// newCheck("expect", asAdmin, withoutNamespace, contain, "-v=4", ok, []string{"deployment", opename, "-n", sub.namespace, "-o=jsonpath={.spec.template.spec.containers[0].env[*].value}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
15358d34-8eb7-4cfa-9590-5d3f764a35af
|
ConnectedOnly-Author:kuiwang-Medium-24382-Should restrict CRD update if schema changes [Serial]
|
['"context"', '"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("ConnectedOnly-Author:kuiwang-Medium-24382-Should restrict CRD update if schema changes [Serial]", 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)
node, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("node", "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
err = exutil.SetNamespacePrivileged(oc, oc.Namespace())
o.Expect(err).NotTo(o.HaveOccurred())
efips, err := oc.AsAdmin().WithoutNamespace().Run("debug").Args("node/"+node, "--to-namespace="+oc.Namespace(), "--", "chroot", "/host", "fips-mode-setup", "--check").Output()
if err != nil || strings.Contains(efips, "FIPS mode is enabled") {
g.Skip("skip it without impacting function")
}
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")
}
platform := exutil.CheckPlatform(oc)
e2e.Logf("platform: %v", platform)
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-legacy.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
etcdCluster = filepath.Join(buildPruningBaseDir, "etcd-cluster.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-24382-operator",
namespace: "",
displayName: "Test Catsrc 24382 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/olm-dep:vschema-crdv3",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "etcd",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "etcd",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "etcdoperator.v0.9.2",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
etcdCr = customResourceDescription{
name: "example-24382",
namespace: "",
typename: "EtcdCluster",
template: etcdCluster,
}
)
og.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
etcdCr.namespace = oc.Namespace()
defer exutil.RecoverNamespaceRestricted(oc, oc.Namespace())
exutil.SetNamespacePrivileged(oc, oc.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("check csv")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
errCRD := wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("crd", "etcdclusters.etcd.database.coreos.com", "-o=jsonpath={.status.storedVersions}").Output()
if err != nil {
return false, err
}
if strings.Contains(output, "v1beta2") {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(errCRD, "crd etcdcluster does not exist")
exutil.By("creat cr")
etcdCr.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Running", ok, []string{etcdCr.typename, etcdCr.name, "-n", etcdCr.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("update operator")
sub.patch(oc, "{\"spec\": {\"channel\": \"beta\"}}")
sub.findInstalledCSV(oc, itName, dr)
errIP := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.currentCSV}").Output()
if err != nil {
return false, err
}
if strings.Contains(output, "etcdoperator.v0.9.4") {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(errIP, "operator does not change to etcdoperator.v0.9.4")
exutil.By("check schema does not work")
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, contain, "error validating existing CRs", ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].message}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
ffdc445b-5ae6-409c-a0b5-bce7e9e80327
|
Author:kuiwang-ConnectedOnly-Medium-25760-Operator upgrades does not fail after change the channel
|
['"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("Author:kuiwang-ConnectedOnly-Medium-25760-Operator upgrades does not fail after change the channel", func() {
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipForSNOCluster(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")
}
node, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("node", "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
err = exutil.SetNamespacePrivileged(oc, oc.Namespace())
o.Expect(err).NotTo(o.HaveOccurred())
efips, errFips := oc.AsAdmin().WithoutNamespace().Run("debug").Args("node/"+node, "--to-namespace="+oc.Namespace(), "--", "chroot", "/host", "fips-mode-setup", "--check").Output()
if errFips != nil || strings.Contains(efips, "FIPS mode is enabled") {
g.Skip("skip it without impacting function")
}
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-25760-operator",
namespace: "",
displayName: "Test Catsrc 25760 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginx-ok-index:vokv25760",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-ok-v25760",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-ok-v25760",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "nginx-ok-v25760.v0.0.1",
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("check csv")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("switch channel")
sub.patch(oc, "{\"spec\": {\"channel\": \"beta\"}}")
sub.findInstalledCSV(oc, itName, dr)
exutil.By("check csv of new channel")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
d17b32c6-e73e-4620-b86d-b3673cb69e5d
|
ConnectedOnly-Author:kuiwang-Medium-35895-can't install a CSV with duplicate roles
|
['"os"', '"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-35895-can't install a CSV with duplicate roles", 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.SkipForSNOCluster(oc)
platform := exutil.CheckPlatform(oc)
e2e.Logf("platform: %v", platform)
proxy, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("proxy", "cluster", "-o=jsonpath={.status.httpProxy}{.status.httpsProxy}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if proxy != "" || strings.Contains(platform, "openstack") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "none") ||
strings.Contains(platform, "vsphere") || strings.Contains(platform, "osp") || strings.Contains(platform, "ibmcloud") || strings.Contains(platform, "nutanix") ||
os.Getenv("HTTP_PROXY") != "" || os.Getenv("HTTPS_PROXY") != "" || os.Getenv("http_proxy") != "" || os.Getenv("https_proxy") != "" ||
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")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-35895-operator",
namespace: "",
displayName: "Test Catsrc 35895 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/olm-dep:vmtaduprol2-withCache",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "mta-operator",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "mta-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "windup-operator.0.0.5",
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("check csv")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("check sa")
newCheck("expect", asAdmin, withoutNamespace, contain, "windup-operator-haproxy", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={..serviceAccountName}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
7874a056-377b-4dcb-9d01-45e4aeb9160f
|
NonHyperShiftHOST-ConnectedOnly-Author:kuiwang-Medium-32863-Support resources required for SAP Gardener Control Plane Operator [Disruptive]
|
['"context"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', 'g "github.com/onsi/ginkgo/v2"', '"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-Medium-32863-Support resources required for SAP Gardener Control Plane Operator [Disruptive]", func() {
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipBaselineCaps(oc, "None")
exutil.SkipForSNOCluster(oc)
platform := exutil.CheckPlatform(oc)
e2e.Logf("platform: %v", platform)
proxy, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("proxy", "cluster", "-o=jsonpath={.status.httpProxy}{.status.httpsProxy}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if proxy != "" || strings.Contains(platform, "openstack") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "none") ||
strings.Contains(platform, "vsphere") || strings.Contains(platform, "external") || strings.Contains(platform, "osp") || 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")
vpaTemplate = filepath.Join(buildPruningBaseDir, "vpa-crd.yaml")
crdVpa = crdDescription{
name: "verticalpodautoscalers.autoscaling.k8s.io",
template: vpaTemplate,
}
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-32863-operator",
namespace: "",
displayName: "Test Catsrc 32863 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/single-bundle-index:pdb3",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "busybox",
namespace: "",
channel: "candidate-v2",
ipApproval: "Automatic",
operatorPackage: "busybox",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "busybox.v2.0.0",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
)
// defer crdVpa.delete(oc) //it is not needed in case it already exist
if isPresentResource(oc, asAdmin, withoutNamespace, notPresent, "crd", crdVpa.name) {
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 vpa crd")
crdVpa.create(oc, itName, dr)
defer crdVpa.delete(oc)
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("check csv")
err := wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 5*time.Minute, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status, "Succeeded") == 0 {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "csv busybox.v2.0.0 is not installed as expected")
exutil.By("check additional resources")
newCheck("present", asAdmin, withoutNamespace, present, "", ok, []string{"VerticalPodAutoscaler", "busybox-vpa", "-n", sub.namespace}).check(oc)
newCheck("present", asAdmin, withoutNamespace, present, "", ok, []string{"PriorityClass", "super-priority", "-n", sub.namespace}).check(oc)
newCheck("present", asAdmin, withoutNamespace, present, "", ok, []string{"PodDisruptionBudget", "busybox-pdb", "-n", sub.namespace}).check(oc)
}
})
| |||||
test case
|
openshift/openshift-tests-private
|
add6ab4a-3e80-4976-a67f-6f3f52b0db75
|
Author:kuiwang-ConnectedOnly-ROSA-OSD_CCS-ARO-Medium-34472-olm label dependency
|
['"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:kuiwang-ConnectedOnly-ROSA-OSD_CCS-ARO-Medium-34472-olm label dependency", 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-extract.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "olm-1933-v8-catalog",
namespace: "",
displayName: "OLM 1933 v8 Operator Catalog",
publisher: "QE",
sourceType: "grpc",
address: "quay.io/olmqe/olm-dep:v12",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "mta-operator",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "mta-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "windup-operator.0.0.5",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
dependentOperator = "nginx-ok1-1399.v0.0.5"
)
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("check if dependent operator is installed")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", dependentOperator, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
488bddbd-ce37-41c3-83a3-1a0bc8afb4dd
|
ConnectedOnly-Author:kuiwang-Medium-37263-Subscription stays in UpgradePending but InstallPlan not installing [Slow]
|
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', 'g "github.com/onsi/ginkgo/v2"', '"path/filepath"', '"strings"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("ConnectedOnly-Author:kuiwang-Medium-37263-Subscription stays in UpgradePending but InstallPlan not installing [Slow]", func() {
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-extract.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "olm-1860185-catalog",
namespace: "",
displayName: "OLM 1860185 Catalog",
publisher: "QE",
sourceType: "grpc",
address: "quay.io/olmqe/olm-dep:v1860185-v2-withCache",
template: catsrcImageTemplate,
}
catsrc1 = 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,
}
catsrc2 = catalogSourceDescription{
name: "catsrc-nginx-operator",
namespace: "",
displayName: "Test Catsrc Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginx-ok-index:v1399-fbc",
template: catsrcImageTemplate,
}
subStrimzi = subscriptionDescription{
subName: "strimzi",
namespace: "",
channel: "strimzi-0.23.x",
ipApproval: "Automatic",
operatorPackage: "strimzi-kafka-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "strimzi-cluster-operator.v0.23.0",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
subBuildv2 = subscriptionDescription{
subName: "nginx-ok1-1399",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-ok1-1399",
catalogSourceName: catsrc2.name,
catalogSourceNamespace: "",
startingCSV: "nginx-ok1-1399.v0.0.4",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
subMta = subscriptionDescription{
subName: "oadp-operator",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "oadp-operator",
catalogSourceName: catsrc1.name,
catalogSourceNamespace: "",
startingCSV: "",
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()
catsrc1.namespace = oc.Namespace()
catsrc2.namespace = oc.Namespace()
subStrimzi.namespace = oc.Namespace()
subStrimzi.catalogSourceNamespace = catsrc.namespace
subBuildv2.namespace = oc.Namespace()
subBuildv2.catalogSourceNamespace = catsrc2.namespace
subMta.namespace = oc.Namespace()
subMta.catalogSourceNamespace = catsrc1.namespace
exutil.By("create catalog source")
catsrc.createWithCheck(oc, itName, dr)
catsrc1.createWithCheck(oc, itName, dr)
catsrc2.createWithCheck(oc, itName, dr)
exutil.By("Create og")
og.create(oc, itName, dr)
exutil.By("install Strimzi")
subStrimzi.create(oc, itName, dr)
exutil.By("check if Strimzi is installed")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", subStrimzi.installedCSV, "-n", subStrimzi.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("install Portworx")
subMta.create(oc, itName, dr)
exutil.By("check if Portworx is installed")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", subMta.installedCSV, "-n", subMta.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("get IP of Portworx")
mtaIP := subMta.getIP(oc)
exutil.By("Delete Portworx sub")
subMta.delete(itName, dr)
exutil.By("check if Portworx sub is Deleted")
newCheck("present", asAdmin, withoutNamespace, notPresent, "", ok, []string{"sub", subMta.subName, "-n", subMta.namespace}).check(oc)
exutil.By("Delete Portworx csv")
csvPortworx := csvDescription{
name: subMta.installedCSV,
namespace: subMta.namespace,
}
csvPortworx.delete(itName, dr)
exutil.By("check if Portworx csv is Deleted")
newCheck("present", asAdmin, withoutNamespace, notPresent, "", ok, []string{"csv", subMta.installedCSV, "-n", subMta.namespace}).check(oc)
exutil.By("install Couchbase")
subBuildv2.create(oc, itName, dr)
exutil.By("get IP of Couchbase")
couchbaseIP := subBuildv2.getIP(oc)
exutil.By("it takes different IP")
o.Expect(couchbaseIP).NotTo(o.Equal(mtaIP))
})
| |||||
test case
|
openshift/openshift-tests-private
|
8560aa7c-bb40-4456-aa63-5149f2a97b1a
|
Author:kuiwang-NonHyperShiftHOST-ConnectedOnly-Medium-33176-Enable generated operator component adoption for operators with single ns mode [Slow]
|
['"context"', '"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-33176-Enable generated operator component adoption for operators with single ns mode [Slow]", 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")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
apiserviceImageTemplate = filepath.Join(buildPruningBaseDir, "apiservice.yaml")
apiserviceVersion = "v33176"
apiserviceName = apiserviceVersion + ".foos.bar.com"
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-33176-operator",
namespace: "",
displayName: "Test Catsrc 33176 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/olm-api:v5", // quay.io/olmqe/nginx-ok-index:vokv33176 as backup
template: catsrcImageTemplate,
}
subEtcd = subscriptionDescription{
subName: "etcd33176",
namespace: "",
channel: "singlenamespace-alpha",
ipApproval: "Automatic",
operatorPackage: "etcd",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "etcdoperator.v0.9.4", //get it from package based on currentCSV if ipApproval is Automatic
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: false,
}
subCockroachdb = subscriptionDescription{
subName: "cockroachdb33176",
namespace: "",
channel: "stable-5.x",
ipApproval: "Automatic",
operatorPackage: "cockroachdb",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "cockroachdb.v5.0.4", //get it from package based on currentCSV if ipApproval is Automatic
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: false,
}
)
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()
subEtcd.namespace = oc.Namespace()
subEtcd.catalogSourceNamespace = catsrc.namespace
subCockroachdb.namespace = oc.Namespace()
subCockroachdb.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 Etcd")
subEtcd.create(oc, itName, dr)
defer doAction(oc, "delete", asAdmin, withoutNamespace, "operator.operators.coreos.com", subEtcd.operatorPackage+"."+subEtcd.namespace)
exutil.By("Check all resources via operators")
newCheck("expect", asAdmin, withoutNamespace, contain, "ServiceAccount", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "Role", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "RoleBinding", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "CustomResourceDefinition", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "Subscription", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "InstallPlan", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "ClusterServiceVersion", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "Deployment", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, subEtcd.namespace, ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='ClusterServiceVersion')].namespace}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "InstallSucceeded", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='ClusterServiceVersion')].conditions[*].reason}"}).check(oc)
exutil.By("delete operator and Operator still exists because of crd")
subEtcd.delete(itName, dr)
_, err := doAction(oc, "delete", asAdmin, withoutNamespace, "csv", subEtcd.installedCSV, "-n", subEtcd.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
newCheck("expect", asAdmin, withoutNamespace, contain, "CustomResourceDefinition", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
exutil.By("reinstall etcd and check Operator")
subEtcd.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, contain, "InstallSucceeded", ok, []string{"operator.operators.coreos.com", subEtcd.operatorPackage + "." + subEtcd.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='ClusterServiceVersion')].conditions[*].reason}"}).check(oc)
exutil.By("delete etcd and the Operator again and Operator should recreated because of crd")
_, err = doAction(oc, "delete", asAdmin, withoutNamespace, "sub", subEtcd.subName, "-n", subEtcd.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "delete", asAdmin, withoutNamespace, "csv", subEtcd.installedCSV, "-n", subEtcd.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "delete", asAdmin, withoutNamespace, "operator.operators.coreos.com", subEtcd.operatorPackage+"."+subEtcd.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
// here there is issue and take WA
_, err = doAction(oc, "label", asAdmin, withoutNamespace, "crd", "etcdbackups.etcd.database.coreos.com", "operators.coreos.com/"+subEtcd.operatorPackage+"."+subEtcd.namespace+"-")
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "label", asAdmin, withoutNamespace, "crd", "etcdbackups.etcd.database.coreos.com", "operators.coreos.com/"+subEtcd.operatorPackage+"."+subEtcd.namespace+"=")
o.Expect(err).NotTo(o.HaveOccurred())
//done for WA
var componentKind string
err = wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 240*time.Second, false, func(ctx context.Context) (bool, error) {
componentKind = getResource(oc, asAdmin, withoutNamespace, "operator.operators.coreos.com", subEtcd.operatorPackage+"."+subEtcd.namespace, "-o=jsonpath={.status.components.refs[*].kind}")
if strings.Contains(componentKind, "CustomResourceDefinition") {
return true, nil
}
e2e.Logf("the got kind is %v", componentKind)
return false, nil
})
if err != nil && strings.Compare(componentKind, "") != 0 {
e2e.Failf("the operator has wrong component")
// after the official is supported, will change it again.
}
exutil.By("install Cockroachdb")
subCockroachdb.create(oc, itName, dr)
defer doAction(oc, "delete", asAdmin, withoutNamespace, "operator.operators.coreos.com", subCockroachdb.operatorPackage+"."+subCockroachdb.namespace)
exutil.By("Check all resources of Cockroachdb via operators")
newCheck("expect", asAdmin, withoutNamespace, contain, "Role", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "RoleBinding", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "CustomResourceDefinition", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "Subscription", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "InstallPlan", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "ClusterServiceVersion", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "Deployment", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, subCockroachdb.namespace, ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='ClusterServiceVersion')].namespace}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "InstallSucceeded", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='ClusterServiceVersion')].conditions[*].reason}"}).check(oc)
exutil.By("create ns test-33176 and label it")
_, err = doAction(oc, "create", asAdmin, withoutNamespace, "ns", "test-33176")
o.Expect(err).NotTo(o.HaveOccurred())
defer doAction(oc, "delete", asAdmin, withoutNamespace, "ns", "test-33176", "--force", "--grace-period=0", "--wait=false")
_, err = doAction(oc, "label", asAdmin, withoutNamespace, "ns", "test-33176", "operators.coreos.com/"+subCockroachdb.operatorPackage+"."+subCockroachdb.namespace+"=")
o.Expect(err).NotTo(o.HaveOccurred())
newCheck("expect", asAdmin, withoutNamespace, contain, "Namespace", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
exutil.By("create apiservice and label it")
err = applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", apiserviceImageTemplate, "-p", "NAME="+apiserviceName, "VERSION="+apiserviceVersion)
o.Expect(err).NotTo(o.HaveOccurred())
defer doAction(oc, "delete", asAdmin, withoutNamespace, "apiservice", apiserviceName)
_, err = doAction(oc, "label", asAdmin, withoutNamespace, "apiservice", apiserviceName,
"operators.coreos.com/"+subCockroachdb.operatorPackage+"."+subCockroachdb.namespace+"=")
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "label", asAdmin, withoutNamespace, "apiservice", apiserviceName,
"olm.managed="+`true`)
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "label", asAdmin, withoutNamespace, "apiservice", apiserviceName,
"olm.owner"+"="+subCockroachdb.installedCSV)
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "label", asAdmin, withoutNamespace, "apiservice", apiserviceName,
"olm.owner.kind"+"="+"ClusterServiceVersion")
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "label", asAdmin, withoutNamespace, "apiservice", apiserviceName,
"olm.owner.namespace"+"="+subCockroachdb.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
newCheck("expect", asAdmin, withoutNamespace, contain, "APIService", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
a9315c62-2602-498f-9eef-bf969ed047d6
|
ConnectedOnly-Author:kuiwang-Medium-39897-operator objects should not be recreated after all other associated resources have been deleted [Serial]
|
['"context"', '"os"', '"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:kuiwang-Medium-39897-operator objects should not be recreated after all other associated resources have been deleted [Serial]", 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, "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")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-39897-operator",
namespace: "",
displayName: "Test Catsrc 39897 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/mta-index:v0.0.6-withCache",
template: catsrcImageTemplate,
}
subMta = subscriptionDescription{
subName: "mta-operator",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "mta-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "windup-operator.0.0.5", //get it from package based on currentCSV if ipApproval is Automatic
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: false,
}
crd = crdDescription{
name: "windups.windup.jboss.org",
}
)
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()
subMta.namespace = oc.Namespace()
subMta.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 Teiid")
subMta.create(oc, itName, dr)
defer doAction(oc, "delete", asAdmin, withoutNamespace, "operator.operators.coreos.com", subMta.operatorPackage+"."+subMta.namespace)
exutil.By("Check the resources via operators")
newCheck("expect", asAdmin, withoutNamespace, contain, "CustomResourceDefinition", ok, []string{"operator.operators.coreos.com", subMta.operatorPackage + "." + subMta.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
exutil.By("delete operator and Operator still exists because of crd")
subMta.delete(itName, dr)
_, err := doAction(oc, "delete", asAdmin, withoutNamespace, "csv", subMta.installedCSV, "-n", subMta.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
newCheck("expect", asAdmin, withoutNamespace, contain, "CustomResourceDefinition", ok, []string{"operator.operators.coreos.com", subMta.operatorPackage + "." + subMta.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
exutil.By("delete crd")
crd.delete(oc)
exutil.By("delete Operator resource to check if it is recreated")
doAction(oc, "delete", asAdmin, withoutNamespace, "operator.operators.coreos.com", subMta.operatorPackage+"."+subMta.namespace)
newCheck("present", asAdmin, withoutNamespace, notPresent, "", ok, []string{"operator.operators.coreos.com", subMta.operatorPackage + "." + subMta.namespace}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
1e460c9d-bd82-4ea4-a44f-5cf0db06515a
|
Author:kuiwang-ConnectedOnly-ROSA-OSD_CCS-ARO-Medium-50135-automatic upgrade for failed operator installation og created correctly
|
['"path/filepath"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("Author:kuiwang-ConnectedOnly-ROSA-OSD_CCS-ARO-Medium-50135-automatic upgrade for failed operator installation og created correctly", func() {
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
ogAllTemplate = filepath.Join(buildPruningBaseDir, "og-allns.yaml")
ogUpgradeStrategyTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup-upgradestrategy.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
ogAll = operatorGroupDescription{
name: "og-all",
namespace: "",
template: ogAllTemplate,
}
ogDefault = operatorGroupDescription{
name: "og-default",
namespace: "",
upgradeStrategy: "Default",
template: ogUpgradeStrategyTemplate,
}
ogFailForward = operatorGroupDescription{
name: "og-failforwad",
namespace: "",
upgradeStrategy: "TechPreviewUnsafeFailForward",
template: ogUpgradeStrategyTemplate,
}
ogFoo = operatorGroupDescription{
name: "og-foo",
namespace: "",
upgradeStrategy: "foo",
template: ogUpgradeStrategyTemplate,
}
)
oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach
ns := oc.Namespace()
og.namespace = ns
ogAll.namespace = ns
ogDefault.namespace = ns
ogFailForward.namespace = ns
ogFoo.namespace = ns
exutil.By("Create og")
og.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Default", ok, []string{"og", og.name, "-n", og.namespace, "-o=jsonpath={.spec.upgradeStrategy}"}).check(oc)
og.delete(itName, dr)
exutil.By("Create og all")
ogAll.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Default", ok, []string{"og", ogAll.name, "-n", ogAll.namespace, "-o=jsonpath={.spec.upgradeStrategy}"}).check(oc)
ogAll.delete(itName, dr)
exutil.By("Create og Default")
ogDefault.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Default", ok, []string{"og", ogDefault.name, "-n", ogDefault.namespace, "-o=jsonpath={.spec.upgradeStrategy}"}).check(oc)
ogDefault.delete(itName, dr)
exutil.By("Create og failforward")
ogFailForward.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "TechPreviewUnsafeFailForward", ok, []string{"og", ogFailForward.name, "-n", ogFailForward.namespace, "-o=jsonpath={.spec.upgradeStrategy}"}).check(oc)
ogFailForward.delete(itName, dr)
exutil.By("Create og all")
err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", ogFoo.template, "-p", "NAME="+ogFoo.name, "NAMESPACE="+ogFoo.namespace, "UPGRADESTRATEGY="+ogFoo.upgradeStrategy)
o.Expect(err).To(o.HaveOccurred())
o.Expect(err.Error()).To(o.ContainSubstring("exit status 1"))
})
| |||||
test case
|
openshift/openshift-tests-private
|
b3cf0e73-93f6-4910-931a-6baf288062e1
|
Longduration-NonPreRelease-ConnectedOnly-Author:kuiwang-Medium-50136-automatic upgrade for failed operator installation csv fails
|
['"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("Longduration-NonPreRelease-ConnectedOnly-Author:kuiwang-Medium-50136-automatic upgrade for failed operator installation csv fails", func() {
architecture.SkipNonAmd64SingleArch(oc)
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-2378-operator",
namespace: "",
displayName: "Test Catsrc 2378 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/olm-index:OLM-2378-Oadp-GoodOne-multi",
template: catsrcImageTemplate,
}
subOadp = subscriptionDescription{
subName: "oadp-operator",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "oadp-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "oadp-operator.v0.5.3",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
)
oc.SetupProject()
og.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
subOadp.namespace = oc.Namespace()
subOadp.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 OADP")
subOadp.create(oc, itName, dr)
exutil.By("Check the oadp-operator.v0.5.3 is installed successfully")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", subOadp.installedCSV, "-n", subOadp.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("patch to index image with wrong bundle csv fails")
err := oc.AsAdmin().WithoutNamespace().Run("patch").Args("catsrc", catsrc.name, "-n", catsrc.namespace, "--type=merge", "-p", "{\"spec\":{\"image\":\"quay.io/olmqe/olm-index:OLM-2378-Oadp-csvfail-multi\"}}").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
newCheck("expect", asAdmin, withoutNamespace, compare, "oadp-operator.v0.5.4", ok, []string{"sub", subOadp.subName, "-n", subOadp.namespace, "-o=jsonpath={.status.currentCSV}"}).check(oc)
exutil.By("check the csv fails")
var status string
// it fails after 10m which we can not control it. so, have to check it in 11m
err = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 15*time.Minute, false, func(ctx context.Context) (bool, error) {
status = getResource(oc, asAdmin, withoutNamespace, "csv", "oadp-operator.v0.5.4", "-n", subOadp.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status, "Failed") == 0 {
e2e.Logf("csv oadp-operator.v0.5.4 fails expected")
return true, nil
}
return false, nil
})
if strings.Contains(status, "nstalling") {
return
}
exutil.AssertWaitPollNoErr(err, "csv oadp-operator.v0.5.4 is not failing as expected")
exutil.By("change upgrade strategy to TechPreviewUnsafeFailForward")
err = oc.AsAdmin().WithoutNamespace().Run("patch").Args("og", og.name, "-n", og.namespace, "--type=merge", "-p", "{\"spec\":{\"upgradeStrategy\":\"TechPreviewUnsafeFailForward\"}}").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("check if oadp-operator.v0.5.6 is created ")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
csv := getResource(oc, asAdmin, withoutNamespace, "sub", subOadp.subName, "-n", subOadp.namespace, "-o=jsonpath={.status.currentCSV}")
if strings.Compare(csv, "oadp-operator.v0.5.6") == 0 {
e2e.Logf("csv %v is created", csv)
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "csv oadp-operator.v0.5.6 is not created")
exutil.By("check if upgrade is done")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", "oadp-operator.v0.5.6", "-n", subOadp.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status, "Succeeded") == 0 {
e2e.Logf("csv oadp-operator.v0.5.6 is successful")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "csv oadp-operator.v0.5.6 is not successful")
})
| |||||
test case
|
openshift/openshift-tests-private
|
0172f0fe-4f83-4951-b83f-e63c9e279bb7
|
ConnectedOnly-Author:kuiwang-Medium-50138-automatic upgrade for failed operator installation ip fails
|
['"context"', '"fmt"', '"os"', '"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:kuiwang-Medium-50138-automatic upgrade for failed operator installation ip fails", func() {
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")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-2378-operator",
namespace: "",
displayName: "Test Catsrc 2378 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/olm-index:OLM-2378-Oadp-GoodOne-multi",
template: catsrcImageTemplate,
}
subOadp = subscriptionDescription{
subName: "oadp-operator",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "oadp-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "oadp-operator.v0.5.3",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
)
oc.SetupProject()
og.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
subOadp.namespace = oc.Namespace()
subOadp.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 OADP")
subOadp.create(oc, itName, dr)
exutil.By("Check the oadp-operator.v0.5.3 is installed successfully")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", subOadp.installedCSV, "-n", subOadp.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("patch to index image with wrong bundle ip fails")
err = oc.AsAdmin().WithoutNamespace().Run("patch").Args("catsrc", catsrc.name, "-n", catsrc.namespace, "--type=merge", "-p", "{\"spec\":{\"image\":\"quay.io/olmqe/olm-index:OLM-2378-Oadp-ipfailTwo-multi\"}}").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
newCheck("expect", asAdmin, withoutNamespace, compare, "oadp-operator.v0.5.5", ok, []string{"sub", subOadp.subName, "-n", subOadp.namespace, "-o=jsonpath={.status.currentCSV}"}).check(oc)
exutil.By("check the ip fails")
ips := getResource(oc, asAdmin, withoutNamespace, "sub", subOadp.subName, "-n", subOadp.namespace, "-o=jsonpath={.status.installplan.name}")
o.Expect(ips).NotTo(o.BeEmpty())
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "installplan", ips, "-n", subOadp.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status, "Failed") == 0 {
e2e.Logf("ip %v fails expected", ips)
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("ip %v not failing as expected", ips))
exutil.By("change upgrade strategy to TechPreviewUnsafeFailForward")
err = oc.AsAdmin().WithoutNamespace().Run("patch").Args("og", og.name, "-n", og.namespace, "--type=merge", "-p", "{\"spec\":{\"upgradeStrategy\":\"TechPreviewUnsafeFailForward\"}}").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("patch to index image again with fixed bundle")
err = oc.AsAdmin().WithoutNamespace().Run("patch").Args("catsrc", catsrc.name, "-n", catsrc.namespace, "--type=merge", "-p", "{\"spec\":{\"image\":\"quay.io/olmqe/olm-index:OLM-2378-Oadp-ipfailskip-multi\"}}").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
csv := getResource(oc, asAdmin, withoutNamespace, "sub", subOadp.subName, "-n", subOadp.namespace, "-o=jsonpath={.status.currentCSV}")
if strings.Compare(csv, "oadp-operator.v0.5.6") == 0 {
e2e.Logf("csv %v is created", csv)
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "csv oadp-operator.v0.5.6 is not created")
exutil.By("check if upgrade is done")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", "oadp-operator.v0.5.6", "-n", subOadp.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status, "Succeeded") == 0 {
e2e.Logf("csv oadp-operator.v0.5.6 is successful")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "csv oadp-operator.v0.5.6 is not successful")
})
| |||||
test case
|
openshift/openshift-tests-private
|
e5b9d38d-479e-4aab-8002-77e851744aa4
|
Author:bandrade-Medium-24917-Operators in SingleNamespace should not be granted namespace list [Disruptive]
|
['"context"', '"fmt"', '"path/filepath"', '"strings"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("Author:bandrade-Medium-24917-Operators in SingleNamespace should not be granted namespace list [Disruptive]", 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-24917",
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-24917",
namespace: oc.Namespace(),
catalogSourceName: "qe-app-registry",
catalogSourceNamespace: "openshift-marketplace",
ipApproval: "Automatic",
channel: "beta",
operatorPackage: "learn",
singleNamespace: true,
template: subTemplate,
}
exists, err := clusterPackageExists(oc, sub)
o.Expect(err).NotTo(o.HaveOccurred())
if !exists {
g.Skip("SKIP:PackageMissing learn does not exist in catalog qe-app-registry")
}
defer sub.delete(itName, dr)
defer sub.deleteCSV(itName, dr)
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "AtLatestKnown", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.state}"}).check(oc)
exutil.By("3) check if this operator's SA can list all namespaces")
expectedSA := fmt.Sprintf("system:serviceaccount:%s:learn-operator", oc.Namespace())
msg, err := oc.AsAdmin().WithoutNamespace().Run("policy").Args("who-can", "list", "namespaces").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(strings.Contains(msg, expectedSA)).To(o.BeFalse())
exutil.By("4) get the token of this operator's SA")
token, err := getSAToken(oc, "learn-operator", oc.Namespace())
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("5) get the cluster server")
server, err := oc.AsAdmin().WithoutNamespace().Run("whoami").Args("--show-server").Output()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("6) get the current context")
context, err := oc.AsAdmin().WithoutNamespace().Run("whoami").Args("--show-context").Output()
o.Expect(err).NotTo(o.HaveOccurred())
// make sure switch to the current cluster-admin role after finished
defer func() {
exutil.By("9) Switch to the cluster-admin role")
_, err := oc.AsAdmin().WithoutNamespace().Run("config").Args("use-context", context).Output()
o.Expect(err).NotTo(o.HaveOccurred())
}()
exutil.By("7) login the cluster with this token")
_, err = oc.AsAdmin().WithoutNamespace().Run("login").Args(server, "--token", token).Output()
o.Expect(err).NotTo(o.HaveOccurred())
whoami, err := oc.AsAdmin().WithoutNamespace().Run("whoami").Args("").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(strings.Contains(whoami, expectedSA)).To(o.BeTrue())
exutil.By("8) this SA user should NOT have the permission to list all namespaces")
ns, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("ns").Output()
o.Expect(strings.Contains(ns, "namespaces is forbidden")).To(o.BeTrue())
})
| |||||
test case
|
openshift/openshift-tests-private
|
bcda9aa3-9900-4e09-8942-c21c2c676cc3
|
Author:scolange-Medium-25782-CatalogSource Status should have information on last observed state
|
['"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:scolange-Medium-25782-CatalogSource Status should have information on last observed state", func() {
var err error
var (
catName = "installed-community-25782-global-operators"
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
// the namespace and catName are hardcoded in the files
cmTemplate = filepath.Join(buildPruningBaseDir, "cm-csv-etcd.yaml")
catsrcCmTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-configmap.yaml")
)
oc.SetupProject()
itName := g.CurrentSpecReport().FullText()
var (
cm = configMapDescription{
name: catName,
namespace: oc.Namespace(),
template: cmTemplate,
}
catsrc = catalogSourceDescription{
name: catName,
namespace: oc.Namespace(),
displayName: "Community bad Operators",
publisher: "QE",
sourceType: "configmap",
address: catName,
template: catsrcCmTemplate,
}
)
exutil.By("Create ConfigMap with bad operator manifest")
cm.create(oc, itName, dr)
// Make sure bad configmap was created
exutil.By("Check configmap")
msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cm", "-n", oc.Namespace()).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(strings.Contains(msg, catName)).To(o.BeTrue())
exutil.By("Create catalog source")
catsrc.create(oc, itName, dr)
exutil.By("Wait for pod to fail")
waitErr := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", oc.Namespace()).Output()
e2e.Logf("\n%v", msg)
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(msg, "CrashLoopBackOff") {
e2e.Logf("STEP pod is in CrashLoopBackOff as expected")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(waitErr, "the pod is not in CrashLoopBackOff")
exutil.By("Check catsrc state for TRANSIENT_FAILURE in lastObservedState")
waitErr = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", catName, "-n", oc.Namespace(), "-o=jsonpath={.status}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(msg, "TRANSIENT_FAILURE") && strings.Contains(msg, "lastObservedState") {
msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", catName, "-n", oc.Namespace(), "-o=jsonpath={.status.connectionState.lastObservedState}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("catalogsource had lastObservedState = %v as expected ", msg)
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(waitErr, fmt.Sprintf("catalogsource %s is not TRANSIENT_FAILURE", catName))
e2e.Logf("cleaning up")
})
| |||||
test case
|
openshift/openshift-tests-private
|
1c1952a9-a205-4810-9207-79f2b1262ead
|
Author:scolange-DEPRECATED-ConnectedOnly-Medium-24738-CRD should update if previously defined schemas do not change [Disruptive]
|
['"context"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"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-DEPRECATED-ConnectedOnly-Medium-24738-CRD should update if previously defined schemas do not change [Disruptive]", func() {
architecture.SkipNonAmd64SingleArch(oc)
var buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
var cmTemplate = filepath.Join(buildPruningBaseDir, "configmap-etcd.yaml")
var patchCfgMap = filepath.Join(buildPruningBaseDir, "configmap-ectd-alpha-beta.yaml")
var catsrcCmTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-configmap.yaml")
var subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
var etcdCluster = filepath.Join(buildPruningBaseDir, "etcd-cluster.yaml")
var ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
var operatorWait = 150 * time.Second
exutil.By("check precondition and prepare env")
if isPresentResource(oc, asAdmin, withoutNamespace, present, "crd", "etcdclusters.etcd.database.coreos.com") && isPresentResource(oc, asAdmin, withoutNamespace, present, "EtcdCluster", "-A") {
e2e.Logf("It is distruptive case and the resources exists, do not destroy it. exit")
return
}
var (
cmName = "cm-24738"
catsrcName = "operators-24738"
cm = configMapDescription{
name: cmName,
namespace: "openshift-marketplace",
template: cmTemplate,
}
catsrc = catalogSourceDescription{
name: catsrcName,
namespace: "openshift-marketplace",
displayName: "Community 24738 Operators",
publisher: "QE",
sourceType: "configmap",
address: cmName,
template: catsrcCmTemplate,
}
og = operatorGroupDescription{
name: "og-24738",
namespace: "",
template: ogSingleTemplate,
}
sub = subscriptionDescription{
subName: "sub-24738",
namespace: "",
catalogSourceName: catsrcName,
catalogSourceNamespace: "openshift-marketplace",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "etcd-update",
template: subTemplate,
}
etcdCr = customResourceDescription{
name: "example-24738",
namespace: "",
typename: "EtcdCluster",
template: etcdCluster,
}
og1 = operatorGroupDescription{
name: "og-24738",
namespace: "",
template: ogSingleTemplate,
}
sub1 = subscriptionDescription{
subName: "sub-24738-1",
namespace: "",
catalogSourceName: catsrcName,
catalogSourceNamespace: "openshift-marketplace",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "etcd-update",
template: subTemplate,
}
etcdCr1 = customResourceDescription{
name: "example-24738-1",
namespace: "",
typename: "EtcdCluster",
template: etcdCluster,
}
)
oc.AsAdmin().Run("delete").Args("crd", "etcdclusters.etcd.database.coreos.com").Output()
oc.AsAdmin().Run("delete").Args("crd", "etcdbackups.etcd.database.coreos.com").Output()
oc.AsAdmin().Run("delete").Args("crd", "etcdrestores.etcd.database.coreos.com").Output()
defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("configmap", cmName, "-n", "openshift-marketplace").Execute()
defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("catalogsource", catsrcName, "-n", "openshift-marketplace").Execute()
oc.SetupProject()
exutil.By("create new namespace " + oc.Namespace())
itName := g.CurrentSpecReport().FullText()
og.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
etcdCr.namespace = oc.Namespace()
exutil.By("Create ConfigMap with operator manifest")
cm.create(oc, itName, dr)
exutil.By("Check configmap")
msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cm", "-n", cm.namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(strings.Contains(msg, cmName)).To(o.BeTrue())
exutil.By("Create catalog source")
catsrc.create(oc, itName, dr)
err = wait.PollUntilContextTimeout(context.TODO(), 60*time.Second, operatorWait, false, func(ctx context.Context) (bool, error) {
checkCatSource, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", catsrcName, "-n", catsrc.namespace, "-o", "jsonpath={.status.connectionState.lastObservedState}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if checkCatSource == "READY" {
e2e.Logf("Installed catalogsource")
return true, nil
}
e2e.Logf("FAIL - Installed catalogsource ")
return false, nil
})
if err != nil {
catsrcStatus, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", catsrcName, "-n", catsrc.namespace, "-o", "jsonpath={.status}").Output()
e2e.Logf("catsrcStatus is %s", catsrcStatus)
}
exutil.AssertWaitPollNoErr(err, catsrcName+" is not READY")
exutil.By("Create og")
og.createwithCheck(oc, itName, dr)
exutil.By("Install the etcdoperator v0.9.2 with Automatic approval")
defer func() {
oc.AsAdmin().Run("delete").Args("crd", "etcdclusters.etcd.database.coreos.com").Output()
oc.AsAdmin().Run("delete").Args("crd", "etcdbackups.etcd.database.coreos.com").Output()
oc.AsAdmin().Run("delete").Args("crd", "etcdrestores.etcd.database.coreos.com").Output()
}()
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.2", "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("creat cr")
etcdCr.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Running", ok, []string{etcdCr.typename, etcdCr.name, "-n", etcdCr.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
oc.SetupProject()
exutil.By("create new namespace " + oc.Namespace())
itName = g.CurrentSpecReport().FullText()
og1.namespace = oc.Namespace()
sub1.namespace = oc.Namespace()
etcdCr1.namespace = oc.Namespace()
exutil.By("Create og")
og1.createwithCheck(oc, itName, dr)
exutil.By("Create sub")
sub1.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.2", "-n", sub1.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("creat etcd cr in namespace test-automation-24738-1")
etcdCr1.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Running", ok, []string{etcdCr1.typename, etcdCr1.name, "-n", etcdCr1.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("update ConfigMap")
cm.template = patchCfgMap
cm.create(oc, itName, dr)
patchIP, err2 := oc.AsAdmin().WithoutNamespace().Run("patch").Args("sub", sub1.subName, "-n", sub1.namespace, "--type=json", "-p", "[{\"op\": \"replace\" , \"path\" : \"/spec/channel\", \"value\":beta}]").Output()
e2e.Logf(patchIP)
o.Expect(err2).NotTo(o.HaveOccurred())
o.Expect(patchIP).To(o.ContainSubstring("patched"))
err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) {
ips := getResource(oc, asAdmin, withoutNamespace, "installplan", "-n", sub1.namespace)
if strings.Contains(ips, "etcdoperator.v0.9.4") {
e2e.Logf("Install plan for etcdoperator.v0.9.4 is created")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "no install plan for ditto-operator.v0.1.1")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.4", "-n", sub1.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
33f09612-c97b-4c7d-aba9-1bca9996a7e0
|
NonHyperShiftHOST-ConnectedOnly-Author:bandrade-Medium-25644-OLM collect CSV health per version
|
['"context"', '"fmt"', '"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:bandrade-Medium-25644-OLM collect CSV health per version", func() {
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipIfDisableDefaultCatalogsource(oc)
exutil.SkipBaselineCaps(oc, "None")
var err error
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
ogAllTemplate = filepath.Join(buildPruningBaseDir, "og-allns.yaml")
subFile = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
csvName = "etcdoperator.v0.9.4"
next = false
ogName = "test-25644-group"
)
oc.SetupProject()
og := operatorGroupDescription{
name: ogName,
namespace: oc.Namespace(),
template: ogTemplate,
}
ogAll := operatorGroupDescription{
name: ogName,
namespace: oc.Namespace(),
template: ogAllTemplate,
}
sub := subscriptionDescription{
subName: "sub-25644",
namespace: oc.Namespace(),
catalogSourceName: "community-operators",
catalogSourceNamespace: "openshift-marketplace",
ipApproval: "Automatic",
template: subFile,
channel: "singlenamespace-alpha",
operatorPackage: "etcd",
startingCSV: "etcdoperator.v0.9.4",
singleNamespace: true,
}
exutil.By("Create cluster-scoped OperatorGroup")
ogAll.create(oc, itName, dr)
msg, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("og", "-n", oc.Namespace()).Output()
e2e.Logf("og: %v, %v", msg, og.name)
exutil.By("Subscribe to etcd operator and wait for the csv to fail")
// CSV should fail && show fail. oc describe csv xyz will have error
defer sub.delete(itName, dr)
defer sub.deleteCSV(itName, dr)
sub.createWithoutCheck(oc, itName, dr)
// find the CSV so that it can be delete after finished
sub.findInstalledCSV(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Failed", ok, []string{"csv", csvName, "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc)
msg, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace(), csvName, "-o=jsonpath={.status.conditions..reason}").Output()
e2e.Logf("--> get the csv reason: %v ", msg)
o.Expect(strings.Contains(msg, "UnsupportedOperatorGroup") || strings.Contains(msg, "NoOperatorGroup")).To(o.BeTrue())
msg, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace(), csvName, "-o=jsonpath={.status.conditions..message}").Output()
e2e.Logf("--> get the csv message: %v\n", msg)
o.Expect(strings.Contains(msg, "InstallModeType not supported") || strings.Contains(msg, "csv in namespace with no operatorgroup")).To(o.BeTrue())
exutil.By("Get prometheus token")
olmToken, err := exutil.GetSAToken(oc)
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmToken).NotTo(o.BeEmpty())
exutil.By("get OLM pod name")
olmPodname, 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(olmPodname).NotTo(o.BeEmpty())
exutil.By("check metrics")
waitErr := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) {
next = false
metrics, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args(olmPodname, "-n", "openshift-operator-lifecycle-manager", "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", olmToken), "https://localhost:8443/metrics").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(metrics).NotTo(o.BeEmpty())
var metricsVal, metricsVar string
for _, s := range strings.Fields(metrics) {
if next {
metricsVal = s
break
}
if strings.Contains(s, "csv_abnormal{") && strings.Contains(s, csvName) && strings.Contains(s, oc.Namespace()) {
metricsVar = s
next = true
}
}
e2e.Logf("\nMetrics\n %v == %v\n", metricsVar, metricsVal)
if metricsVal != "" {
e2e.Logf("csv_abnormal metric is created")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(waitErr, "csv_abnormal metric is not created")
exutil.By("reset og to single namespace")
og.delete(itName, dr)
msg, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("og", "-n", oc.Namespace()).Output()
e2e.Logf("og deleted:%v", msg)
og.create(oc, itName, dr)
msg, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("og", "-n", oc.Namespace(), "--no-headers").Output()
e2e.Logf("og created:%v", msg)
exutil.By("Wait for csv to recreate and ready")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.4", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc)
msg, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace(), csvName, "-o=jsonpath={.status.reason}").Output()
e2e.Logf("--> get the csv reason: %v ", msg)
o.Expect(strings.Contains(msg, "InstallSucceeded")).To(o.BeTrue())
msg, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-n", oc.Namespace(), csvName, "-o=jsonpath={.status.message}").Output()
e2e.Logf("--> get the csv message: %v\n", msg)
o.Expect(strings.Contains(msg, "completed with no errors")).To(o.BeTrue())
exutil.By("Make sure pods are fully running")
waitErr = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", oc.Namespace()).Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(msg, "etcd-operator") && strings.Contains(msg, "Running") && strings.Contains(msg, "3/3") {
return true, nil
}
return false, nil
})
e2e.Logf("\nPods\n%v", msg)
exutil.AssertWaitPollNoErr(waitErr, "etcd-operator pod is not running as 3")
exutil.By("check new metrics")
waitErr = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) {
next = false
metrics, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args(olmPodname, "-n", "openshift-operator-lifecycle-manager", "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", olmToken), "https://localhost:8443/metrics").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(metrics).NotTo(o.BeEmpty())
var metricsVal, metricsVar string
for _, s := range strings.Fields(metrics) {
if next {
metricsVal = s
break
}
if strings.Contains(s, "csv_succeeded{") && strings.Contains(s, csvName) && strings.Contains(s, oc.Namespace()) {
metricsVar = s
next = true
}
}
e2e.Logf("\nMetrics\n %v == %v\n", metricsVar, metricsVal)
if metricsVal != "" {
e2e.Logf("csv_succeeded metric is created")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(waitErr, "csv_succeeded metric is not created")
exutil.By("SUCCESS")
})
| |||||
test case
|
openshift/openshift-tests-private
|
f2ad3625-f995-4f1b-8a44-8c65d20c84f5
|
ConnectedOnly-Author:xzha-High-29809-can complete automatical updates based on replaces
|
['"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:xzha-High-29809-can complete automatical updates based on replaces", func() {
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-29809",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-29809",
namespace: "",
displayName: "Test Catsrc 29809 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginxolm-operator-index:v1",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-operator-29809",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
template: subTemplate,
singleNamespace: true,
startingCSV: "nginx-operator.v0.0.1",
}
)
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 og")
og.create(oc, itName, dr)
exutil.By("create catalog source")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator")
defer sub.delete(itName, dr)
sub.create(oc, itName, dr)
exutil.By("check the operator upgrade to nginx-operator.v0.0.1")
err := wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 480*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", sub.namespace, "csv", "nginx-operator.v1.0.1", "-o=jsonpath={.spec.replaces}").Output()
e2e.Logf(output)
if err != nil {
e2e.Logf("The csv is not created, error:%v", err)
return false, nil
}
if strings.Contains(output, "nginx-operator.v0.0.1") {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "nginx-operator.v1.0.1 does not replace nginx-operator.v0.0.1")
})
| |||||
test case
|
openshift/openshift-tests-private
|
e0827c18-5cb2-42e4-9e02-2ba128e2550c
|
ConnectedOnly-Author:xzha-Medium-30312-can allow admission webhook definitions in CSV
|
['"context"', '"fmt"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', 'g "github.com/onsi/ginkgo/v2"', '"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("ConnectedOnly-Author:xzha-Medium-30312-can allow admission webhook definitions in CSV", 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-30312",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-30312",
namespace: "",
displayName: "Test Catsrc 30312 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginx-operator-index-30312:v2-cache",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-operator-30312",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator-30312",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
template: subTemplate,
}
)
oc.SetupProject()
ns := oc.Namespace()
og.namespace = ns
sub.namespace = ns
catsrc.namespace = ns
sub.catalogSourceNamespace = ns
exutil.By("create og")
og.create(oc, itName, dr)
exutil.By("create catalog source")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator")
defer sub.delete(itName, dr)
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
err := wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
err := oc.AsAdmin().WithoutNamespace().Run("get").Args("validatingwebhookconfiguration", "-l", "olm.owner.namespace="+ns).Execute()
if err != nil {
e2e.Logf("The validatingwebhookconfiguration is not created:%v", err)
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("validatingwebhookconfiguration which owner ns %s is not created", ns))
exutil.By("update csv")
_, err1 := oc.AsAdmin().WithoutNamespace().Run("patch").Args("csv", sub.installedCSV, "-n", ns,
"--type=json", "--patch", `[{"op":"replace","path":"/spec/webhookdefinitions/0/rules/0/operations", "value":["CREATE","DELETE"]}]`).Output()
o.Expect(err1).NotTo(o.HaveOccurred())
validatingwebhookName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("validatingwebhookconfiguration", "-l", "olm.owner.namespace="+ns, "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
err = wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("validatingwebhookconfiguration", validatingwebhookName, "-o=jsonpath={..operations}").Output()
e2e.Logf(output)
if err != nil {
e2e.Logf("DELETE operations cannot be found:%v", err)
return false, nil
}
if strings.Contains(output, "DELETE") {
return true, nil
}
return false, nil
})
if err != nil {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("validatingwebhookconfiguration", validatingwebhookName, "-o=jsonpath={.webhooks.rules}").Output()
e2e.Logf(output)
output, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", sub.installedCSV, "-n", ns, "-o=jsonpath={.spec.webhookdefinitions}").Output()
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("validatingwebhookconfiguration %s has no DELETE operation", validatingwebhookName))
})
| |||||
test case
|
openshift/openshift-tests-private
|
d398148f-fac7-448a-8a5d-7badd7c32492
|
ConnectedOnly-Author:xzha-Medium-30317-can allow mutating admission webhook definitions in CSV
|
['"context"', '"fmt"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', 'g "github.com/onsi/ginkgo/v2"', '"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("ConnectedOnly-Author:xzha-Medium-30317-can allow mutating admission webhook definitions in CSV", 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-30317",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-30317",
namespace: "",
displayName: "Test Catsrc 30317 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginx-operator-index-30317:v2-cache",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-operator-30317",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator-30317",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
template: subTemplate,
}
)
oc.SetupProject()
ns := oc.Namespace()
og.namespace = ns
sub.namespace = ns
catsrc.namespace = ns
sub.catalogSourceNamespace = ns
exutil.By("create og")
og.create(oc, itName, dr)
exutil.By("create catalog source")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator")
defer sub.delete(itName, dr)
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
err := wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
err := oc.AsAdmin().WithoutNamespace().Run("get").Args("mutatingwebhookconfiguration", "-l", "olm.owner.namespace="+ns).Execute()
if err != nil {
e2e.Logf("The mutatingwebhookconfiguration is not created:%v", err)
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("mutatingwebhookconfiguration which owner ns %s is not created", ns))
exutil.By("update csv")
_, err1 := oc.AsAdmin().WithoutNamespace().Run("patch").Args("csv", sub.installedCSV, "-n", ns,
"--type=json", "--patch", `[{"op":"replace","path":"/spec/webhookdefinitions/0/rules/0/operations", "value":["CREATE","DELETE"]}]`).Output()
o.Expect(err1).NotTo(o.HaveOccurred())
validatingwebhookName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("mutatingwebhookconfiguration", "-l", "olm.owner.namespace="+ns, "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
err = wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("mutatingwebhookconfiguration", validatingwebhookName, "-o=jsonpath={..operations}").Output()
e2e.Logf(output)
if err != nil {
e2e.Logf("DELETE operations cannot be found:%v", err)
return false, nil
}
if strings.Contains(output, "DELETE") {
return true, nil
}
return false, nil
})
if err != nil {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("mutatingwebhookconfiguration", validatingwebhookName, "-o=jsonpath={.webhooks.rules}").Output()
e2e.Logf(output)
output, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", sub.installedCSV, "-n", ns, "-o=jsonpath={.spec.webhookdefinitions}").Output()
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("mutatingwebhookconfiguration %s has no DELETE operation", validatingwebhookName))
})
| |||||
test case
|
openshift/openshift-tests-private
|
2a5abcdc-0767-4bb5-8c5a-75ee05488bc3
|
ConnectedOnly-Author:xzha-Medium-30319-Admission Webhook Configuration names should be unique
|
['"context"', '"fmt"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', 'g "github.com/onsi/ginkgo/v2"', '"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:xzha-Medium-30319-Admission Webhook Configuration names should be unique", 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")
validatingwebhookName1 = ""
validatingwebhookName2 = ""
og = operatorGroupDescription{
name: "og-30319",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-30319",
namespace: "",
displayName: "Test Catsrc 30319 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginx-operator-index-30312:v2-cache",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-operator-30319",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator-30312",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
template: subTemplate,
}
)
for i := 1; i < 3; i++ {
oc.SetupProject()
ns := oc.Namespace()
og.namespace = ns
sub.namespace = ns
catsrc.namespace = ns
sub.catalogSourceNamespace = ns
exutil.By("create og")
og.create(oc, itName, dr)
exutil.By("create catalog source")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator")
defer sub.delete(itName, dr)
sub.create(oc, itName, dr)
err := wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("validatingwebhookconfiguration", "-l", "olm.owner.namespace="+ns).Output()
if err != nil {
e2e.Logf("The validatingwebhookconfiguration is not created:%v", err)
return false, nil
}
if strings.Contains(output, "No resources") {
e2e.Logf("The validatingwebhookconfiguration is not created:%v", err)
return false, nil
}
return true, nil
})
if err != nil {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("validatingwebhookconfiguration", "--show-labels").Output()
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("validatingwebhookconfiguration which owner ns %s is not created", ns))
validatingwebhookName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("validatingwebhookconfiguration", "-l", fmt.Sprintf("olm.owner.namespace=%s", ns), "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if i == 1 {
validatingwebhookName1 = validatingwebhookName
}
if i == 2 {
validatingwebhookName2 = validatingwebhookName
}
}
o.Expect(validatingwebhookName1).NotTo(o.BeEmpty())
o.Expect(validatingwebhookName2).NotTo(o.BeEmpty())
o.Expect(validatingwebhookName2).NotTo(o.Equal(validatingwebhookName1))
})
| |||||
test case
|
openshift/openshift-tests-private
|
f6bc9d08-0c4a-4361-a3af-4037fcb42058
|
ConnectedOnly-Author:xzha-High-30206-Medium-30242-can include secrets and configmaps in the bundle
|
['"context"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("ConnectedOnly-Author:xzha-High-30206-Medium-30242-can include secrets and configmaps in the bundle", 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-30206",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-30206",
namespace: "",
displayName: "Test Catsrc 30206 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/cockroachdb-index:5.0.4-30206-cache",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "cockroachdb-operator-30206",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "cockroachdb",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
template: subTemplate,
singleNamespace: true,
startingCSV: "cockroachdb.v5.0.4",
}
)
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 og")
og.create(oc, itName, dr)
exutil.By("create catalog source")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator")
defer sub.delete(itName, dr)
sub.create(oc, itName, dr)
exutil.By("check secrets")
errWait := wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 240*time.Second, false, func(ctx context.Context) (bool, error) {
err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", sub.namespace, "secrets", "mysecret").Execute()
if err != nil {
e2e.Logf("Failed to create secrets, error:%v", err)
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(errWait, "mysecret is not created")
exutil.By("check configmaps")
errWait = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 240*time.Second, false, func(ctx context.Context) (bool, error) {
err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", sub.namespace, "configmaps", "my-config-map").Execute()
if err != nil {
e2e.Logf("Failed to create secrets, error:%v", err)
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(errWait, "my-config-map is not found")
exutil.By("start to test OCP-30242")
exutil.By("delete csv")
sub.deleteCSV(itName, dr)
exutil.By("check secrets has been deleted")
errWait = wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", sub.namespace, "secrets", "mysecret").Execute()
if err != nil {
e2e.Logf("The secrets has been deleted")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(errWait, "mysecret is not found")
exutil.By("check configmaps has been deleted")
errWait = wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
err := oc.AsAdmin().WithoutNamespace().Run("get").Args("-n", sub.namespace, "configmaps", "my-config-map").Execute()
if err != nil {
e2e.Logf("The configmaps has been deleted")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(errWait, "my-config-map still exists")
})
| |||||
test case
|
openshift/openshift-tests-private
|
14e98492-a56d-4793-89ed-6a6dea65f597
|
ConnectedOnly-Author:xzha-Medium-24566-OLM automatically configures operators with global proxy config
|
['"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:xzha-Medium-24566-OLM automatically configures operators with global proxy config", func() {
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
subTemplateProxy := filepath.Join(buildPruningBaseDir, "olm-proxy-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: oc.Namespace(),
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-nginx-operator",
namespace: oc.Namespace(),
displayName: "Test 24566 Operators",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/nginxolm-operator-index:v1",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-operator-24566",
namespace: oc.Namespace(),
catalogSourceName: "catsrc-nginx-operator",
catalogSourceNamespace: oc.Namespace(),
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator",
singleNamespace: true,
template: subTemplate,
}
subP = subscriptionDescription{subName: "nginx-operator-24566",
namespace: oc.Namespace(),
catalogSourceName: "catsrc-nginx-operator",
catalogSourceNamespace: oc.Namespace(),
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator",
singleNamespace: true,
template: subTemplateProxy}
subProxyTest = subscriptionDescriptionProxy{
subscriptionDescription: subP,
httpProxy: "test_http_proxy",
httpsProxy: "test_https_proxy",
noProxy: "test_no_proxy",
}
subProxyFake = subscriptionDescriptionProxy{
subscriptionDescription: subP,
httpProxy: "fake_http_proxy",
httpsProxy: "fake_https_proxy",
noProxy: "fake_no_proxy",
}
subProxyEmpty = subscriptionDescriptionProxy{
subscriptionDescription: subP,
httpProxy: "",
httpsProxy: "",
noProxy: "",
}
)
itName := g.CurrentSpecReport().FullText()
//oc get proxy cluster
exutil.By("0) get the cluster proxy configuration")
httpProxy := getResource(oc, asAdmin, withoutNamespace, "proxy", "cluster", "-o=jsonpath={.status.httpProxy}")
httpsProxy := getResource(oc, asAdmin, withoutNamespace, "proxy", "cluster", "-o=jsonpath={.status.httpsProxy}")
noProxy := getResource(oc, asAdmin, withoutNamespace, "proxy", "cluster", "-o=jsonpath={.status.noProxy}")
exutil.By(fmt.Sprintf("1) create the catsrc and OperatorGroup in project: %s", oc.Namespace()))
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
og.createwithCheck(oc, itName, dr)
exutil.By("2) install sub")
sub.create(oc, itName, dr)
exutil.By("install operator SUCCESS")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "nginx-operator-controller-manager", ok, []string{"deployment", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..metadata.name}"}).check(oc)
if httpProxy == "" {
nodeHTTPProxy := getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTP_PROXY\")].value}")
o.Expect(nodeHTTPProxy).To(o.BeEmpty())
nodeHTTPSProxy := getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTPS_PROXY\")].value}")
o.Expect(nodeHTTPSProxy).To(o.BeEmpty())
nodeNoProxy := getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"NO_PROXY\")].value}")
o.Expect(nodeNoProxy).To(o.BeEmpty())
exutil.By("CHECK proxy configure SUCCESS")
sub.delete(itName, dr)
sub.deleteCSV(itName, dr)
exutil.By("3) create subscription and set variables ( HTTP_PROXY, HTTPS_PROXY and NO_PROXY ) with non-empty values. ")
subProxyTest.create(oc, itName, dr)
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", subProxyTest.installedCSV, "-n", subProxyTest.namespace, "-o=jsonpath={.status.phase}")
if (strings.Compare(status, "Succeeded") == 0) || (strings.Compare(status, "Installing") == 0) {
e2e.Logf("csv status is Succeeded or Installing")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("csv %s is not Succeeded or Installing", subProxyTest.installedCSV))
newCheck("expect", asAdmin, withoutNamespace, contain, "nginx-operator-controller-manager", ok, []string{"deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyTest.installedCSV), "-n", subProxyTest.namespace, "-o=jsonpath={..metadata.name}"}).check(oc)
nodeHTTPProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyTest.installedCSV), "-n", subProxyTest.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTP_PROXY\")].value}")
o.Expect(nodeHTTPProxy).To(o.Equal("test_http_proxy"))
nodeHTTPSProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyTest.installedCSV), "-n", subProxyTest.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTPS_PROXY\")].value}")
o.Expect(nodeHTTPSProxy).To(o.Equal("test_https_proxy"))
nodeNoProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyTest.installedCSV), "-n", subProxyTest.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"NO_PROXY\")].value}")
o.Expect(nodeNoProxy).To(o.Equal("test_no_proxy"))
subProxyTest.delete(itName, dr)
subProxyTest.getCSV().delete(itName, dr)
} else {
o.Expect(httpProxy).NotTo(o.BeEmpty())
o.Expect(httpsProxy).NotTo(o.BeEmpty())
o.Expect(noProxy).NotTo(o.BeEmpty())
nodeHTTPProxy := getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTP_PROXY\")].value}")
o.Expect(nodeHTTPProxy).To(o.Equal(httpProxy))
nodeHTTPSProxy := getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTPS_PROXY\")].value}")
o.Expect(nodeHTTPSProxy).To(o.Equal(httpsProxy))
nodeNoProxy := getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"NO_PROXY\")].value}")
o.Expect(nodeNoProxy).To(o.Equal(noProxy))
exutil.By("CHECK proxy configure SUCCESS")
sub.delete(itName, dr)
sub.deleteCSV(itName, dr)
exutil.By("3) create subscription and set variables ( HTTP_PROXY, HTTPS_PROXY and NO_PROXY ) with non-empty values. ")
subProxyTest.create(oc, itName, dr)
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", subProxyTest.installedCSV, "-n", subProxyTest.namespace, "-o=jsonpath={.status.phase}")
if (strings.Compare(status, "Succeeded") == 0) || (strings.Compare(status, "Installing") == 0) {
e2e.Logf("csv status is Succeeded or Installing")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("csv %s is not Succeeded or Installing", subProxyTest.installedCSV))
newCheck("expect", asAdmin, withoutNamespace, contain, "nginx-operator-controller-manager", ok, []string{"deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyTest.installedCSV), "-n", subProxyTest.namespace, "-o=jsonpath={..metadata.name}"}).check(oc)
nodeHTTPProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyTest.installedCSV), "-n", subProxyTest.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTP_PROXY\")].value}")
o.Expect(nodeHTTPProxy).To(o.Equal("test_http_proxy"))
nodeHTTPSProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyTest.installedCSV), "-n", subProxyTest.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTPS_PROXY\")].value}")
o.Expect(nodeHTTPSProxy).To(o.Equal("test_https_proxy"))
nodeNoProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyTest.installedCSV), "-n", subProxyTest.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"NO_PROXY\")].value}")
o.Expect(nodeNoProxy).To(o.Equal("test_no_proxy"))
subProxyTest.delete(itName, dr)
subProxyTest.getCSV().delete(itName, dr)
exutil.By("4) Create a new subscription and set variables ( HTTP_PROXY, HTTPS_PROXY and NO_PROXY ) with a fake value.")
subProxyFake.create(oc, itName, dr)
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", subProxyFake.installedCSV, "-n", subProxyFake.namespace, "-o=jsonpath={.status.phase}")
if (strings.Compare(status, "Succeeded") == 0) || (strings.Compare(status, "Installing") == 0) {
e2e.Logf("csv status is Succeeded or Installing")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("csv %s is not Succeeded or Installing", subProxyFake.installedCSV))
newCheck("expect", asAdmin, withoutNamespace, contain, "nginx-operator-controller-manager", ok, []string{"deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyFake.installedCSV), "-n", subProxyFake.namespace, "-o=jsonpath={..metadata.name}"}).check(oc)
nodeHTTPProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyFake.installedCSV), "-n", subProxyFake.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTP_PROXY\")].value}")
o.Expect(nodeHTTPProxy).To(o.Equal("fake_http_proxy"))
nodeHTTPSProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyFake.installedCSV), "-n", subProxyFake.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTPS_PROXY\")].value}")
o.Expect(nodeHTTPSProxy).To(o.Equal("fake_https_proxy"))
nodeNoProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyFake.installedCSV), "-n", subProxyFake.namespace, "-o=jsonpath={..spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"NO_PROXY\")].value}")
o.Expect(nodeNoProxy).To(o.Equal("fake_no_proxy"))
subProxyFake.delete(itName, dr)
subProxyFake.getCSV().delete(itName, dr)
exutil.By("5) Create a new subscription and set variables ( HTTP_PROXY, HTTPS_PROXY and NO_PROXY ) with an empty value.")
subProxyEmpty.create(oc, itName, dr)
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", subProxyEmpty.installedCSV, "-n", subProxyEmpty.namespace, "-o=jsonpath={.status.phase}")
if (strings.Compare(status, "Succeeded") == 0) || (strings.Compare(status, "Installing") == 0) {
e2e.Logf("csv status is Succeeded or Installing")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("csv %s is not Succeeded or Installing", subProxyEmpty.installedCSV))
newCheck("expect", asAdmin, withoutNamespace, contain, "nginx-operator-controller-manager", ok, []string{"deployment", fmt.Sprintf("--selector=olm.owner=%s", subProxyEmpty.installedCSV), "-n", subProxyEmpty.namespace, "-o=jsonpath={..metadata.name}"}).check(oc)
nodeHTTPProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=marketplace.operatorSource=%s", subProxyEmpty.installedCSV), "-n", subProxyEmpty.namespace, "-o=jsonpath={.spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTP_PROXY\")].value}")
o.Expect(nodeHTTPProxy).To(o.BeEmpty())
nodeHTTPSProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=marketplace.operatorSource=%s", subProxyEmpty.installedCSV), "-n", subProxyEmpty.namespace, "-o=jsonpath={.spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"HTTPS_PROXY\")].value}")
o.Expect(nodeHTTPSProxy).To(o.BeEmpty())
nodeNoProxy = getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=marketplace.operatorSource=%s", subProxyEmpty.installedCSV), "-n", subProxyEmpty.namespace, "-o=jsonpath={.spec.template.spec.containers[?(.name==\"manager\")].env[?(.name==\"NO_PROXY\")].value}")
o.Expect(nodeNoProxy).To(o.BeEmpty())
subProxyEmpty.delete(itName, dr)
subProxyEmpty.getCSV().delete(itName, dr)
}
})
| |||||
test case
|
openshift/openshift-tests-private
|
e00856ca-ce18-4111-9212-a6cf25837743
|
ConnectedOnly-Author:xzha-Medium-59380-Medium-68671-Upgrade should be success when there are multiple upgrade paths between channel entries
|
['"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:xzha-Medium-59380-Medium-68671-Upgrade should be success when there are multiple upgrade paths between channel entries", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-59380",
namespace: namespaceName,
displayName: "Test-Catsrc-59380-Operators",
publisher: "Red-Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginxolm-operator-index:59380",
template: catsrcImageTemplate,
}
subManual = subscriptionDescription{
subName: "sub-59380",
namespace: namespaceName,
catalogSourceName: "catsrc-59380",
catalogSourceNamespace: namespaceName,
channel: "v1.6",
ipApproval: "Manual",
operatorPackage: "nginx-operator",
startingCSV: "nginx-operator.v1.6.0",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By("STEP1: create the OperatorGroup ")
og.createwithCheck(oc, itName, dr)
exutil.By("STEP 2: Create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("STEP 3: install operator ")
subManual.createWithoutCheck(oc, itName, dr)
exutil.By("OCP-68671 Only one operator name is in 'Manual approval required' info section")
nameIP := subManual.getIP(oc)
clusterServiceVersionNames, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("installplan", nameIP, "-o=jsonpath={.spec.clusterServiceVersionNames}", "-n", oc.Namespace()).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(string(clusterServiceVersionNames)).NotTo(o.ContainSubstring(`",`))
exutil.By("OCP-68671 SUCCESS")
e2e.Logf("approve the install plan")
subManual.approveSpecificIP(oc, itName, dr, "nginx-operator.v1.6.0", "Complete")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "nginx-operator.v1.6.0", "-n", subManual.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("STEP 4: approve the install plan")
subManual.approveSpecificIP(oc, itName, dr, "nginx-operator.v1.6.2", "Complete")
exutil.By("STEP 5: check the csv nginx-operator.v1.6.2")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "nginx-operator.v1.6.2", "-n", subManual.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
f33d3985-257a-4cce-8632-b7f59fa6d44d
|
Author:jiazha-ROSA-OSD_CCS-ARO-NonHyperShiftHOST-High-21080-Check metrics [Serial]
|
['"context"', '"fmt"', '"os/exec"', '"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:jiazha-ROSA-OSD_CCS-ARO-NonHyperShiftHOST-High-21080-Check metrics [Serial]", func() {
type metrics struct {
csvCount int
csvUpgradeCount int
catalogSourceCount int
installPlanCount int
subscriptionCount int
subscriptionSyncTotal int
}
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subFile = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catPodname string
data PrometheusQueryResult
err error
exists bool
i int
metricsBefore metrics
metricsAfter metrics
msg string
olmPodname string
olmToken string
)
oc.SetupProject()
var (
og = operatorGroupDescription{
name: "test-21080-group",
namespace: oc.Namespace(),
template: ogTemplate,
}
sub = subscriptionDescription{
subName: "sub-21080",
namespace: oc.Namespace(),
catalogSourceName: "qe-app-registry",
catalogSourceNamespace: "openshift-marketplace",
ipApproval: "Automatic",
channel: "beta",
operatorPackage: "learn",
singleNamespace: true,
template: subFile,
}
)
exutil.By("1, check if this operator ready for instaalling")
e2e.Logf("Check if %v exists in the %v catalog", sub.operatorPackage, sub.catalogSourceName)
exists, err = clusterPackageExists(oc, sub)
if !exists {
e2e.Failf("FAIL:PackageMissing %v does not exist in catalog %v", sub.operatorPackage, sub.catalogSourceName)
}
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(exists).To(o.BeTrue())
exutil.By("2, Get token & pods so that access the Prometheus")
og.create(oc, itName, dr)
olmToken, err = exutil.GetSAToken(oc)
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmToken).NotTo(o.BeEmpty())
olmPodname, 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(olmPodname).NotTo(o.BeEmpty())
catPodname, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "--selector=app=catalog-operator", "-o=jsonpath={.items..metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(catPodname).NotTo(o.BeEmpty())
exutil.By("3, Collect olm metrics before installing an operator")
metricsCon := []string{"csv_count", "csv_upgrade_count", "catalog_source_count", "install_plan_count", "subscription_count", "subscription_sync_total"}
for _, metric := range metricsCon {
waitErr := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
queryContent := fmt.Sprintf("https://prometheus-k8s.openshift-monitoring.svc:9091/api/v1/query?query=%s", metric)
msg, _, err = oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", olmPodname, "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", olmToken), queryContent).Outputs()
e2e.Logf("%s, err:%v, msg:%v", metric, err, msg)
if msg == "" {
return false, nil
}
json.Unmarshal([]byte(msg), &data)
if len(data.Data.Result) < 1 || len(data.Data.Result[0].Value) < 2 {
return false, nil
}
metricsBefore.subscriptionSyncTotal = 0
if metric == "subscription_sync_total" {
for i = range data.Data.Result {
if strings.Contains(data.Data.Result[i].Metric.SrcName, sub.subName) {
metricsBefore.subscriptionSyncTotal, _ = strconv.Atoi(data.Data.Result[i].Value[1].(string))
}
}
} else {
switch metric {
case "csv_count":
metricsBefore.csvCount, _ = strconv.Atoi(data.Data.Result[0].Value[1].(string))
case "csv_upgrade_count":
metricsBefore.csvUpgradeCount, _ = strconv.Atoi(data.Data.Result[0].Value[1].(string))
case "catalog_source_count":
metricsBefore.catalogSourceCount, _ = strconv.Atoi(data.Data.Result[0].Value[1].(string))
case "install_plan_count":
metricsBefore.installPlanCount, _ = strconv.Atoi(data.Data.Result[0].Value[1].(string))
case "subscription_count":
metricsBefore.subscriptionCount, _ = strconv.Atoi(data.Data.Result[0].Value[1].(string))
}
}
return true, nil
})
exutil.AssertWaitPollNoErr(waitErr, fmt.Sprintf("failed to query %s", metric))
}
e2e.Logf("\nbefore {csv_count, csv_upgrade_count, catalog_source_count, install_plan_count, subscription_count, subscription_sync_total}\n%v", metricsBefore)
exutil.By("4, Start to subscribe to etcdoperator")
defer sub.delete(itName, dr) // remove the subscription after test
sub.create(oc, itName, dr)
exutil.By("4.5 Check for latest version")
defer sub.deleteCSV(itName, dr) // remove the csv after test
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("5, learnoperator is at v0.0.3, start to collect olm metrics after")
for _, metric := range metricsCon {
waitErr := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
queryContent := fmt.Sprintf("https://prometheus-k8s.openshift-monitoring.svc:9091/api/v1/query?query=%s", metric)
msg, _, err = oc.AsAdmin().WithoutNamespace().Run("exec").Args("-n", "openshift-operator-lifecycle-manager", olmPodname, "-i", "--", "curl", "-k", "-H", fmt.Sprintf("Authorization: Bearer %v", olmToken), queryContent).Outputs()
e2e.Logf("metric:%s, err:%v, msg:%v", metric, err, msg)
if msg == "" {
return false, nil
}
json.Unmarshal([]byte(msg), &data)
if len(data.Data.Result) < 1 || len(data.Data.Result[0].Value) < 2 {
return false, nil
}
metricsAfter.subscriptionSyncTotal = 0
if metric == "subscription_sync_total" {
for i = range data.Data.Result {
if strings.Contains(data.Data.Result[i].Metric.SrcName, sub.subName) {
metricsAfter.subscriptionSyncTotal, _ = strconv.Atoi(data.Data.Result[i].Value[1].(string))
}
}
} else {
switch metric {
case "csv_count":
metricsAfter.csvCount, _ = strconv.Atoi(data.Data.Result[0].Value[1].(string))
case "csv_upgrade_count":
metricsAfter.csvUpgradeCount, _ = strconv.Atoi(data.Data.Result[0].Value[1].(string))
case "catalog_source_count":
metricsAfter.catalogSourceCount, _ = strconv.Atoi(data.Data.Result[0].Value[1].(string))
case "install_plan_count":
metricsAfter.installPlanCount, _ = strconv.Atoi(data.Data.Result[0].Value[1].(string))
case "subscription_count":
metricsAfter.subscriptionCount, _ = strconv.Atoi(data.Data.Result[0].Value[1].(string))
}
}
return true, nil
})
exutil.AssertWaitPollNoErr(waitErr, fmt.Sprintf("failed to query %s", metric))
}
exutil.By("6, Check results")
e2e.Logf("{csv_count csv_upgrade_count catalog_source_count install_plan_count subscription_count subscription_sync_total}")
e2e.Logf("%v", metricsBefore)
e2e.Logf("%v", metricsAfter)
/* These are not reliable if other operators are added in parallel
exutil.By("Check Results")
// csv_count can increase since there is a new csv generated
o.Expect(metricsBefore.csvCount <= metricsAfter.csvCount).To(o.BeTrue())
e2e.Logf("PASS csv_count is greater")
// csv_upgrade_count should increase since its type is counter, see: https://prometheus.io/docs/concepts/metric_types/
o.Expect((metricsAfter.csvUpgradeCount - metricsBefore.csvUpgradeCount) == 1).To(o.BeTrue())
e2e.Logf("PASS csv_upgrade_count is greater")
// catalog_source_count should be equal since we don't install/uninstall it in this test
o.Expect(metricsBefore.catalogSourceCount == metricsAfter.catalogSourceCount).To(o.BeTrue())
e2e.Logf("PASS catalog_source_count is equal")
// install_plan_count should be greater since we there are 2 new ip generated in this case
o.Expect(metricsBefore.installPlanCount < metricsAfter.installPlanCount).To(o.BeTrue())
e2e.Logf("PASS install_plan_count is greater")
// subscription_count should be greater since we there are 1 new subscription generated in this case
o.Expect(metricsBefore.subscriptionCount < metricsAfter.subscriptionCount).To(o.BeTrue())
e2e.Logf("PASS subscription_count is greater")
// subscription_sync_total should be greater
o.Expect(metricsBefore.subscriptionSyncTotal < metricsAfter.subscriptionSyncTotal).To(o.BeTrue())
e2e.Logf("PASS subscription_sync_total is greater")
*/
exutil.By("All PASS\n")
})
| |||||
test case
|
openshift/openshift-tests-private
|
3f6106f0-e5a6-4e27-8982-9dd2afefa53d
|
Author:xzha-High-40972-Provide more specific text when no candidates for Subscription spec
|
['"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:xzha-High-40972-Provide more specific text when no candidates for Subscription spec", func() {
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subFile = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catPodname string
err error
exists bool
failures = 0
failureNames = ""
msg string
s string
snooze time.Duration = 300
step string
waitErr error
)
oc.SetupProject()
var (
og = operatorGroupDescription{
name: "test-40972-group",
namespace: oc.Namespace(),
template: ogTemplate,
}
subOriginal = subscriptionDescription{
subName: "learn-40972",
namespace: oc.Namespace(),
catalogSourceName: "qe-app-registry",
catalogSourceNamespace: "openshift-marketplace",
ipApproval: "Automatic",
channel: "beta",
operatorPackage: "learn",
singleNamespace: true,
template: subFile,
}
sub = subOriginal
)
exutil.By("1, check if this operator exists")
e2e.Logf("Check if %v exists in the %v catalog", sub.operatorPackage, sub.catalogSourceName)
exists, err = clusterPackageExists(oc, sub)
if !exists {
e2e.Failf("FAIL:PackageMissing %v does not exist in catalog %v", sub.operatorPackage, sub.catalogSourceName)
}
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(exists).To(o.BeTrue())
exutil.By("2, Create og")
og.create(oc, itName, dr)
exutil.By("1/3 bad package name")
sub = subOriginal
sub.operatorPackage = "xyzzy"
s = fmt.Sprintf("no operators found in package %v in the catalog referenced by subscription %v", sub.operatorPackage, sub.subName)
step = "1/3"
sub.createWithoutCheck(oc, itName, dr)
waitErr = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, snooze*time.Second, false, func(ctx context.Context) (bool, error) {
msg, err = oc.AsAdmin().Run("get").Args("sub", sub.subName, "-n", oc.Namespace(), "-o=jsonpath={.status.conditions[*].message}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(msg, s) {
return true, nil
}
return false, nil
})
if !strings.Contains(msg, s) {
e2e.Logf("STEP after %v, %v FAIL log is missing %v\nSTEP in: %v\n", waitErr, step, s, msg)
failures++
failureNames = s + "\n"
}
sub.deleteCSV(itName, dr)
sub.delete(itName, dr)
exutil.By("2/3 bad catalog name")
e2e.Logf("catpodname %v", catPodname)
sub = subOriginal
sub.catalogSourceName = "xyzzy"
s = fmt.Sprintf("no operators found from catalog %v in namespace openshift-marketplace referenced by subscription %v", sub.catalogSourceName, sub.subName)
step = "2/3"
sub.createWithoutCheck(oc, itName, dr)
waitErr = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, snooze*time.Second, false, func(ctx context.Context) (bool, error) {
msg, err = oc.AsAdmin().Run("get").Args("sub", sub.subName, "-n", oc.Namespace(), "-o=jsonpath={.status.conditions[*].message}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(msg, s) {
return true, nil
}
return false, nil
})
if !strings.Contains(msg, s) {
e2e.Logf("STEP after %v, %v FAIL log is missing %v\nSTEP in: %v\n", waitErr, step, s, msg)
failures++
failureNames = failureNames + s + "\n"
}
sub.deleteCSV(itName, dr)
sub.delete(itName, dr)
exutil.By("3/3 bad channel")
sub = subOriginal
sub.channel = "xyzzy"
s = fmt.Sprintf("no operators found in channel %v of package %v in the catalog referenced by subscription %v", sub.channel, sub.operatorPackage, sub.subName)
step = "3/3"
sub.createWithoutCheck(oc, itName, dr)
waitErr = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, snooze*time.Second, false, func(ctx context.Context) (bool, error) {
msg, err = oc.AsAdmin().Run("get").Args("sub", sub.subName, "-n", oc.Namespace(), "-o=jsonpath={.status.conditions[*].message}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(msg, s) {
return true, nil
}
return false, nil
})
if !strings.Contains(msg, s) {
e2e.Logf("STEP after %v, %v FAIL log is missing %v\nSTEP in: %v\n", waitErr, step, s, msg)
failures++
failureNames = failureNames + s + "\n"
}
sub.deleteCSV(itName, dr)
sub.delete(itName, dr)
exutil.By("4/4 bad CSV")
sub = subOriginal
sub.startingCSV = "xyzzy.v0.9.2"
s = fmt.Sprintf("no operators found with name %v in channel beta of package %v in the catalog referenced by subscription %v", sub.startingCSV, sub.operatorPackage, sub.subName)
step = "4/4"
sub.createWithoutCheck(oc, itName, dr)
waitErr = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, snooze*time.Second, false, func(ctx context.Context) (bool, error) {
msg, err = oc.AsAdmin().Run("get").Args("sub", sub.subName, "-n", oc.Namespace(), "-o=jsonpath={.status.conditions[*].message}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(msg, s) {
return true, nil
}
return false, nil
})
if !strings.Contains(msg, s) {
e2e.Logf("STEP after %v, %v FAIL log is missing %v\nSTEP in: %v\n", waitErr, step, s, msg)
failures++
failureNames = failureNames + s + "\n"
}
sub.deleteCSV(itName, dr)
sub.delete(itName, dr)
exutil.By("FINISH\n")
if failures != 0 {
e2e.Failf("FAILED: %v times for %v", failures, failureNames)
}
})
| |||||
test case
|
openshift/openshift-tests-private
|
fa8169e1-3ccd-40b9-bb90-e1ed4fcea3ec
|
ConnectedOnly-Author:xzha-Medium-40529-OPERATOR_CONDITION_NAME should have correct value
|
['"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:xzha-Medium-40529-OPERATOR_CONDITION_NAME should have correct value", func() {
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipIfDisableDefaultCatalogsource(oc)
exutil.SkipBaselineCaps(oc, "None")
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "og-40529",
namespace: namespaceName,
template: ogSingleTemplate,
}
sub = subscriptionDescription{
subName: "sub-40529",
namespace: namespaceName,
catalogSourceName: "community-operators",
catalogSourceNamespace: "openshift-marketplace",
channel: "singlenamespace-alpha",
ipApproval: "Manual",
operatorPackage: "etcd",
singleNamespace: true,
template: subTemplate,
startingCSV: "etcdoperator.v0.9.2",
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By("1: create the OperatorGroup ")
og.createwithCheck(oc, itName, dr)
exutil.By("2: create sub")
defer sub.delete(itName, dr)
defer sub.deleteCSV(itName, dr)
// to get the latest installedCSV for manual subscription so that its csv can be deleted successfully
defer sub.update(oc, itName, dr)
sub.create(oc, itName, dr)
e2e.Logf("approve the install plan")
sub.approveSpecificIP(oc, itName, dr, "etcdoperator.v0.9.2", "Complete")
err := newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.2", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
if err != nil {
output := getResource(oc, asAdmin, withoutNamespace, "csv", "etcdoperator.v0.9.2", "-n", namespaceName, "-o=jsonpath={.status.conditions}")
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, "state of csv etcdoperator.v0.9.2 is not Succeeded")
exutil.By("3: check OPERATOR_CONDITION_NAME")
// there are 3 containers in this pod
err = newCheck("expect", asAdmin, withoutNamespace, compare, "etcdoperator.v0.9.2 etcdoperator.v0.9.2 etcdoperator.v0.9.2", ok, []string{"deployment", "etcd-operator", "-n", namespaceName, "-o=jsonpath={.spec.template.spec.containers[*].env[?(@.name==\"OPERATOR_CONDITION_NAME\")].value}"}).checkWithoutAssert(oc)
if err != nil {
output := getResource(oc, asAdmin, withoutNamespace, "deployment", "etcd-operator", "-n", namespaceName, "-o=jsonpath={..spec.template.spec.containers}")
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, "OPERATOR_CONDITION_NAME of etcd-operator is not correct")
exutil.By("4: approve the install plan")
sub.approveSpecificIP(oc, itName, dr, "etcdoperator.v0.9.4", "Complete")
err = newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.4", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
if err != nil {
output := getResource(oc, asAdmin, withoutNamespace, "csv", "etcdoperator.v0.9.4", "-n", namespaceName, "-o=jsonpath={.status.conditions}")
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, "state of csv etcdoperator.v0.9.4 is not Succeeded")
exutil.By("5: check OPERATOR_CONDITION_NAME")
// there are 3 containers in this pod
err = newCheck("expect", asAdmin, withoutNamespace, compare, "etcdoperator.v0.9.4 etcdoperator.v0.9.4 etcdoperator.v0.9.4", ok, []string{"deployment", "etcd-operator", "-n", namespaceName, "-o=jsonpath={.spec.template.spec.containers[*].env[?(@.name==\"OPERATOR_CONDITION_NAME\")].value}"}).checkWithoutAssert(oc)
if err != nil {
output := getResource(oc, asAdmin, withoutNamespace, "deployment", "etcd-operator", "-n", namespaceName, "-o=jsonpath={..spec.template.spec.containers}")
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, "OPERATOR_CONDITION_NAME of etcd-operator is not correct")
})
| |||||
test case
|
openshift/openshift-tests-private
|
609d77c9-9f5b-4899-949b-5f834a3750b9
|
Author:xzha-NonHyperShiftHOST-ConnectedOnly-Medium-40534-Medium-40532-the deployment should not lost the resources section
|
['"fmt"', '"path/filepath"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("Author:xzha-NonHyperShiftHOST-ConnectedOnly-Medium-40534-Medium-40532-the deployment should not lost the resources section", func() {
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-40534",
namespace: namespaceName,
displayName: "Test Catsrc 40534 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginxolm-operator-index:v1",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-40534-operator",
namespace: namespaceName,
catalogSourceName: "catsrc-40534",
catalogSourceNamespace: namespaceName,
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By("STEP 1: create the OperatorGroup and catalog source")
og.createwithCheck(oc, itName, dr)
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("STEP 2: create sub")
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "nginx-operator", ok, []string{"deployment", "-n", sub.namespace}).check(oc)
exutil.By("STEP 3: check OPERATOR_CONDITION_NAME")
cpuCSV := getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={..containers[?(@.name==\"manager\")].resources.requests.cpu}")
o.Expect(cpuCSV).NotTo(o.BeEmpty())
memoryCSV := getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={..containers[?(@.name==\"manager\")].resources.requests.memory}")
o.Expect(memoryCSV).NotTo(o.BeEmpty())
cpuDeployment := getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..containers[?(@.name==\"manager\")].resources.requests.cpu}")
o.Expect(cpuDeployment).To(o.Equal(cpuDeployment))
memoryDeployment := getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..containers[?(@.name==\"manager\")].resources.requests.memory}")
o.Expect(memoryDeployment).To(o.Equal(memoryCSV))
exutil.By("OCP-40532: OLM should not print debug logs")
olmPodname, 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(olmPodname).NotTo(o.BeEmpty())
olmlogs, err := oc.AsAdmin().WithoutNamespace().Run("logs").Args(olmPodname, "-n", "openshift-operator-lifecycle-manager", "--limit-bytes", "50000").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(olmlogs).NotTo(o.BeEmpty())
o.Expect(olmlogs).NotTo(o.ContainSubstring("level=debug"))
catPodname, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "--selector=app=catalog-operator", "-o=jsonpath={.items..metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(catPodname).NotTo(o.BeEmpty())
catalogs, err := oc.AsAdmin().WithoutNamespace().Run("logs").Args(catPodname, "-n", "openshift-operator-lifecycle-manager", "--limit-bytes", "50000").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(catalogs).NotTo(o.BeEmpty())
o.Expect(catalogs).NotTo(o.ContainSubstring("level=debug"))
})
| |||||
test case
|
openshift/openshift-tests-private
|
b02881ff-1fc4-4f66-9ea1-a7ee2d3e352d
|
NonHyperShiftHOST-ConnectedOnly-Author:xzha-Medium-73061-Support envfrom on Operator Lifecycle Manager
|
['"fmt"', '"path/filepath"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("NonHyperShiftHOST-ConnectedOnly-Author:xzha-Medium-73061-Support envfrom on Operator Lifecycle Manager", func() {
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "envfrom-subscription.yaml")
cmTemplate := filepath.Join(buildPruningBaseDir, "cm-template.yaml")
secretTemplate := filepath.Join(buildPruningBaseDir, "secret_opaque.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
cm = configMapDescription{
name: "special-config-73061",
namespace: namespaceName,
template: cmTemplate,
}
secret = secretDescription{
name: "special-secret-73061",
namespace: namespaceName,
template: secretTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-73061",
namespace: namespaceName,
displayName: "Test Catsrc 73061 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginxolm-operator-index:v1",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-73061-operator",
namespace: namespaceName,
catalogSourceName: "catsrc-73061",
catalogSourceNamespace: namespaceName,
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator",
configMapRef: "special-config-73061",
secretRef: "special-secret-73061",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By("STEP 1: create the OperatorGroup, catalog source, secret, configmap")
og.createwithCheck(oc, itName, dr)
catsrc.createWithCheck(oc, itName, dr)
cm.create(oc, itName, dr)
secret.create(oc)
exutil.By("STEP 2: create sub")
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, contain, "nginx-operator", ok, []string{"deployment", "-n", sub.namespace}).check(oc)
exutil.By("STEP 3: check OPERATOR_CONDITION_NAME")
envFromDeployment := getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, `-o=jsonpath='{..spec.containers[*].envFrom}'`)
o.Expect(envFromDeployment).To(o.ContainSubstring(cm.name))
o.Expect(envFromDeployment).To(o.ContainSubstring(secret.name))
envFromPod := getResource(oc, asAdmin, withoutNamespace, "pod", "--selector=control-plane=controller-manager", "-n", sub.namespace, `-o=jsonpath='{..spec.containers[*].envFrom}'`)
o.Expect(envFromPod).To(o.ContainSubstring(cm.name))
o.Expect(envFromPod).To(o.ContainSubstring(secret.name))
})
| |||||
test case
|
openshift/openshift-tests-private
|
73e7e4f9-89bf-4c98-baeb-6d295fb4238f
|
Author:xzha-ConnectedOnly-High-75328-CatalogSources that use binaryless images must set extractContent
|
['"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:xzha-ConnectedOnly-High-75328-CatalogSources that use binaryless images must set extractContent", func() {
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
catsrcExtractImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
namespace := oc.Namespace()
catsrc := catalogSourceDescription{
name: "binless-catalog-75328",
namespace: namespace,
displayName: "Test Catsrc 75328 without bins",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75148",
template: catsrcImageTemplate,
}
catsrcExtract := catalogSourceDescription{
name: "binless-catalog-75328-extract",
namespace: namespace,
displayName: "Test Catsrc 75328 without bins",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/openshifttest/nginxolm-operator-index:nginxolm75148",
template: catsrcExtractImageTemplate,
}
dr := make(describerResrouce)
itName := g.CurrentSpecReport().FullText()
dr.addIr(itName)
exutil.By("Create catalogsource that use binaryless images without extractContent")
defer catsrc.delete(itName, dr)
catsrc.create(oc, itName, dr)
exutil.By("Check the catalogsource fail")
waitErr := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 60*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, "TRANSIENT_FAILURE") != 0 {
e2e.Logf("catsrc %s lastObservedState is %s, not TRANSIENT_FAILURE", catsrc.name, status)
return false, nil
}
return true, nil
})
if waitErr != 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")
}
exutil.AssertWaitPollNoErr(waitErr, fmt.Sprintf("catsrc %s lastObservedState is not TRANSIENT_FAILURE", catsrc.name))
e2e.Logf("catsrc %s lastObservedState is TRANSIENT_FAILURE", catsrc.name)
podName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", "olm.catalogSource=binless-catalog-75328", "-o=jsonpath={.items[0].metadata.name}", "-n", oc.Namespace()).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(podName).NotTo(o.BeEmpty())
log, _ := oc.AsAdmin().WithoutNamespace().Run("logs").Args(podName, "-n", catsrc.namespace, "--tail", "3").Output()
if !strings.Contains(log, "CreateContainerError") {
e2e.Failf("need CreateContainerError: %s", log)
}
exutil.By("packagemanifest not be created")
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifests", "nginx75148", "-n", catsrc.namespace).Output()
o.Expect(err).To(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("\"nginx75148\" not found"))
catsrc.delete(itName, dr)
exutil.By("Create catalogsource that use binaryless images with extractContent")
defer catsrcExtract.delete(itName, dr)
catsrcExtract.createWithCheck(oc, itName, dr)
exutil.By("packagemanifest works well")
entries := getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx75148", "-n", catsrcExtract.namespace, "-o=jsonpath={.status.channels[?(@.name==\"candidate-v1.0\")].entries}")
o.Expect(entries).To(o.ContainSubstring("nginx75148.v1.0.6"))
})
| |||||
test case
|
openshift/openshift-tests-private
|
b6664096-c717-4f25-9a6e-ed66cd5d2313
|
NonHyperShiftHOST-ConnectedOnly-Author:xzha-Medium-72018-Do not sync namespaces that have no subscriptions
|
['"strings"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("NonHyperShiftHOST-ConnectedOnly-Author:xzha-Medium-72018-Do not sync namespaces that have no subscriptions", func() {
oc.SetupProject()
namespaceName := oc.Namespace()
catPodname, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "--selector=app=catalog-operator", "-o=jsonpath={.items..metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(catPodname).NotTo(o.BeEmpty())
catalogs, err := oc.AsAdmin().WithoutNamespace().Run("logs").Args(catPodname, "-n", "openshift-operator-lifecycle-manager", "--since=60s").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if len(catalogs) != 0 {
for _, line := range strings.Split(catalogs, "\n") {
if strings.Contains(line, namespaceName) {
e2e.Logf(line)
o.Expect(line).NotTo(o.ContainSubstring("found 0 operatorGroups"))
}
}
} else {
e2e.Logf("log is empty")
}
})
| |||||
test case
|
openshift/openshift-tests-private
|
71df4d6c-3f2e-4e32-92c5-8d334fb20d42
|
ConnectedOnly-Author:xzha-Medium-42829-Install plan should be blocked till a valid OperatorGroup is detected
|
['"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:xzha-Medium-42829-Install plan should be blocked till a valid OperatorGroup is detected", func() {
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
oc.SetupProject()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: oc.Namespace(),
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-42829",
namespace: oc.Namespace(),
displayName: "Test Operators",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/nginxolm-operator-index:v1",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "sub-42829",
namespace: oc.Namespace(),
catalogSourceName: "catsrc-42829",
catalogSourceNamespace: oc.Namespace(),
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By(fmt.Sprintf("1) create the catsrc in project: %s", oc.Namespace()))
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("2) install sub")
sub.createWithoutCheck(oc, itName, dr)
exutil.By("sleep 10 sencond, then create og")
time.Sleep(time.Second * 10)
//exutil.By("3) check sub status")
//err := newCheck("expect", asAdmin, withoutNamespace, contain, "found 0 operatorgroups", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions}"}).checkWithoutAssert(oc)
//o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("4) install og")
og.createwithCheck(oc, itName, dr)
exutil.By("check ip and csv")
installPlan := sub.getIP(oc)
o.Expect(installPlan).NotTo(o.BeEmpty())
err := newCheck("expect", asAdmin, withoutNamespace, compare, "Complete", ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
if err != nil {
output := getResource(oc, asAdmin, withoutNamespace, "installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.conditions}}")
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, "status.phase of installplan is not Complete")
sub.findInstalledCSV(oc, itName, dr)
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status, "Succeeded") == 0 {
e2e.Logf("get installedCSV failed")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("csv %s is not Succeeded", sub.installedCSV))
})
| |||||
test case
|
openshift/openshift-tests-private
|
c1c2667a-aafa-46ba-a6a9-51245dbe8423
|
ConnectedOnly-Author:xzha-High-43110-OLM provide a helpful error message when install removed api
|
['"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:xzha-High-43110-OLM provide a helpful error message when install removed api", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
catsrc = catalogSourceDescription{
name: "catsrc-ditto-43110",
namespace: namespaceName,
displayName: "Test Catsrc ditto Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/ditto-index:v1beta1-cache",
template: catsrcImageTemplate,
}
og = operatorGroupDescription{
name: "og-43110",
namespace: namespaceName,
template: ogSingleTemplate,
}
sub = subscriptionDescription{
subName: "sub-43110",
namespace: namespaceName,
catalogSourceName: "catsrc-ditto-43110",
catalogSourceNamespace: namespaceName,
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "ditto-operator",
singleNamespace: true,
template: subTemplate,
startingCSV: "",
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By("1) create the catalog source and OperatorGroup")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
og.createwithCheck(oc, itName, dr)
exutil.By("2) install sub")
defer sub.delete(itName, dr)
sub.createWithoutCheck(oc, itName, dr)
exutil.By("3) check ip/sub conditions")
installPlan := sub.getIP(oc)
o.Expect(installPlan).NotTo(o.BeEmpty())
newCheck("expect", asAdmin, withoutNamespace, compare, "Failed", ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
ipConditions := getResource(oc, asAdmin, withoutNamespace, "installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.conditions}")
o.Expect(ipConditions).To(o.ContainSubstring("api-server resource not found installing CustomResourceDefinition"))
o.Expect(ipConditions).To(o.ContainSubstring("apiextensions.k8s.io/v1beta1"))
o.Expect(ipConditions).To(o.ContainSubstring("Kind=CustomResourceDefinition not found on the cluster"))
o.Expect(ipConditions).To(o.ContainSubstring("InstallComponentFailed"))
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
subConditions := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions}")
if strings.Contains(subConditions, "InstallComponentFailed") {
o.Expect(subConditions).To(o.ContainSubstring("Kind=CustomResourceDefinition not found on the cluster"))
return true, nil
}
e2e.Logf(subConditions)
e2e.Logf("the status message of sub is not correct, retry...")
return false, nil
})
exutil.AssertWaitPollNoErr(err, "sub status is not correct")
exutil.By("4) SUCCESS")
})
| |||||
test case
|
openshift/openshift-tests-private
|
fc9c6d78-b9b2-4e0b-a9c7-e8279544fd98
|
ROSA-ConnectedOnly-Author:xzha-High-43639-OLM must explicitly alert on deprecated APIs in use
|
['"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("ROSA-ConnectedOnly-Author:xzha-High-43639-OLM must explicitly alert on deprecated APIs in use", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
catsrc = catalogSourceDescription{
name: "catsrc-ditto-43639",
namespace: namespaceName,
displayName: "Test Catsrc ditto Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/ditto-index:v1beta1-cache",
template: catsrcImageTemplate,
}
og = operatorGroupDescription{
name: "og-43639",
namespace: namespaceName,
template: ogSingleTemplate,
}
sub = subscriptionDescription{
subName: "sub-43639",
namespace: namespaceName,
catalogSourceName: "catsrc-ditto-43639",
catalogSourceNamespace: namespaceName,
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "ditto-operator",
singleNamespace: true,
template: subTemplate,
startingCSV: "",
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By("1) create the catalog source and OperatorGroup")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
og.createwithCheck(oc, itName, dr)
exutil.By("2) install sub")
defer sub.delete(itName, dr)
sub.createWithoutCheck(oc, itName, dr)
installPlan := sub.getIP(oc)
o.Expect(installPlan).NotTo(o.BeEmpty())
err := wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
ipPhase := getResource(oc, asAdmin, withoutNamespace, "installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Contains(ipPhase, "Complete") {
e2e.Logf("sub is installed")
return true, nil
}
return false, nil
})
if err == nil {
exutil.By("3) check events")
err2 := wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 240*time.Second, false, func(ctx context.Context) (bool, error) {
eventOutput, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("event", "-n", namespaceName).Output()
o.Expect(err1).NotTo(o.HaveOccurred())
lines := strings.Split(eventOutput, "\n")
for _, line := range lines {
if strings.Contains(line, "CustomResourceDefinition is deprecated") && strings.Contains(line, "piextensions.k8s.io") && strings.Contains(line, "ditto-operator") {
return true, nil
}
}
return false, nil
})
exutil.AssertWaitPollNoErr(err2, "event CustomResourceDefinition is deprecated, piextensions.k8s.io and ditto-operator not found")
} else {
exutil.By("3) the opeartor cannot be installed, skip test case")
}
exutil.By("4) SUCCESS")
})
| |||||
test case
|
openshift/openshift-tests-private
|
b1307dc5-8fc2-4e45-adb4-3739cab0d556
|
ConnectedOnly-Author:xzha-Medium-48439-OLM upgrades operators immediately
|
['"context"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"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("ConnectedOnly-Author:xzha-Medium-48439-OLM upgrades operators immediately", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
catsrc = catalogSourceDescription{
name: "catsrc-48439",
namespace: namespaceName,
displayName: "Test Catsrc",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginxolm-operator-index:ocp-48439",
template: catsrcImageTemplate,
}
og = operatorGroupDescription{
name: "og-48439",
namespace: namespaceName,
template: ogSingleTemplate,
}
sub = subscriptionDescription{
subName: "sub-48439",
namespace: namespaceName,
catalogSourceName: "catsrc-48439",
catalogSourceNamespace: namespaceName,
channel: "v0.0.1",
ipApproval: "Automatic",
operatorPackage: "nginx-operator",
template: subTemplate,
startingCSV: "nginx-operator.v0.0.1",
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By("1) create the catalog source and OperatorGroup")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
og.createwithCheck(oc, itName, dr)
exutil.By("2) install sub")
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "nginx-operator.v0.0.1", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
exutil.By("3) update sub channel")
sub.patch(oc, "{\"spec\": {\"channel\": \"v1.0.1\"}}")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) {
ips := getResource(oc, asAdmin, withoutNamespace, "installplan", "-n", sub.namespace)
if strings.Contains(ips, "nginx-operator.v1.0.1") {
e2e.Logf("Install plan for nginx-operator.v1.0.1 is created")
return true, nil
}
return false, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath-as-json={.spec}")
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath-as-json={.status}")
getResource(oc, asAdmin, withoutNamespace, "installplan", "-n", sub.namespace, "-o=jsonpath-as-json={..spec}")
}
exutil.AssertWaitPollNoErr(err, "no install plan for nginx-operator.v1.0.1")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "nginx-operator.v1.0.1", "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
exutil.By("4) SUCCESS")
})
| |||||
test case
|
openshift/openshift-tests-private
|
628b11a1-c930-480e-9df1-202021c6f696
|
ConnectedOnly-Author:xzha-Medium-71779-Failing unpack jobs can be auto retried [Slow]
|
['"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:xzha-Medium-71779-Failing unpack jobs can be auto retried [Slow]", func() {
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogtemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
namespace := oc.Namespace()
og := operatorGroupDescription{
name: "og-71779",
namespace: namespace,
template: ogtemplate,
}
catsrc := catalogSourceDescription{
name: "catsrc-71779",
namespace: namespace,
displayName: "Test Catsrc 71779 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/bug29194-index:v1",
template: catsrcImageTemplate,
}
sub := subscriptionDescription{
subName: "sub-71779",
namespace: namespace,
ipApproval: "Automatic",
operatorPackage: "bug29194",
catalogSourceName: catsrc.name,
catalogSourceNamespace: namespace,
template: subTemplate,
singleNamespace: true,
}
dr := make(describerResrouce)
itName := g.CurrentSpecReport().FullText()
dr.addIr(itName)
exutil.By("1) Create the OperatorGroup")
og.createwithCheck(oc, itName, dr)
err := oc.AsAdmin().WithoutNamespace().Run("patch").Args("og", og.name, "-n", namespace, "--type=merge", "-p", `{"metadata":{"annotations":{"operatorframework.io/bundle-unpack-timeout":"10s"}}}`).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("2) create catalog source")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("3) Create a Subscription")
sub.createWithoutCheck(oc, itName, dr)
exutil.By("5) Check sub message")
newCheck("expect", asAdmin, withoutNamespace, contain, "BundleUnpackFailed", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions}"}).check(oc)
jobs1 := getResource(oc, asAdmin, withoutNamespace, "job", "-n", sub.namespace, "--selector=operatorframework.io/bundle-unpack-ref", "-o=jsonpath={.items[*].metadata.name}")
exutil.By("6) Patch OperatorGroup")
err = oc.AsAdmin().WithoutNamespace().Run("patch").Args("og", og.name, "-n", namespace, "--type=merge", "-p", `{"metadata":{"annotations":{"operatorframework.io/bundle-unpack-min-retry-interval":"1s"}}}`).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("7) check unpack job is auto retried")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 600*time.Second, false, func(ctx context.Context) (bool, error) {
output := getResource(oc, asAdmin, withoutNamespace, "job", "-n", sub.namespace, "--selector=operatorframework.io/bundle-unpack-ref", "-o=jsonpath={.items[*].metadata.name}")
jobs2 := strings.Split(output, "")
for _, jobname := range jobs2 {
if !strings.Contains(jobs1, jobname) {
return true, nil
}
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "unpack job is not auto retried")
exutil.By("8) check unpack job is auto retried again")
jobs2 := getResource(oc, asAdmin, withoutNamespace, "job", "-n", sub.namespace, "--selector=operatorframework.io/bundle-unpack-ref", "-o=jsonpath={.items[*].metadata.name}")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 600*time.Second, false, func(ctx context.Context) (bool, error) {
output := getResource(oc, asAdmin, withoutNamespace, "job", "-n", sub.namespace, "--selector=operatorframework.io/bundle-unpack-ref", "-o=jsonpath={.items[*].metadata.name}")
jobs3 := strings.Split(output, "")
for _, jobname := range jobs3 {
if !strings.Contains(jobs2, jobname) {
return true, nil
}
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "unpack job is not auto retried")
exutil.By("SUCCESS")
})
| |||||
test case
|
openshift/openshift-tests-private
|
633dae4f-2c3d-4ec1-b125-4a17a8e17e7f
|
Author:kuiwang-NonHyperShiftHOST-ConnectedOnly-Medium-40958-Indicate invalid OperatorGroup on InstallPlan status
|
['"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-40958-Indicate invalid OperatorGroup on InstallPlan status", 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")
ogSAtemplate = filepath.Join(buildPruningBaseDir, "operatorgroup-serviceaccount.yaml")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-legacy.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
saName = "scopedv40958"
og1 = operatorGroupDescription{
name: "og1-40958",
namespace: "",
template: ogSingleTemplate,
}
og2 = operatorGroupDescription{
name: "og2-40958",
namespace: "",
template: ogSingleTemplate,
}
ogSa = operatorGroupDescription{
name: "ogsa-40958",
namespace: "",
serviceAccountName: saName,
template: ogSAtemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-40958-operator",
namespace: "",
displayName: "Test Catsrc 40958 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/olm-dep:v40958",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "teiid",
namespace: "",
channel: "beta",
ipApproval: "Automatic",
operatorPackage: "teiid",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "teiid.v0.4.0",
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
og1.namespace = oc.Namespace()
og2.namespace = oc.Namespace()
ogSa.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
defer exutil.RecoverNamespaceRestricted(oc, oc.Namespace())
exutil.SetNamespacePrivileged(oc, oc.Namespace())
exutil.By("create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator without og")
sub.createWithoutCheck(oc, itName, dr)
exutil.By("no Installplan is generated, without og")
// by https://issues.redhat.com/browse/OCPBUGS-9259
waitErr := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 10*time.Second, false, func(ctx context.Context) (bool, error) {
var err error
installPlan, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installPlanRef.name}").Output()
if strings.Compare(installPlan, "") == 0 || err != nil {
return false, nil
}
return true, nil
})
exutil.AssertWaitPollWithErr(waitErr, fmt.Sprintf("sub %s has installplan", sub.subName))
exutil.By("delete operator")
sub.delete(itName, dr)
exutil.By("Create og1")
og1.create(oc, itName, dr)
exutil.By("Create og2")
og2.create(oc, itName, dr)
exutil.By("install operator with multiple og")
sub.createWithoutCheck(oc, itName, dr)
exutil.By("no Installplan is generated, multiple og")
waitErr = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 10*time.Second, false, func(ctx context.Context) (bool, error) {
var err error
installPlan, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installPlanRef.name}").Output()
if strings.Compare(installPlan, "") == 0 || err != nil {
return false, nil
}
return true, nil
})
exutil.AssertWaitPollWithErr(waitErr, fmt.Sprintf("sub %s has installplan", sub.subName))
exutil.By("delete resource for next step")
sub.delete(itName, dr)
og1.delete(itName, dr)
og2.delete(itName, dr)
exutil.By("create sa")
_, err := oc.WithoutNamespace().AsAdmin().Run("create").Args("sa", saName, "-n", sub.namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("Create ogSa")
ogSa.createwithCheck(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, saName, ok, []string{"og", ogSa.name, "-n", ogSa.namespace, "-o=jsonpath={.status.serviceAccountRef.name}"}).check(oc)
exutil.By("delete the service account")
_, err = oc.WithoutNamespace().AsAdmin().Run("delete").Args("sa", saName, "-n", sub.namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("install operator without sa for og")
sub.createWithoutCheck(oc, itName, dr)
exutil.By("no Installplan is generated, without sa for og")
installPlan, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installPlanRef.name}").Output()
if strings.Compare(installPlan, "") != 0 && err == nil {
subContent, _ := oc.WithoutNamespace().AsAdmin().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-oyaml").Output()
e2e.Logf("subContent: %v", subContent)
e2e.Failf("should no ip")
}
})
| |||||
test case
|
openshift/openshift-tests-private
|
5cdc65fc-d79e-40c1-acd6-0b4fae43c9f7
|
ConnectedOnly-Author:xzha-Medium-41174-Periodically retry InstallPlan execution until a timeout expires
|
['"context"', '"fmt"', '"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:xzha-Medium-41174-Periodically retry InstallPlan execution until a timeout expires", func() {
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipIfDisableDefaultCatalogsource(oc)
exutil.SkipBaselineCaps(oc, "None")
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
roletemplate := filepath.Join(buildPruningBaseDir, "role.yaml")
rolebindingtemplate := filepath.Join(buildPruningBaseDir, "role-binding.yaml")
ogSAtemplate := filepath.Join(buildPruningBaseDir, "operatorgroup-serviceaccount.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
oc.SetupProject()
namespace := oc.Namespace()
itName := g.CurrentSpecReport().FullText()
var (
csv = "etcdoperator.v0.9.4"
sa = "scoped-41174"
og = operatorGroupDescription{
name: "test-og-41174",
namespace: namespace,
serviceAccountName: sa,
template: ogSAtemplate,
}
sub = subscriptionDescription{
subName: "etcd",
namespace: namespace,
catalogSourceName: "community-operators",
catalogSourceNamespace: "openshift-marketplace",
channel: "singlenamespace-alpha",
ipApproval: "Automatic",
operatorPackage: "etcd",
singleNamespace: true,
template: subTemplate,
startingCSV: csv,
}
role = roleDescription{
name: "role-41174",
namespace: namespace,
template: roletemplate,
}
rolebinding = rolebindingDescription{
name: "scoped-bindings-41174",
namespace: namespace,
rolename: "role-41174",
saname: sa,
template: rolebindingtemplate,
}
)
exutil.By("1) Create the service account, secret and OperatorGroup")
_, err := oc.WithoutNamespace().AsAdmin().Run("create").Args("sa", sa, "-n", sub.namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
og.createwithCheck(oc, itName, dr)
err = newCheck("expect", asAdmin, withoutNamespace, compare, sa, ok, []string{"og", og.name, "-n", og.namespace, "-o=jsonpath={.status.serviceAccountRef.name}"}).checkWithoutAssert(oc)
if err != nil {
output := getResource(oc, asAdmin, withoutNamespace, "og", og.name, "-n", og.namespace, "-o=jsonpath={.status}")
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("status.serviceAccountRef.name of og %s is not %s", og.name, sa))
exutil.By("2) Create a Subscription, check installplan")
defer sub.delete(itName, dr)
defer sub.deleteCSV(itName, dr)
defer sub.update(oc, itName, dr)
sub.createWithoutCheck(oc, itName, dr)
installPlan := sub.getIP(oc)
o.Expect(installPlan).NotTo(o.BeEmpty())
err = newCheck("expect", asAdmin, withoutNamespace, contain, "retrying execution due to error", ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.message}"}).checkWithoutAssert(oc)
if err != nil {
output := getResource(oc, asAdmin, withoutNamespace, "installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status}")
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("status.message of installplan %s does not contain 'retrying execution due to error'", installPlan))
exutil.By("3) Grant the proper permissions to the service account")
role.create(oc)
rolebinding.create(oc)
exutil.By("4) Checking the state of CSV")
err = newCheck("expect", asAdmin, withoutNamespace, compare, "Complete", ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
if err != nil {
output := getResource(oc, asAdmin, withoutNamespace, "installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status}")
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("status.phase of installplan %s is not Complete", installPlan))
err = newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", csv, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
if err != nil {
output := getResource(oc, asAdmin, withoutNamespace, "csv", csv, "-n", sub.namespace, "-o=jsonpath={.status}")
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("status.phase of csv %s is not Succeeded", csv))
err = wait.PollUntilContextTimeout(context.TODO(), 1*time.Second, 10*time.Second, false, func(ctx context.Context) (bool, error) {
installedCSV := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installedCSV}")
if strings.Compare(installedCSV, "") == 0 {
e2e.Logf("get installedCSV failed")
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("csv of sub %v is not installed", sub.subName))
exutil.By("5) SUCCESS")
})
| |||||
test case
|
openshift/openshift-tests-private
|
35b996e7-ec5f-4b89-800f-c829520e2453
|
Author:xzha-High-56371-service account token secret reference
|
['"fmt"', '"path/filepath"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("Author:xzha-High-56371-service account token secret reference", func() {
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
roletemplate := filepath.Join(buildPruningBaseDir, "role.yaml")
rolebindingtemplate := filepath.Join(buildPruningBaseDir, "role-binding.yaml")
ogSAtemplate := filepath.Join(buildPruningBaseDir, "operatorgroup-serviceaccount.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
secretTemplate := filepath.Join(buildPruningBaseDir, "secret.yaml")
secretopaqueTemplate := filepath.Join(buildPruningBaseDir, "secret_opaque.yaml")
oc.SetupProject()
namespace := oc.Namespace()
itName := g.CurrentSpecReport().FullText()
var (
sa = "scoped-56371"
og = operatorGroupDescription{
name: "test-og-56371",
namespace: namespace,
serviceAccountName: sa,
template: ogSAtemplate,
}
sub = subscriptionDescription{
subName: "sub-56371",
namespace: namespace,
catalogSourceName: "qe-app-registry",
catalogSourceNamespace: "openshift-marketplace",
channel: "beta",
ipApproval: "Automatic",
operatorPackage: "learn",
singleNamespace: true,
template: subTemplate,
}
role = roleDescription{
name: "role-56371",
namespace: namespace,
template: roletemplate,
}
rolebinding = rolebindingDescription{
name: "scoped-bindings-56371",
namespace: namespace,
rolename: "role-56371",
saname: sa,
template: rolebindingtemplate,
}
secretopaque = secretDescription{
name: "zsecret-56371",
namespace: namespace,
template: secretopaqueTemplate,
}
secret = secretDescription{
name: sa,
namespace: namespace,
saname: sa,
sectype: "kubernetes.io/service-account-token",
template: secretTemplate,
}
)
exutil.By("1) Create the service account")
_, err := oc.WithoutNamespace().AsAdmin().Run("create").Args("sa", sa, "-n", sub.namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
secret.create(oc)
exutil.By("2) Create the OperatorGroup")
og.createwithCheck(oc, itName, dr)
err = newCheck("expect", asAdmin, withoutNamespace, compare, sa, ok, []string{"og", og.name, "-n", og.namespace, "-o=jsonpath={.status.serviceAccountRef.name}"}).checkWithoutAssert(oc)
if err != nil {
output := getResource(oc, asAdmin, withoutNamespace, "og", og.name, "-n", og.namespace, "-o=jsonpath={.status}")
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("status.serviceAccountRef.name of og %s is not %s", og.name, sa))
exutil.By("3) Create the Secret")
secretopaque.create(oc)
exutil.By("4) Grant the proper permissions to the service account")
role.create(oc)
rolebinding.create(oc)
exutil.By("5) create sub")
sub.create(oc, itName, dr)
exutil.By("6) Checking the secret")
secrets, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("secret", "-n", namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(secrets).To(o.ContainSubstring(secretopaque.name))
exutil.By("7) Checking the state of CSV")
newCheck("expect", asUser, withNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
1eb10bf5-3a78-4528-b806-b258fc9a1c75
|
ConnectedOnly-Longduration-NonPreRelease-Author:xzha-Medium-41035-Fail InstallPlan on bundle unpack timeout [Slow]
|
['"context"', '"fmt"', '"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-Longduration-NonPreRelease-Author:xzha-Medium-41035-Fail InstallPlan on bundle unpack timeout [Slow]", 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-41035",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-41035",
namespace: "",
displayName: "Test Catsrc 41035 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/ditto-index:41035",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "ditto-operator-41035",
namespace: "",
channel: "4.8",
ipApproval: "Automatic",
operatorPackage: "ditto-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
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 og")
og.create(oc, itName, dr)
exutil.By("create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator")
defer sub.delete(itName, dr)
sub.createWithoutCheck(oc, itName, dr)
exutil.By("The install plan is Failed")
err := wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 900*time.Second, false, func(ctx context.Context) (bool, error) {
conditions, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions}").Output()
if strings.Contains(conditions, "BundleUnpackFailed") {
return true, nil
}
return false, nil
})
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions}")
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("sub %v is not Failed", sub.subName))
})
| |||||
test case
|
openshift/openshift-tests-private
|
68848813-b303-4f65-ad01-2dad2da1f6b4
|
ConnectedOnly-Author:xzha-Medium-47322-Arbitrary Constraints can be defined as bundle properties
|
['"context"', '"fmt"', '"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:xzha-Medium-47322-Arbitrary Constraints can be defined as bundle properties", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-47322",
namespace: namespaceName,
displayName: "Test 47322",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/etcd-index:47322-single-cache",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "etcd-47322",
namespace: namespaceName,
catalogSourceName: "catsrc-47322",
catalogSourceNamespace: namespaceName,
channel: "alpha-1",
ipApproval: "Automatic",
operatorPackage: "etcd",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By(fmt.Sprintf("1) create the catsrc in project: %s", namespaceName))
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("2) install og")
og.createwithCheck(oc, itName, dr)
exutil.By("3) install sub with channel alpha-1")
sub.create(oc, itName, dr)
exutil.By("4) check csv")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status1 := getResource(oc, asAdmin, withoutNamespace, "csv", "etcdoperator.v0.9.2", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status1, "Succeeded") != 0 {
e2e.Logf("csv etcdoperator.v0.9.2 status is not Succeeded, go next round")
return false, nil
}
status2 := getResource(oc, asAdmin, withoutNamespace, "csv", "ditto-operator.v0.1.1", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if (strings.Compare(status2, "Succeeded") != 0) && (strings.Compare(status2, "Installing") != 0) {
e2e.Logf("csv ditto-operator.v0.1.1 status is not Succeeded nor Installing, go next round")
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath={.status}")
}
exutil.AssertWaitPollNoErr(err, "csv etcdoperator.v0.9.2 or ditto-operator.v0.1.1 is not Succeeded nor Installing")
exutil.By("5) delete sub etcd-47322 and csv etcdoperator.v0.9.2")
sub.findInstalledCSV(oc, itName, dr)
sub.delete(itName, dr)
sub.deleteCSV(itName, dr)
exutil.By("6) install sub with channel alpha-2")
sub.channel = "alpha-2"
sub.createWithoutCheck(oc, itName, dr)
exutil.By("7) check sub")
newCheck("expect", asUser, withoutNamespace, contain, "ConstraintsNotSatisfiable", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].reason}"}).check(oc)
newCheck("expect", asUser, withoutNamespace, contain, "require to have the property olm.type3 with value value31", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].message}"}).check(oc)
exutil.By("8) delete sub and csv ditto-operator.v0.1.1")
selectorStr := "--selector=operators.coreos.com/ditto-operator." + namespaceName
subDepName := getResource(oc, asAdmin, withoutNamespace, "sub", selectorStr, "-n", sub.namespace, "-o=jsonpath={..metadata.name}")
o.Expect(subDepName).To(o.ContainSubstring("ditto-operator"))
_, err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("sub", subDepName, "-n", oc.Namespace()).Output()
o.Expect(err).NotTo(o.HaveOccurred())
_, err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("csv", "ditto-operator.v0.1.1", "-n", oc.Namespace()).Output()
o.Expect(err).NotTo(o.HaveOccurred())
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) {
output := getResource(oc, asAdmin, withoutNamespace, "csv", "-n", sub.namespace)
if strings.Contains(output, "ditto-operator.v0.1.1") {
e2e.Logf("csv ditto-operator.v0.1.1 still exist, go next round")
return false, nil
}
output = getResource(oc, asAdmin, withoutNamespace, "sub", "-n", sub.namespace)
if strings.Contains(output, subDepName) {
e2e.Logf("sub still exist, go next round")
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, "delete sub and csv failed")
exutil.By("9) check status of csv etcdoperator.v0.9.4 and ditto-operator.v0.2.0")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status1 := getResource(oc, asAdmin, withoutNamespace, "csv", "etcdoperator.v0.9.4", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status1, "Succeeded") == 0 {
e2e.Logf("csv etcdoperator.v0.9.4 status is Succeeded")
return true, nil
}
e2e.Logf("csv etcdoperator.v0.9.4 status is not Succeeded, go next round")
return false, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "csv", sub.subName, "-n", namespaceName)
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName)
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath={.status}")
}
exutil.AssertWaitPollNoErr(err, "csv etcdoperator.v0.9.4 is not Succeeded")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status2 := getResource(oc, asAdmin, withoutNamespace, "csv", "ditto-operator.v0.2.0", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if (strings.Compare(status2, "Succeeded") == 0) || (strings.Compare(status2, "Installing") == 0) {
e2e.Logf("csv ditto-operator.v0.2.0 status is Succeeded")
return true, nil
}
e2e.Logf("csv ditto-operator.v0.2.0 status is not Succeeded nor Installing, go next round")
return false, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "csv", sub.subName, "-n", namespaceName)
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName)
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath={.status}")
}
exutil.AssertWaitPollNoErr(err, "csv ditto-operator.v0.2.0 is not Succeeded nor Installing")
})
| |||||
test case
|
openshift/openshift-tests-private
|
7dea844e-7314-46a3-ab78-aeaf5d58de65
|
ConnectedOnly-Author:xzha-Medium-47319-olm raised error when Arbitrary Compound Constraints is defined wrongly
|
['"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("ConnectedOnly-Author:xzha-Medium-47319-olm raised error when Arbitrary Compound Constraints is defined wrongly", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrcError = catalogSourceDescription{
name: "catsrc-47319-error",
namespace: namespaceName,
displayName: "Test 47319",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/etcd-index:47319-error",
template: catsrcImageTemplate,
}
subError = subscriptionDescription{
subName: "etcd-47319-error",
namespace: namespaceName,
catalogSourceName: "catsrc-47319-error",
catalogSourceNamespace: namespaceName,
channel: "alpha-1",
ipApproval: "Automatic",
operatorPackage: "etcd",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By(fmt.Sprintf("1) create the catsrc in project: %s", namespaceName))
defer catsrcError.delete(itName, dr)
catsrcError.createWithCheck(oc, itName, dr)
exutil.By("2) install og")
og.createwithCheck(oc, itName, dr)
exutil.By("3) install subError with channel alpha-1")
subError.createWithoutCheck(oc, itName, dr)
newCheck("expect", asUser, withoutNamespace, contain, "ErrorPreventedResolution", ok, []string{"sub", subError.subName, "-n", namespaceName, "-o=jsonpath={.status.conditions[*].reason}"}).check(oc)
conditionsMsg := getResource(oc, asAdmin, withoutNamespace, "sub", subError.subName, "-n", namespaceName, "-o=jsonpath={.status.conditions[*].message}")
o.Expect(conditionsMsg).To(o.ContainSubstring("convert olm.constraint to resolver predicate: ERROR"))
subError.delete(itName, dr)
exutil.By("4) install subError with channel alpha-2")
subError.channel = "alpha-2"
subError.createWithoutCheck(oc, itName, dr)
newCheck("expect", asUser, withoutNamespace, contain, "ConstraintsNotSatisfiable", ok, []string{"sub", subError.subName, "-n", namespaceName, "-o=jsonpath={.status.conditions[*].reason}"}).check(oc)
conditionsMsg = getResource(oc, asAdmin, withoutNamespace, "sub", subError.subName, "-n", namespaceName, "-o=jsonpath={.status.conditions[*].message}")
o.Expect(conditionsMsg).To(o.MatchRegexp("(?i)require to have .*olm.type3.* and olm.package ditto-operator with version >= 0.2.1(?i)"))
subError.delete(itName, dr)
})
| |||||
test case
|
openshift/openshift-tests-private
|
1dcba1e2-a211-4668-8b12-90974bd7a454
|
ConnectedOnly-Author:xzha-Medium-47319-Arbitrary Compound Constraints with AND can be defined as bundle properties with less than
|
['"context"', '"fmt"', '"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:xzha-Medium-47319-Arbitrary Compound Constraints with AND can be defined as bundle properties with less than", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-47319",
namespace: namespaceName,
displayName: "Test 47319",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/etcd-index:47319-and",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "etcd-47319",
namespace: namespaceName,
catalogSourceName: "catsrc-47319",
catalogSourceNamespace: namespaceName,
channel: "alpha-1",
ipApproval: "Automatic",
operatorPackage: "etcd",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By(fmt.Sprintf("1) create the catsrc in project: %s", namespaceName))
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("2) install og")
og.createwithCheck(oc, itName, dr)
exutil.By("3) install sub with channel alpha-1")
sub.create(oc, itName, dr)
exutil.By("4) check csv")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status1 := getResource(oc, asAdmin, withoutNamespace, "csv", "etcdoperator.v0.9.2", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status1, "Succeeded") != 0 {
e2e.Logf("csv etcdoperator.v0.9.2 status is not Succeeded, go next round")
return false, nil
}
status2 := getResource(oc, asAdmin, withoutNamespace, "csv", "ditto-operator.v0.1.1", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if (strings.Compare(status2, "Succeeded") != 0) && (strings.Compare(status2, "Installing") != 0) {
e2e.Logf("csv ditto-operator.v0.1.1 status is not Succeeded nor Installing, go next round")
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath={.status}")
}
exutil.AssertWaitPollNoErr(err, "csv etcdoperator.v0.9.2 or ditto-operator.v0.1.1 is not Succeeded nor Installing")
})
| |||||
test case
|
openshift/openshift-tests-private
|
5fb1dd5f-b156-457a-9a20-14a0f6fc1335
|
ConnectedOnly-Author:xzha-Medium-47319-Arbitrary Compound Constraints with AND can be defined as bundle properties with more than
|
['"context"', '"fmt"', '"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:xzha-Medium-47319-Arbitrary Compound Constraints with AND can be defined as bundle properties with more than", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-47319",
namespace: namespaceName,
displayName: "Test 47319",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/etcd-index:47319-and",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "etcd-47319",
namespace: namespaceName,
catalogSourceName: "catsrc-47319",
catalogSourceNamespace: namespaceName,
channel: "alpha-2",
ipApproval: "Automatic",
operatorPackage: "etcd",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By(fmt.Sprintf("1) create the catsrc in project: %s", namespaceName))
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("2) install og")
og.createwithCheck(oc, itName, dr)
exutil.By("5) install sub with channel alpha-1")
sub.create(oc, itName, dr)
exutil.By("6) check csv")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status1 := getResource(oc, asAdmin, withoutNamespace, "csv", "etcdoperator.v0.9.4", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status1, "Succeeded") != 0 {
e2e.Logf("csv etcdoperator.v0.9.4 status is not Succeeded, go next round")
return false, nil
}
status2 := getResource(oc, asAdmin, withoutNamespace, "csv", "ditto-operator.v0.2.0", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if (strings.Compare(status2, "Succeeded") != 0) && (strings.Compare(status2, "Installing") != 0) {
e2e.Logf("csv ditto-operator.v0.1.1 status is not Succeeded nor Installing, go next round")
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath={.status}")
}
exutil.AssertWaitPollNoErr(err, "csv etcdoperator.v0.9.4 or ditto-operator.v0.2.0 is not Succeeded or Installing")
})
| |||||
test case
|
openshift/openshift-tests-private
|
cb58aaa6-187f-4f9a-bd64-f464ea33ee0e
|
ConnectedOnly-Author:xzha-Medium-47323-Arbitrary Compound Constraints with OR can be defined as bundle properties
|
['"context"', '"fmt"', '"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:xzha-Medium-47323-Arbitrary Compound Constraints with OR can be defined as bundle properties", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrcOr = catalogSourceDescription{
name: "catsrc-47323-or",
namespace: namespaceName,
displayName: "Test 47323 OR",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/etcd-index:47323-or-cache",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "etcd-47323",
namespace: namespaceName,
catalogSourceName: "catsrc-47323-or",
catalogSourceNamespace: namespaceName,
channel: "alpha-1",
ipApproval: "Automatic",
operatorPackage: "etcd",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By(fmt.Sprintf("1) create the catsrc in project: %s", namespaceName))
defer catsrcOr.delete(itName, dr)
catsrcOr.createWithCheck(oc, itName, dr)
exutil.By("2) install og")
og.createwithCheck(oc, itName, dr)
exutil.By("3) test arbitrary compound constraints with OR")
exutil.By("3.1) install sub with channel alpha-1")
sub.create(oc, itName, dr)
exutil.By("3.2) check csv")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status1 := getResource(oc, asAdmin, withoutNamespace, "csv", "etcdoperator.v0.9.2", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status1, "Succeeded") != 0 {
e2e.Logf("csv etcdoperator.v0.9.2 status is not Succeeded, go next round")
return false, nil
}
status2 := getResource(oc, asAdmin, withoutNamespace, "csv", "ditto-operator.v0.1.0", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if (strings.Compare(status2, "Succeeded") != 0) && (strings.Compare(status2, "Installing") != 0) {
e2e.Logf("csv ditto-operator.v0.1.0 status is not Succeeded nor Installing, go next round")
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath={.status}")
}
exutil.AssertWaitPollNoErr(err, "csv etcdoperator.v0.9.2 or ditto-operator.v0.1.0 is not Succeeded")
exutil.By("3.3) switch channel to be alpha-2")
sub.patch(oc, "{\"spec\": {\"channel\": \"alpha-2\"}}")
exutil.By("3.4) check csv")
newCheck("expect", asUser, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "etcdoperator.v0.9.4", "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("3.4) delete all subs and csvs")
sub.findInstalledCSV(oc, itName, dr)
sub.delete(itName, dr)
sub.deleteCSV(itName, dr)
selectorStr := "--selector=operators.coreos.com/ditto-operator." + namespaceName
subDepName := getResource(oc, asAdmin, withoutNamespace, "sub", selectorStr, "-n", sub.namespace, "-o=jsonpath={..metadata.name}")
o.Expect(subDepName).To(o.ContainSubstring("ditto-operator"))
_, err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("sub", subDepName, "-n", oc.Namespace()).Output()
o.Expect(err).NotTo(o.HaveOccurred())
_, err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("csv", "ditto-operator.v0.1.0", "-n", oc.Namespace()).Output()
o.Expect(err).NotTo(o.HaveOccurred())
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 30*time.Second, false, func(ctx context.Context) (bool, error) {
output := getResource(oc, asAdmin, withoutNamespace, "csv", "-n", sub.namespace)
if strings.Contains(output, "ditto-operator.v0.1.0") {
e2e.Logf("csv ditto-operator.v0.1.0 still exist, go next round")
return false, nil
}
output = getResource(oc, asAdmin, withoutNamespace, "sub", "-n", sub.namespace)
if strings.Contains(output, subDepName) {
e2e.Logf("sub still exist, go next round")
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, "delete sub and csv failed")
})
| |||||
test case
|
openshift/openshift-tests-private
|
d6cfbdb2-196e-422f-a663-bf798879325d
|
ConnectedOnly-Author:xzha-Medium-47323-Arbitrary Compound Constraints with NOT can be defined as bundle properties
|
['"context"', '"fmt"', '"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:xzha-Medium-47323-Arbitrary Compound Constraints with NOT can be defined as bundle properties", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrcNot = catalogSourceDescription{
name: "catsrc-47323-not",
namespace: namespaceName,
displayName: "Test 47323 NOT",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/etcd-index:47323-not-cache",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "etcd-47323",
namespace: namespaceName,
catalogSourceName: "catsrc-47323-not",
catalogSourceNamespace: namespaceName,
channel: "alpha-1",
ipApproval: "Automatic",
operatorPackage: "etcd",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By(fmt.Sprintf("1) create the catsrc in project: %s", namespaceName))
defer catsrcNot.delete(itName, dr)
catsrcNot.createWithCheck(oc, itName, dr)
exutil.By("2) install og")
og.createwithCheck(oc, itName, dr)
exutil.By("3) test arbitrary compound constraints with Not")
exutil.By("3.1) install sub with channel alpha-1")
sub.channel = "alpha-1"
sub.create(oc, itName, dr)
exutil.By("3.2) check csv")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status1 := getResource(oc, asAdmin, withoutNamespace, "csv", "etcdoperator.v0.9.2", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status1, "Succeeded") != 0 {
e2e.Logf("csv etcdoperator.v0.9.2 status is not Succeeded, go next round")
return false, nil
}
status2 := getResource(oc, asAdmin, withoutNamespace, "csv", "ditto-operator.v0.1.0", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if (strings.Compare(status2, "Succeeded") != 0) && (strings.Compare(status2, "Installing") != 0) {
e2e.Logf("csv ditto-operator.v0.1.0 status is not Succeeded nor Installing, go next round")
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath={.status}")
}
exutil.AssertWaitPollNoErr(err, "csv etcdoperator.v0.9.2 or ditto-operator.v0.1.0 is not Succeeded")
exutil.By("3.3) delete sub etcd-47323 and csv etcdoperator.v0.9.2")
sub.findInstalledCSV(oc, itName, dr)
sub.delete(itName, dr)
sub.deleteCSV(itName, dr)
exutil.By("3.4) install sub with channel alpha-2")
sub.channel = "alpha-2"
sub.createWithoutCheck(oc, itName, dr)
exutil.By("3.5) check sub")
newCheck("expect", asUser, withoutNamespace, contain, "ConstraintsNotSatisfiable", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].reason}"}).check(oc)
newCheck("expect", asUser, withoutNamespace, contain, "require to not have ", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].message}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
d6f393ae-289c-494e-9232-3068f2bfe5ec
|
ConnectedOnly-Author:xzha-Medium-69986-OLM emits alert events for operators installed from a deprecated channel
|
['"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("ConnectedOnly-Author:xzha-Medium-69986-OLM emits alert events for operators installed from a deprecated channel", func() {
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-69986",
namespace: namespaceName,
displayName: "Test 69986",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/olmtest-operator-index:nginx69986",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "sub-69986",
namespace: namespaceName,
catalogSourceName: "",
catalogSourceNamespace: "",
channel: "",
ipApproval: "Automatic",
operatorPackage: "nginx69986",
singleNamespace: true,
template: subTemplate,
}
)
sub.catalogSourceNamespace = catsrc.namespace
sub.catalogSourceName = catsrc.name
itName := g.CurrentSpecReport().FullText()
exutil.By(fmt.Sprintf("1) create the catsrc in project: %s", namespaceName))
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("2) packagemanifests")
message := getResource(oc, asAdmin, withoutNamespace, "packagemanifests", "nginx69986", "-n", catsrc.namespace, `-o=jsonpath='{.status.channels[?(@.name=="candidate-v0.0")].deprecation}`)
o.Expect(string(message)).To(o.ContainSubstring(`has been deprecated`))
message = getResource(oc, asAdmin, withoutNamespace, "packagemanifests", "nginx69986", "-n", catsrc.namespace, `-o=jsonpath={.status.channels[?(@.name=="candidate-v1.0")].entries[?(@.name=="nginx69986.v1.0.3")].deprecation}`)
o.Expect(string(message)).To(o.ContainSubstring(`has been deprecated`))
exutil.By("3) install og")
og.createwithCheck(oc, itName, dr)
exutil.By("4) install sub with channel candidate-v0.0")
sub.channel = "candidate-v0.0"
sub.create(oc, itName, dr)
exutil.By("4.1 check csv")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", "nginx69986.v0.0.1", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status, "Succeeded") != 0 {
e2e.Logf("csv nginx69986.v0.0.1 status is not Succeeded, go next round")
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath-as-json={.status}")
}
exutil.AssertWaitPollNoErr(err, "csv nginx69986.v0.0.1 is not Succeeded")
exutil.By("4.2 check sub status")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
conditions := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].type}")
if !strings.Contains(conditions, "ChannelDeprecated") || !strings.Contains(conditions, "Deprecated") {
return false, nil
}
messages := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].message}")
if !strings.Contains(messages, "has been deprecated. Please switch to a different one") {
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath-as-json={.status.conditions}")
}
exutil.AssertWaitPollNoErr(err, "the conditions of sub is not correct")
exutil.By("4.3) delete sub and csv")
sub.findInstalledCSV(oc, itName, dr)
sub.delete(itName, dr)
sub.deleteCSV(itName, dr)
exutil.By("5) install sub with channel candidate-v1.0")
sub.channel = "candidate-v1.0"
sub.startingCSV = "nginx69986.v1.0.2"
sub.createWithoutCheck(oc, itName, dr)
exutil.By("5.1 check csv is updated to nginx69986.v1.0.3")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", "nginx69986.v1.0.3", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status, "Succeeded") != 0 {
e2e.Logf("csv nginx69986.v1.0.3 status is not Succeeded, go next round")
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath-as-json={.status}")
}
exutil.AssertWaitPollNoErr(err, "csv nginx69986.v1.0.3 is not Succeeded")
exutil.By("5.2 check sub status")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
conditions := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].type}")
if !strings.Contains(conditions, "BundleDeprecated") || !strings.Contains(conditions, "Deprecated") {
return false, nil
}
messages := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].message}")
if !strings.Contains(messages, "has been deprecated") {
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath-as-json={.status.conditions}")
}
exutil.AssertWaitPollNoErr(err, "the conditions of sub is not correct")
exutil.By("6) update sub to channel candidate-v1.1")
sub.patch(oc, `{"spec": {"channel": "candidate-v1.1"}}`)
exutil.By("6.1 check csv is updated to nginx69986.v1.1.1")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", "nginx69986.v1.1.1", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status, "Succeeded") != 0 {
e2e.Logf("csv nginx69986.v1.1.1 status is not Succeeded, go next round")
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath-as-json={.status}")
}
exutil.AssertWaitPollNoErr(err, "csv nginx69986.v1.1.1 is not Succeeded")
exutil.By("6.2 check sub status")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
conditions := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].type}")
if strings.Contains(conditions, "BundleDeprecated") || strings.Contains(conditions, "Deprecated") {
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath-as-json={.status.conditions}")
}
exutil.AssertWaitPollNoErr(err, "the conditions of sub is not correct, still has BundleDeprecated or Deprecated")
})
| |||||
test case
|
openshift/openshift-tests-private
|
25a2cdda-84db-4b3c-a182-a191a893e00a
|
ConnectedOnly-Author:xzha-Medium-70050-OLM emits alert events for operators installed from a deprecated channel if catalog in different ns [Serial]
|
['"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("ConnectedOnly-Author:xzha-Medium-70050-OLM emits alert events for operators installed from a deprecated channel if catalog in different ns [Serial]", func() {
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-70050",
namespace: "openshift-marketplace",
displayName: "Test 70050",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/olmtest-operator-index:nginx70050",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "sub-70050",
namespace: namespaceName,
catalogSourceName: "",
catalogSourceNamespace: "",
channel: "candidate-v1.0",
ipApproval: "Automatic",
operatorPackage: "nginx70050",
singleNamespace: true,
template: subTemplate,
}
)
sub.catalogSourceNamespace = catsrc.namespace
sub.catalogSourceName = catsrc.name
itName := g.CurrentSpecReport().FullText()
exutil.By(fmt.Sprintf("1) create the catsrc in project: %s", catsrc.namespace))
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("2) packagemanifests")
message := getResource(oc, asAdmin, withoutNamespace, "packagemanifests", "nginx70050", "-n", catsrc.namespace, `-o=jsonpath='{.status.deprecation}`)
o.Expect(string(message)).To(o.ContainSubstring(`has been deprecated`))
message = getResource(oc, asAdmin, withoutNamespace, "packagemanifests", "nginx70050", "-n", catsrc.namespace, `-o=jsonpath='{.status.channels[?(@.name=="candidate-v1.0")].deprecation}`)
o.Expect(string(message)).To(o.ContainSubstring(`has been deprecated`))
message = getResource(oc, asAdmin, withoutNamespace, "packagemanifests", "nginx70050", "-n", catsrc.namespace, `-o=jsonpath={.status.channels[?(@.name=="candidate-v1.0")].entries[?(@.name=="nginx70050.v1.0.1")].deprecation}`)
o.Expect(string(message)).To(o.ContainSubstring(`has been deprecated`))
exutil.By("3) install og")
og.createwithCheck(oc, itName, dr)
exutil.By("4) install sub with channel candidate-v1.0")
sub.create(oc, itName, dr)
exutil.By("4.1 check csv")
var status string
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "nginx70050.v1.0.1", "-n", sub.namespace, "-o=jsonpath={.status.phase}").Output()
if strings.Compare(status, "Succeeded") != 0 {
e2e.Logf("csv nginx70050.v1.0.1 status is not Succeeded, go next round")
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath-as-json={.status}")
if strings.Contains(status, "Unable to connect to the server: proxyconnect tcp") {
exutil.AssertWaitPollNoErr(err, status)
}
}
exutil.AssertWaitPollNoErr(err, "csv nginx70050.v1.0.1 is not Succeeded")
exutil.By("4.2 check sub status")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
conditions := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].type}")
if !strings.Contains(conditions, "Deprecated") || !strings.Contains(conditions, "ChannelDeprecated") || !strings.Contains(conditions, "PackageDeprecated") || !strings.Contains(conditions, "BundleDeprecated") {
return false, nil
}
messages := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].message}")
if !strings.Contains(messages, "has been deprecated") {
return false, nil
}
return true, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", namespaceName, "-o=jsonpath-as-json={.status.conditions}")
}
exutil.AssertWaitPollNoErr(err, "the conditions of sub is not correct")
})
| |||||
test case
|
openshift/openshift-tests-private
|
4a29869a-523d-48e0-92ce-ca425af660f0
|
ConnectedOnly-Author:xzha-High-43114-Subscription status should show the message for InstallPlan failure conditions
|
['"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:xzha-High-43114-Subscription status should show the message for InstallPlan failure conditions", func() {
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSAtemplate := filepath.Join(buildPruningBaseDir, "operatorgroup-serviceaccount.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
namespace := oc.Namespace()
og := operatorGroupDescription{
name: "test-og-43114",
namespace: namespace,
serviceAccountName: "scoped-43114",
template: ogSAtemplate,
}
catsrc := catalogSourceDescription{
name: "catsrc-43114",
namespace: namespace,
displayName: "Test Catsrc 43114 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginxolm-operator-index:v1",
template: catsrcImageTemplate,
}
sub := subscriptionDescription{
subName: "nginx-operator-43114",
namespace: namespace,
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: namespace,
template: subTemplate,
singleNamespace: true,
}
dr := make(describerResrouce)
itName := g.CurrentSpecReport().FullText()
dr.addIr(itName)
exutil.By("1) Create the OperatorGroup")
og.createwithCheck(oc, itName, dr)
exutil.By("2) create catalog source")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("3) Create a Subscription")
sub.createWithoutCheck(oc, itName, dr)
exutil.By("4) check install plan message")
ip := sub.getIP(oc)
msg := ""
errorText := "no operator group found"
waitErr := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("installplan", ip, "-n", oc.Namespace(), "-o=jsonpath={..status.conditions}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(strings.ToLower(msg), errorText) {
e2e.Logf("InstallPlan has the expected error")
return true, nil
}
e2e.Logf(msg)
return false, nil
})
exutil.AssertWaitPollNoErr(waitErr, fmt.Sprintf("The installplan %s did not include expected message. The message was instead %s", ip, msg))
exutil.By("5) Check sub message")
msg, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", oc.Namespace(), "-o=jsonpath={.status.conditions}").Output()
o.Expect(strings.Contains(strings.ToLower(msg), errorText)).To(o.BeTrue())
e2e.Logf("subscription also has the expected error")
exutil.By("Finished")
})
| |||||
test case
|
openshift/openshift-tests-private
|
70cc6c16-feb9-4a84-9432-03417b760e17
|
Author:kuiwang-ConnectedOnly-ROSA-OSD_CCS-ARO-Medium-60114-olm serves an api to discover all versions of an operator
|
['"os"', '"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:kuiwang-ConnectedOnly-ROSA-OSD_CCS-ARO-Medium-60114-olm serves an api to discover all versions of an operator", func() {
architecture.SkipArchitectures(oc, architecture.PPC64LE, architecture.S390X, architecture.MULTI)
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, "ibmcloud") || strings.Contains(platform, "nutanix") || 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")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
catsrc = catalogSourceDescription{
name: "catsrc-run1399-operator",
namespace: "",
displayName: "Test Catsrc RUN1399 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "",
template: catsrcImageTemplate,
}
)
catsrc.namespace = oc.Namespace()
ok1AlphaAssertion := func(entries string) {
o.Expect(entries).To(o.ContainSubstring("nginx-ok1-1399.v0.0.4"))
o.Expect(entries).To(o.ContainSubstring("nginx-ok1-1399.v0.0.2"))
o.Expect(entries).To(o.ContainSubstring("nginx-ok1-1399.v0.0.1"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok1-1399.v0.0.5"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok1-1399.v0.0.3"))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.4\""))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.2\""))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.1\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.5\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.3\""))
}
ok1BetaAssertion := func(entries string) {
o.Expect(entries).To(o.ContainSubstring("nginx-ok1-1399.v0.0.5"))
o.Expect(entries).To(o.ContainSubstring("nginx-ok1-1399.v0.0.3"))
o.Expect(entries).To(o.ContainSubstring("nginx-ok1-1399.v0.0.1"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok1-1399.v0.0.4"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok1-1399.v0.0.2"))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.5\""))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.3\""))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.1\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.4\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.2\""))
}
ok2AlphaNoDepAssertion := func(entries string) {
o.Expect(entries).To(o.ContainSubstring("nginx-ok2-1399.v0.0.4"))
o.Expect(entries).To(o.ContainSubstring("nginx-ok2-1399.v0.0.2"))
o.Expect(entries).To(o.ContainSubstring("nginx-ok2-1399.v0.0.1"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.5"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.3"))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.4\""))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.2\""))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.1\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.5\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.3\""))
}
ok2BetaAssertion := func(entries string) {
o.Expect(entries).To(o.ContainSubstring("nginx-ok2-1399.v0.0.5"))
o.Expect(entries).To(o.ContainSubstring("nginx-ok2-1399.v0.0.3"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.4"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.2"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.1"))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.5\""))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.3\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.4\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.2\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.1\""))
}
exutil.By("fbc based image without deprecated bundle")
catsrc.address = "quay.io/olmqe/nginx-ok-index:v1399-fbc-multi"
catsrc.createWithCheck(oc, itName, dr)
entries := getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok1-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"alpha\")].entries}")
ok1AlphaAssertion(entries)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok1-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"beta\")].entries}")
ok1BetaAssertion(entries)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok2-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"alpha\")].entries}")
ok2AlphaNoDepAssertion(entries)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok2-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"beta\")].entries}")
ok2BetaAssertion(entries)
catsrc.delete(itName, dr)
exutil.By("ffbc based image with deprecated bundle made by properties.yaml")
catsrc.address = "quay.io/olmqe/nginx-ok-index:v1399-fbc-deprecate-nomigrate-multi"
catsrc.createWithCheck(oc, itName, dr)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok1-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"alpha\")].entries}")
ok1AlphaAssertion(entries)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok1-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"beta\")].entries}")
ok1BetaAssertion(entries)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok2-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"alpha\")].entries}")
o.Expect(entries).To(o.ContainSubstring("nginx-ok2-1399.v0.0.4"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.2"))
o.Expect(entries).To(o.ContainSubstring("nginx-ok2-1399.v0.0.1"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.5"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.3"))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.4\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.2\""))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.1\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.5\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.3\""))
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok2-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"beta\")].entries}")
ok2BetaAssertion(entries)
catsrc.delete(itName, dr)
exutil.By("sqlite based image without deprecated bundle")
catsrc.address = "quay.io/olmqe/nginx-ok-index:v1399-sql"
defer exutil.RecoverNamespaceRestricted(oc, oc.Namespace())
exutil.SetNamespacePrivileged(oc, oc.Namespace())
catsrc.createWithCheck(oc, itName, dr)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok1-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"alpha\")].entries}")
ok1AlphaAssertion(entries)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok1-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"beta\")].entries}")
ok1BetaAssertion(entries)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok2-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"alpha\")].entries}")
ok2AlphaNoDepAssertion(entries)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok2-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"beta\")].entries}")
ok2BetaAssertion(entries)
catsrc.delete(itName, dr)
exutil.By("sqlite based image with deprecated bundle made by deprecatetruncate")
catsrc.address = "quay.io/olmqe/nginx-ok-index:v1399-sql-deprecate"
catsrc.createWithCheck(oc, itName, dr)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok1-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"alpha\")].entries}")
ok1AlphaAssertion(entries)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok1-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"beta\")].entries}")
ok1BetaAssertion(entries)
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok2-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"alpha\")].entries}")
o.Expect(entries).To(o.ContainSubstring("nginx-ok2-1399.v0.0.4"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.2"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.1"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.5"))
o.Expect(entries).NotTo(o.ContainSubstring("nginx-ok2-1399.v0.0.3"))
o.Expect(entries).To(o.ContainSubstring("\"version\":\"0.0.4\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.2\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.1\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.5\""))
o.Expect(entries).NotTo(o.ContainSubstring("\"version\":\"0.0.3\""))
entries = getResourceNoEmpty(oc, asAdmin, withoutNamespace, "packagemanifest", "nginx-ok2-1399", "-n", catsrc.namespace, "-o=jsonpath={.status.channels[?(@.name==\"beta\")].entries}")
ok2BetaAssertion(entries)
})
| |||||
test case
|
openshift/openshift-tests-private
|
533b3a87-34c7-41dc-bf0a-bec37447f711
|
Author:kuiwang-NonHyperShiftHOST-ROSA-OSD_CCS-ARO-Medium-62974-olm sets invalid scc label on its namespaces
|
['"fmt"', '"github.com/tidwall/gjson"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("Author:kuiwang-NonHyperShiftHOST-ROSA-OSD_CCS-ARO-Medium-62974-olm sets invalid scc label on its namespaces", func() {
exutil.By("https://issues.redhat.com/browse/OCPBUGS-948 automated")
labelKey := "openshift\\.io\\/scc"
for _, ns := range []string{"openshift-operators", "openshift-operator-lifecycle-manager"} {
exutil.By("check label openshift.io/scc is empty on " + ns)
sccLabel, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("namespace", ns, "-o=jsonpath={.metadata.labels}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(sccLabel).NotTo(o.BeEmpty())
e2e.Logf("the lables: %v", sccLabel)
gResult := gjson.Get(sccLabel, labelKey)
if gResult.Exists() && gResult.String() != "" {
o.Expect("the value of label openshift.io/scc").To(o.BeEmpty(), fmt.Sprintf("there is label openshift.io/scc on %v and is not empty on", ns))
}
}
})
| |||||
test case
|
openshift/openshift-tests-private
|
90346384-4102-42cc-af8d-b3ce8159d73d
|
NonHyperShiftHOST-ConnectedOnly-NonPreRelease-Longduration-Author:kuiwang-Medium-62973-dedicated way collect profiles cronjob pod missing target.workload.openshift.io management annotation[Disruptive]
|
['"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-NonPreRelease-Longduration-Author:kuiwang-Medium-62973-dedicated way collect profiles cronjob pod missing target.workload.openshift.io management annotation[Disruptive]", func() {
exutil.By("https://issues.redhat.com/browse/OCPBUGS-1088 automated")
if !exutil.IsSNOCluster(oc) {
g.Skip("it is not sno cluster, so skip it")
}
exutil.By("check if the current mcp is ready, or else skip")
assertOrCheckMCP(oc, "master", 10, 1, true)
exutil.By("check if it is aleady in workload partition")
wordLoadPartition, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.items[*].metadata.annotations}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(wordLoadPartition, "resources.workload.openshift.io/collect-profiles") {
e2e.Logf("it already works")
return
}
var (
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
mcWordloadPartiation = filepath.Join(buildPruningBaseDir, "mc-workload-partition.yaml")
)
exutil.By("apply MchineConfig to set workload partition")
defer func() {
exutil.By("wait mcp recovered")
assertOrCheckMCP(oc, "master", 240, 30, false)
}()
defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("-f", mcWordloadPartiation).Execute()
err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", mcWordloadPartiation).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("check mcp updated successfully")
assertOrCheckMCP(oc, "master", 180, 30, false)
exutil.By("check resources.workload.openshift.io/collect-profiles")
o.Eventually(func() string {
annotation, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.items[*].metadata.annotations}").Output()
return annotation
}, 20*time.Minute, 1*time.Minute).Should(o.ContainSubstring("resources.workload.openshift.io/collect-profiles"))
})
| |||||
test case
|
openshift/openshift-tests-private
|
da6c0a9b-cf40-4c4e-bb62-44580f9c0847
|
NonHyperShiftHOST-Author:kuiwang-Medium-62973-general way collect profiles cronjob pod missing target.workload.openshift.io management annotation
|
['"time"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("NonHyperShiftHOST-Author:kuiwang-Medium-62973-general way collect profiles cronjob pod missing target.workload.openshift.io management annotation", func() {
exutil.By("https://issues.redhat.com/browse/OCPBUGS-1088 automated")
exutil.By("check target.workload.openshift.io/management")
o.Eventually(func() string {
annotation, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("CronJob", "collect-profiles", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.spec.jobTemplate.spec.template.metadata.annotations}").Output()
return annotation
}, 20*time.Second, 2*time.Second).Should(o.ContainSubstring("target.workload.openshift.io/management"))
})
| |||||
test case
|
openshift/openshift-tests-private
|
5f56ca3c-7449-4ab4-821c-5e78e0f1d576
|
ConnectedOnly-Author:kuiwang-High-22226-the csv without support AllNamespaces fails for og with allnamespace
|
['"path/filepath"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("ConnectedOnly-Author:kuiwang-High-22226-the csv without support AllNamespaces fails for og with allnamespace", func() {
var (
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
cmNcTemplate = filepath.Join(buildPruningBaseDir, "cm-namespaceconfig.yaml")
catsrcCmTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-configmap.yaml")
ogAllTemplate = filepath.Join(buildPruningBaseDir, "og-allns.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
itName = g.CurrentSpecReport().FullText()
og = operatorGroupDescription{
name: "og-allnamespace",
namespace: "",
template: ogAllTemplate,
}
cm = configMapDescription{
name: "cm-community-namespaceconfig-operators",
namespace: "", //must be set in iT
template: cmNcTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-community-namespaceconfig-operators",
namespace: "", //must be set in iT
displayName: "Community namespaceconfig Operators",
publisher: "Community",
sourceType: "configmap",
address: "cm-community-namespaceconfig-operators",
template: catsrcCmTemplate,
}
sub = subscriptionDescription{
subName: "namespace-configuration-operator",
namespace: "", //must be set in iT
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "namespace-configuration-operator",
catalogSourceName: "catsrc-community-namespaceconfig-operators",
catalogSourceNamespace: "", //must be set in iT
startingCSV: "",
currentCSV: "namespace-configuration-operator.v0.1.0", //it matches to that in cm, so set it.
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
)
cm.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
og.namespace = oc.Namespace()
exutil.By("Create cm")
cm.create(oc, itName, dr)
exutil.By("Create catalog source")
catsrc.create(oc, itName, dr)
exutil.By("Create og")
og.create(oc, itName, dr)
exutil.By("Create sub")
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, contain, "AllNamespaces InstallModeType not supported", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.message}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
62a2f2a7-9e52-47cc-a4d9-0f23c76c84f2
|
ConnectedOnly-Author:kuiwang-High-22226-the csv without support MultiNamespace fails for og with MultiNamespace
|
['"path/filepath"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("ConnectedOnly-Author:kuiwang-High-22226-the csv without support MultiNamespace fails for og with MultiNamespace", func() {
var (
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
cmNcTemplate = filepath.Join(buildPruningBaseDir, "cm-namespaceconfig.yaml")
catsrcCmTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-configmap.yaml")
ogMultiTemplate = filepath.Join(buildPruningBaseDir, "og-multins.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
itName = g.CurrentSpecReport().FullText()
og = operatorGroupDescription{
name: "og-multinamespace",
namespace: "",
multinslabel: "olmtestmultins",
template: ogMultiTemplate,
}
cm = configMapDescription{
name: "cm-community-namespaceconfig-operators",
namespace: "", //must be set in iT
template: cmNcTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-community-namespaceconfig-operators",
namespace: "", //must be set in iT
displayName: "Community namespaceconfig Operators",
publisher: "Community",
sourceType: "configmap",
address: "cm-community-namespaceconfig-operators",
template: catsrcCmTemplate,
}
sub = subscriptionDescription{
subName: "namespace-configuration-operator",
namespace: "", //must be set in iT
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "namespace-configuration-operator",
catalogSourceName: "catsrc-community-namespaceconfig-operators",
catalogSourceNamespace: "", //must be set in iT
startingCSV: "",
currentCSV: "namespace-configuration-operator.v0.1.0", //it matches to that in cm, so set it.
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
p1 = projectDescription{
name: "olm-enduser-multins-csv-1-fail",
targetNamespace: "",
}
p2 = projectDescription{
name: "olm-enduser-multins-csv-2-fail",
targetNamespace: "",
}
)
defer p1.delete(oc)
defer p2.delete(oc)
cm.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
og.namespace = oc.Namespace()
p1.targetNamespace = oc.Namespace()
p2.targetNamespace = oc.Namespace()
exutil.By("Create new project")
p1.create(oc, itName, dr)
p1.label(oc, "olmtestmultins")
p2.create(oc, itName, dr)
p2.label(oc, "olmtestmultins")
exutil.By("Create cm")
cm.create(oc, itName, dr)
exutil.By("Create catalog source")
catsrc.create(oc, itName, dr)
exutil.By("Create og")
og.create(oc, itName, dr)
exutil.By("Create sub")
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, contain, "MultiNamespace InstallModeType not supported", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.message}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
9ef3ceba-51c7-4eaa-8cbe-07f10eb98736
|
NonHyperShiftHOST-ConnectedOnly-Author:kuiwang-Medium-71119-pod does not start for installing operator of multi-ns mode when og is in one of the ns
|
['"os"', '"strconv"', '"path/filepath"', '"strings"', '"time"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("NonHyperShiftHOST-ConnectedOnly-Author:kuiwang-Medium-71119-pod does not start for installing operator of multi-ns mode when og is in one of the ns", func() {
exutil.SkipForSNOCluster(oc)
exutil.SkipBaselineCaps(oc, "None")
exutil.SkipNoCapabilities(oc, "marketplace")
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")
}
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, "ibmcloud") || strings.Contains(platform, "nutanix") || 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")
}
e2e.Logf("it is for bug https://issues.redhat.com/browse/OCPBUGS-25989")
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogMultiTemplate = filepath.Join(buildPruningBaseDir, "og-multins.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
og = operatorGroupDescription{
name: "og-71119",
namespace: "test-ns71119-1",
multinslabel: "label-71119",
template: ogMultiTemplate,
}
p1 = projectDescription{
name: "test-ns71119-1",
targetNamespace: "test-ns71119-1",
}
p2 = projectDescription{
name: "test-ns71119-2",
targetNamespace: "test-ns71119-1",
}
subSample = subscriptionDescription{
subName: "amq-broker-rhel8-0c",
namespace: "test-ns71119-1",
catalogSourceName: "redhat-operators",
catalogSourceNamespace: "openshift-marketplace",
channel: "7.11.x",
ipApproval: "Automatic",
operatorPackage: "amq-broker-rhel8",
template: subTemplate,
}
)
csvs, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "-A").Output()
if strings.Contains(csvs, subSample.operatorPackage) {
g.Skip("the amq-broker-rhel8 is installed, so skip it")
}
packageName, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "-n", subSample.catalogSourceNamespace, "-l", "catalog="+subSample.catalogSourceName,
"--field-selector", "metadata.name="+subSample.operatorPackage).Output()
if !strings.Contains(packageName, subSample.operatorPackage) {
g.Skip("no reqruied package amq-broker-rhel8, so skip it")
}
channelDefault, errGet := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "-n", subSample.catalogSourceNamespace, "-l", "catalog="+subSample.catalogSourceName,
"--field-selector", "metadata.name="+subSample.operatorPackage, "-o=jsonpath={.items[0].status.defaultChannel}").Output()
o.Expect(errGet).NotTo(o.HaveOccurred())
o.Expect(channelDefault).NotTo(o.BeEmpty())
subSample.channel = channelDefault
exutil.By("create two ns and og")
defer p1.delete(oc)
p1.create(oc, itName, dr)
p1.label(oc, "label-71119")
defer p2.delete(oc)
p2.create(oc, itName, dr)
p2.label(oc, "label-71119")
og.create(oc, itName, dr)
exutil.By("subscribe to operator with multinamespaces mode")
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", subSample.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
podName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", subSample.namespace,
"-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(podName).NotTo(o.BeEmpty())
o.Consistently(func() int {
restartCount, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", podName, "-n", subSample.namespace, "-o=jsonpath={.status..restartCount}").Output()
if strings.Contains(restartCount, "NotFound") {
return 0
}
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(restartCount).NotTo(o.BeEmpty())
count, err := strconv.Atoi(strings.Fields(restartCount)[0])
o.Expect(err).NotTo(o.HaveOccurred())
return count
}, 150*time.Second, 10*time.Second).Should(o.Equal(0), "the pod restart")
})
| |||||
test case
|
openshift/openshift-tests-private
|
8275c61b-9c3b-4862-ab27-63aefe656cae
|
Author:kuiwang-NonHyperShiftHOST-ROSA-OSD_CCS-ARO-ConnectedOnly-Medium-29275-label to target namespace of operator group with multi namespace
|
['"path/filepath"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("Author:kuiwang-NonHyperShiftHOST-ROSA-OSD_CCS-ARO-ConnectedOnly-Medium-29275-label to target namespace of operator group with multi namespace", func() {
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogMultiTemplate = filepath.Join(buildPruningBaseDir, "og-multins.yaml")
og = operatorGroupDescription{
name: "og-1651-1",
namespace: "",
multinslabel: "test-og-label-1651",
template: ogMultiTemplate,
}
p1 = projectDescription{
name: "test-ns1651-1",
targetNamespace: "",
}
p2 = projectDescription{
name: "test-ns1651-2",
targetNamespace: "",
}
)
//oc.TeardownProject()
oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach
p1.targetNamespace = oc.Namespace()
p2.targetNamespace = oc.Namespace()
og.namespace = oc.Namespace()
exutil.By("Create new projects and label them")
defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("ns", p1.name, "--ignore-not-found").Execute()
err := oc.AsAdmin().WithoutNamespace().Run("create").Args("ns", p1.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
p1.label(oc, "test-og-label-1651")
defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("ns", p2.name, "--ignore-not-found").Execute()
err = oc.AsAdmin().WithoutNamespace().Run("create").Args("ns", p2.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
p2.label(oc, "test-og-label-1651")
exutil.By("Create og and check the label")
og.create(oc, itName, dr)
ogUID := getResource(oc, asAdmin, withNamespace, "og", og.name, "-o=jsonpath={.metadata.uid}")
newCheck("expect", asAdmin, withoutNamespace, contain, "olm.operatorgroup.uid/"+ogUID, ok,
[]string{"ns", p1.name, "-o=jsonpath={.metadata.labels}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "olm.operatorgroup.uid/"+ogUID, ok,
[]string{"ns", p2.name, "-o=jsonpath={.metadata.labels}"}).check(oc)
exutil.By("delete og and check there is no label")
og.delete(itName, dr)
newCheck("expect", asAdmin, withoutNamespace, contain, "olm.operatorgroup.uid/"+ogUID, nok,
[]string{"ns", p1.name, "-o=jsonpath={.metadata.labels}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "olm.operatorgroup.uid/"+ogUID, nok,
[]string{"ns", p2.name, "-o=jsonpath={.metadata.labels}"}).check(oc)
exutil.By("create another og to check the label")
og.name = "og-1651-2"
og.create(oc, itName, dr)
ogUID = getResource(oc, asAdmin, withNamespace, "og", og.name, "-o=jsonpath={.metadata.uid}")
newCheck("expect", asAdmin, withoutNamespace, contain, "olm.operatorgroup.uid/"+ogUID, ok,
[]string{"ns", p1.name, "-o=jsonpath={.metadata.labels}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "olm.operatorgroup.uid/"+ogUID, ok,
[]string{"ns", p2.name, "-o=jsonpath={.metadata.labels}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
05712f36-cb58-4e07-ac17-1dd6cdd58f14
|
Author:kuiwang-NonHyperShiftHOST-ConnectedOnly-Medium-22200-add minimum kube version to CSV [Slow]
|
['"context"', '"fmt"', '"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-22200-add minimum kube version to CSV [Slow]", func() {
checkArch := architecture.ClusterArchitecture(oc)
e2e.Logf("the curent arch is %v", checkArch.String())
architecture.SkipNonAmd64SingleArch(oc)
e2e.Logf("done for SkipNonAmd64SingleArch and try the following method which is same to SkipNonAmd64SingleArch")
architecture.SkipArchitectures(oc, architecture.PPC64LE, architecture.S390X, architecture.MULTI, architecture.ARM64, architecture.UNKNOWN)
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")
ogTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
cmNcTemplate = filepath.Join(buildPruningBaseDir, "cm-namespaceconfig.yaml")
catsrcCmTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-configmap.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogTemplate,
}
cmNc = configMapDescription{
name: "cm-community-namespaceconfig-operators",
namespace: "", //must be set in iT
template: cmNcTemplate,
}
catsrcNc = catalogSourceDescription{
name: "catsrc-community-namespaceconfig-operators",
namespace: "", //must be set in iT
displayName: "Community namespaceconfig Operators",
publisher: "Community",
sourceType: "configmap",
address: "cm-community-namespaceconfig-operators",
template: catsrcCmTemplate,
}
subNc = subscriptionDescription{
subName: "namespace-configuration-operator",
namespace: "", //must be set in iT
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "namespace-configuration-operator",
catalogSourceName: "catsrc-community-namespaceconfig-operators",
catalogSourceNamespace: "", //must be set in iT
startingCSV: "",
currentCSV: "namespace-configuration-operator.v0.1.0", //it matches to that in cm, so set it.
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
cm = cmNc
catsrc = catsrcNc
sub = subNc
)
//oc.TeardownProject()
oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach
cm.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
og.namespace = oc.Namespace()
exutil.By("Create og")
og.create(oc, itName, dr)
exutil.By("Create configmap of csv")
cm.create(oc, itName, dr)
exutil.By("Get minKubeVersionRequired and kubeVersionUpdated")
output := getResource(oc, asUser, withoutNamespace, "cm", cm.name, "-o=json")
csvDesc := strings.TrimSuffix(strings.TrimSpace(strings.SplitN(strings.SplitN(output, "\"clusterServiceVersions\": ", 2)[1], "\"customResourceDefinitions\":", 2)[0]), ",")
o.Expect(strings.Contains(csvDesc, "minKubeVersion:")).To(o.BeTrue())
minKubeVersionRequired := strings.TrimSpace(strings.SplitN(strings.SplitN(csvDesc, "minKubeVersion:", 2)[1], "\\n", 2)[0])
kubeVersionUpdated := generateUpdatedKubernatesVersion(oc)
e2e.Logf("the kubeVersionUpdated version is %s, and minKubeVersionRequired is %s", kubeVersionUpdated, minKubeVersionRequired)
exutil.By("Create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("Update the minKubeVersion greater than the cluster KubeVersion")
cm.patch(oc, fmt.Sprintf("{\"data\": {\"clusterServiceVersions\": %s}}", strings.ReplaceAll(csvDesc, "minKubeVersion: "+minKubeVersionRequired, "minKubeVersion: "+kubeVersionUpdated)))
exutil.By("Create sub with greater KubeVersion")
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, contain, "not met+2+less than", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.requirementStatus[?(@.kind==\"ClusterServiceVersion\")].message}"}).check(oc)
exutil.By("Remove sub and csv and update the minKubeVersion to orignl")
sub.delete(itName, dr)
sub.deleteCSV(itName, dr)
cm.patch(oc, fmt.Sprintf("{\"data\": {\"clusterServiceVersions\": %s}}", csvDesc))
exutil.By("Create sub with orignal KubeVersion")
sub.create(oc, itName, dr)
err := wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) {
csvPhase := getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Contains(csvPhase, "Succeeded") {
e2e.Logf("sub is installed")
return true, nil
}
return false, nil
})
if err != nil {
msg := getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.requirementStatus[?(@.kind==\"ClusterServiceVersion\")].message}")
if strings.Contains(msg, "CSV version requirement not met") && !strings.Contains(msg, kubeVersionUpdated) {
e2e.Failf("the csv can not be installed with correct kube version")
}
}
})
| |||||
test case
|
openshift/openshift-tests-private
|
ce85970d-2740-4269-9a08-a27842b864b1
|
ConnectedOnly-Author:kuiwang-Medium-23473-permit z-stream releases skipping during operator updates
|
['"fmt"', '"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-23473-permit z-stream releases skipping during operator updates", func() {
architecture.SkipNonAmd64SingleArch(oc)
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
cmNcTemplate = filepath.Join(buildPruningBaseDir, "cm-namespaceconfig.yaml")
catsrcCmTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-configmap.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogTemplate,
}
skippedVersion = "namespace-configuration-operator.v0.0.2"
cmNc = configMapDescription{
name: "cm-community-namespaceconfig-operators",
namespace: "", //must be set in iT
template: cmNcTemplate,
}
catsrcNc = catalogSourceDescription{
name: "catsrc-community-namespaceconfig-operators",
namespace: "", //must be set in iT
displayName: "Community namespaceconfig Operators",
publisher: "Community",
sourceType: "configmap",
address: "cm-community-namespaceconfig-operators",
template: catsrcCmTemplate,
}
subNc = subscriptionDescription{
subName: "namespace-configuration-operator",
namespace: "", //must be set in iT
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "namespace-configuration-operator",
catalogSourceName: "catsrc-community-namespaceconfig-operators",
catalogSourceNamespace: "", //must be set in iT
startingCSV: "",
currentCSV: "namespace-configuration-operator.v0.1.0", //it matches to that in cm, so set it.
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
cm = cmNc
catsrc = catsrcNc
sub = subNc
)
//oc.TeardownProject()
oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach
cm.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
og.namespace = oc.Namespace()
exutil.By("Create og")
og.create(oc, itName, dr)
exutil.By("Create configmap of csv")
cm.create(oc, itName, dr)
exutil.By("Create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("Create sub")
sub.ipApproval = "Manual"
sub.startingCSV = "namespace-configuration-operator.v0.0.1"
sub.create(oc, itName, dr)
exutil.By("manually approve sub")
sub.approve(oc, itName, dr)
exutil.By(fmt.Sprintf("there is skipped csv version %s", skippedVersion))
o.Expect(strings.Contains(sub.ipCsv, skippedVersion)).To(o.BeFalse())
})
| |||||
test case
|
openshift/openshift-tests-private
|
d2b59cee-5472-4905-aba8-4a5e7e5b5be4
|
ConnectedOnly-Author:xzha-Medium-24664-CRD updates if new schemas are backwards compatible
|
['"context"', 'g "github.com/onsi/ginkgo/v2"', '"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:xzha-Medium-24664-CRD updates if new schemas are backwards compatible", func() {
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogTemplate = 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: ogTemplate,
}
catsrc = catalogSourceDescription{
name: "nginx-24664-index",
namespace: oc.Namespace(),
displayName: "nginx-24664",
publisher: "OLM QE",
sourceType: "grpc",
address: "quay.io/olmqe/nginx-operator-index-24664:multi-arch",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-operator-24664",
namespace: "", //must be set in iT
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator-24664",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "", //must be set in iT
template: subTemplate,
singleNamespace: true,
}
crd = crdDescription{
name: "nginx24664s.cache.example.com",
}
)
//oc.TeardownProject()
oc.SetupProject() // project and its resource are deleted automatically when out of It, so no need derfer or AfterEach
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
og.namespace = oc.Namespace()
exutil.By("ensure no such crd")
crd.delete(oc)
exutil.By("Create og")
og.create(oc, itName, dr)
exutil.By("Create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("Create sub")
sub.create(oc, itName, dr)
newCheck("expect", asUser, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "v2", nok, []string{"crd", crd.name, "-A", "-o=jsonpath={.status.storedVersions}"}).check(oc)
exutil.By("update channel of Sub")
sub.patch(oc, "{\"spec\": {\"channel\": \"beta\"}}")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
status := getResource(oc, asAdmin, withoutNamespace, "csv", "nginx-operator-24664.v0.0.2", "-n", sub.namespace, "-o=jsonpath={.status.phase}")
if strings.Compare(status, "Succeeded") == 0 {
e2e.Logf("csv nginx-operator-24664.v0.0.2 is Succeeded")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "csv nginx-operator-24664.v0.0.2 is not Succeeded")
newCheck("expect", asAdmin, withoutNamespace, contain, "v2", ok, []string{"crd", crd.name, "-A", "-o=jsonpath={.status.storedVersions}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
8260116f-f15d-4a7c-8733-f31e6972ea92
|
Author:xzha-ConnectedOnly-Medium-21824-verify CRD should be ready before installing the operator
|
['"context"', '"fmt"', '"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("Author:xzha-ConnectedOnly-Medium-21824-verify CRD should be ready before installing the operator", func() {
architecture.SkipNonAmd64SingleArch(oc)
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
cmWrong = filepath.Join(buildPruningBaseDir, "cm-21824-wrong.yaml")
cmCorrect = filepath.Join(buildPruningBaseDir, "cm-21824-correct.yaml")
catsrcCmTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-configmap.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogTemplate,
}
cm = configMapDescription{
name: "cm-21824",
namespace: "", //must be set in iT
template: cmWrong,
}
catsrc = catalogSourceDescription{
name: "catsrc-21824",
namespace: "", //must be set in iT
displayName: "21824 Operators",
publisher: "olmqe",
sourceType: "configmap",
address: "cm-21824",
template: catsrcCmTemplate,
}
sub = subscriptionDescription{
subName: "kubeturbo21824-operator-21824",
namespace: "", //must be set in iT
ipApproval: "Automatic",
operatorPackage: "kubeturbo21824",
catalogSourceName: "catsrc-21824",
catalogSourceNamespace: "", //must be set in iT
startingCSV: "",
template: subTemplate,
singleNamespace: true,
}
)
oc.SetupProject()
cm.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
og.namespace = oc.Namespace()
exutil.By("Create og")
og.create(oc, itName, dr)
exutil.By("Create cm with wrong crd")
cm.create(oc, itName, dr)
exutil.By("Create catalog source")
catsrc.create(oc, itName, dr)
exutil.By("Create sub and cannot succeed")
sub.createWithoutCheck(oc, itName, dr)
err := wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) {
subStatus := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions[*].message}")
e2e.Logf(subStatus)
if strings.Contains(subStatus, "invalid") {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("status.conditions of sub %s doesn't have expect meesage", sub.subName))
sub.findInstalledCSV(oc, itName, dr)
err = wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) {
csvPhase := getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.requirementStatus}")
e2e.Logf(csvPhase)
if strings.Contains(csvPhase, "NotPresent") {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("status.requirementStatus of csv %s is not correct", sub.installedCSV))
sub.delete(itName, dr)
sub.deleteCSV(itName, dr)
cm.delete(itName, dr)
catsrc.delete(itName, dr)
exutil.By("update cm to correct crd")
cm.name = "cm-21824-correct"
cm.template = cmCorrect
cm.create(oc, itName, dr)
catsrc.name = "catsrc-21824-correct"
catsrc.address = cm.name
catsrc.create(oc, itName, dr)
sub.catalogSourceName = catsrc.name
sub.create(oc, itName, dr)
exutil.By("sub succeed and csv succeed")
sub.findInstalledCSV(oc, itName, dr)
err = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
csvStatus, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if csvStatus == "Succeeded" {
e2e.Logf("CSV status is Succeeded")
return true, nil
}
e2e.Logf("CSV status is %s, not Succeeded, go next round", csvStatus)
return false, nil
})
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status}")
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("status.phase of csv %s is not Succeeded", sub.installedCSV))
})
| |||||
test case
|
openshift/openshift-tests-private
|
6576bd52-d2d0-48a1-a019-7d5d703b8494
|
NonHyperShiftHOST-ConnectedOnly-Author:xzha-Medium-43642-Alerts should be raised if the catalogsources are missing [Disruptive]
|
['"context"', '"fmt"', '"os/exec"', '"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("NonHyperShiftHOST-ConnectedOnly-Author:xzha-Medium-43642-Alerts should be raised if the catalogsources are missing [Disruptive]", func() {
exutil.SkipBaselineCaps(oc, "None")
exutil.SkipIfPlatformTypeNot(oc, "AWS")
exutil.SkipIfDisableDefaultCatalogsource(oc)
catalogs := []string{"certified-operators", "community-operators", "redhat-marketplace", "redhat-operators"}
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catsrc", "-n", "openshift-marketplace").Output()
o.Expect(err).NotTo(o.HaveOccurred())
for _, catsrc := range catalogs {
if !strings.Contains(output, catsrc) {
e2e.Logf("cannot get catsrc %s", catsrc)
g.Skip("Not all default catalogsources are installed")
}
}
exutil.By("make all nodes as unschedulable")
nodeName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "-o=jsonpath={.items[*].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("Node Names are %v", nodeName)
node := strings.Fields(nodeName)
defer func() {
for _, nodeIndex := range node {
oc.AsAdmin().WithoutNamespace().Run("adm").Args("uncordon", fmt.Sprintf("%s", nodeIndex)).Execute()
}
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
catalogstrings := []string{"Certified Operators", "Community Operators", "Red Hat Operators", "Red Hat Marketplace"}
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifests", "-n", "openshift-marketplace").Output()
o.Expect(err).NotTo(o.HaveOccurred())
for _, catalogstring := range catalogstrings {
if !strings.Contains(output, catalogstring) {
e2e.Logf("cannot get packagemanifests for %s", catalogstring)
return false, nil
}
}
e2e.Logf("get packagemanifests for %s success", strings.Join(catalogstrings, ", "))
return true, nil
})
if err != nil {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", "openshift-marketplace").Output()
e2e.Logf(output)
output, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("catsrc", "community-operators", "-n", "openshift-marketplace", "-o", "yaml").Output()
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, "cannot get packagemanifests for Certified Operators, Community Operators, Red Hat Operators and Red Hat Marketplace")
}()
for _, nodeIndex := range node {
err = oc.AsAdmin().WithoutNamespace().Run("adm").Args("cordon", fmt.Sprintf("%s", nodeIndex)).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("delete default catsrc certified-operators community-operators redhat-marketplace redhat-operators")
for _, catalog := range catalogs {
err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("catsrc", catalog, "-n", "openshift-marketplace").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("check alert has been raised")
token, err := exutil.GetSAToken(oc)
o.Expect(err).NotTo(o.HaveOccurred())
url, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("route", "prometheus-k8s", "-n", "openshift-monitoring", "-o=jsonpath={.spec.host}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
err = wait.PollUntilContextTimeout(context.TODO(), 60*time.Second, 600*time.Second, false, func(ctx context.Context) (bool, error) {
for _, alertString := range catalogs {
alertCMD := fmt.Sprintf("curl -s -k -H \"Authorization: Bearer %s\" https://%s/api/v1/alerts | jq -r '.data.alerts[] | select (.labels.alertname == \"OperatorHubSourceError\" and .labels.name == \"%s\")'", token, url, alertString)
output, err := exec.Command("bash", "-c", alertCMD).Output()
if err != nil {
e2e.Logf("Error retrieving prometheus alert metrics: %v, retry ...", err)
return false, nil
}
if len(string(output)) == 0 {
e2e.Logf("Prometheus alert is nil, retry ...")
return false, nil
}
if !strings.Contains(string(output), "firing") && !strings.Contains(string(output), "pending") {
e2e.Logf(string(output))
return false, fmt.Errorf(" %s alert state is not firing or pending", alertString)
}
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, "alert state is not firing or pending")
})
| |||||
test case
|
openshift/openshift-tests-private
|
3287bac9-dfe9-4dd6-8908-61344907dbfd
|
ConnectedOnly-Author:kuiwang-High-25679-Medium-21418-Cluster resource created and deleted correctly [Serial]
|
['"fmt"', '"os"', '"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-High-25679-Medium-21418-Cluster resource created and deleted correctly [Serial]", func() {
architecture.SkipArchitectures(oc, architecture.PPC64LE, architecture.S390X, architecture.MULTI)
exutil.SkipBaselineCaps(oc, "None")
exutil.SkipNoCapabilities(oc, "marketplace")
exutil.SkipIfDisableDefaultCatalogsource(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")
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")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
sub = subscriptionDescription{
subName: "keda",
namespace: "openshift-operators",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "keda",
catalogSourceName: "community-operators",
catalogSourceNamespace: "openshift-marketplace",
startingCSV: "", //get it from package based on currentCSV if ipApproval is Automatic
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: false,
}
crdName = "kedacontrollers.keda.sh"
crName = "KedaController"
podLabelName = "keda"
cl = checkList{}
)
// OCP-25679, OCP-21418
exutil.By("Create operator targeted at all namespace")
sub.create(oc, itName, dr)
// OCP-25679, OCP-21418
exutil.By("Check the cluster resource rolebinding, role and service account exists")
clusterResources := strings.Fields(getResource(oc, asAdmin, withoutNamespace, "clusterrolebinding",
fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-o=jsonpath={.items[0].metadata.name}{\" \"}{.items[0].roleRef.name}{\" \"}{.items[0].subjects[0].name}"))
o.Expect(clusterResources).NotTo(o.BeEmpty())
cl.add(newCheck("present", asAdmin, withoutNamespace, present, "", ok, []string{"clusterrole", clusterResources[1]}))
cl.add(newCheck("present", asAdmin, withoutNamespace, present, "", ok, []string{"sa", clusterResources[2], "-n", sub.namespace}))
// OCP-21418
exutil.By("Check the pods of the operator is running")
cl.add(newCheck("expect", asAdmin, withoutNamespace, contain, "Running", ok, []string{"pod", fmt.Sprintf("--selector=name=%s", podLabelName), "-n", sub.namespace, "-o=jsonpath={.items[*].status.phase}"}))
// OCP-21418
exutil.By("Check no resource of new crd")
cl.add(newCheck("present", asAdmin, withNamespace, notPresent, "", ok, []string{crName}))
//do check parallelly
cl.check(oc)
cl.empty()
// OCP-25679, OCP-21418
exutil.By("Delete the operator")
sub.delete(itName, dr)
sub.getCSV().delete(itName, dr)
// OCP-25679, OCP-21418
exutil.By("Check the cluster resource rolebinding, role and service account do not exist")
cl.add(newCheck("present", asAdmin, withoutNamespace, notPresent, "", ok, []string{"clusterrolebinding", clusterResources[0]}))
cl.add(newCheck("present", asAdmin, withoutNamespace, notPresent, "", ok, []string{"clusterrole", clusterResources[1]}))
cl.add(newCheck("present", asAdmin, withoutNamespace, notPresent, "", ok, []string{"sa", clusterResources[2], "-n", sub.namespace}))
// OCP-21418
exutil.By("Check the CRD still exists")
cl.add(newCheck("present", asAdmin, withoutNamespace, present, "", ok, []string{"crd", crdName}))
// OCP-21418
exutil.By("Check the pods of the operator is deleted")
cl.add(newCheck("expect", asAdmin, withoutNamespace, compare, "", ok, []string{"pod", fmt.Sprintf("--selector=name=%s", podLabelName), "-n", sub.namespace, "-o=jsonpath={.items[*].status.phase}"}))
cl.check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
b9410eda-4afb-4e23-895e-f4eef2f2ef63
|
NonHyperShiftHOST-ConnectedOnly-Author:kuiwang-High-25783-Subscriptions are not getting processed taking very long to get processed [Serial]
|
['"os"', '"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("NonHyperShiftHOST-ConnectedOnly-Author:kuiwang-High-25783-Subscriptions are not getting processed taking very long to get processed [Serial]", func() {
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipBaselineCaps(oc, "None")
exutil.SkipNoCapabilities(oc, "marketplace")
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")
}
node, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("node", "--selector=node.openshift.io/os_id=rhcos,node-role.kubernetes.io/master=", "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
err = exutil.SetNamespacePrivileged(oc, oc.Namespace())
o.Expect(err).NotTo(o.HaveOccurred())
efips, errFips := oc.AsAdmin().WithoutNamespace().Run("debug").Args("node/"+node, "--to-namespace="+oc.Namespace(), "--", "chroot", "/host", "fips-mode-setup", "--check").Output()
if errFips != nil || strings.Contains(efips, "FIPS mode is enabled") {
g.Skip("skip it without impacting function")
}
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrc = catalogSourceDescription{
name: "catsrc-25783-operator",
namespace: "openshift-marketplace",
displayName: "Test Catsrc 25783 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/nginx-ok-index:vokv25783",
template: catsrcImageTemplate,
}
subCockroachdb = subscriptionDescription{
subName: "nginx-ok-v25783",
namespace: "openshift-operators",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-ok-v25783",
catalogSourceName: catsrc.name,
catalogSourceNamespace: catsrc.namespace,
startingCSV: "", //get it from package based on currentCSV if ipApproval is Automatic
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: false,
}
csvCockroachdb = csvDescription{
name: "",
namespace: "openshift-operators",
}
)
exutil.SkipForSNOCluster(oc)
platform := exutil.CheckPlatform(oc)
proxy, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("proxy", "cluster", "-o=jsonpath={.status.httpProxy}{.status.httpsProxy}").Output()
o.Expect(err).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")
}
exutil.By("create catsrc")
catsrc.create(oc, itName, dr)
defer catsrc.delete(itName, dr)
exutil.By("create operator nginx-ok")
defer subCockroachdb.delete(itName, dr)
subCockroachdb.create(oc, itName, dr)
csvCockroachdb.name = subCockroachdb.installedCSV
defer csvCockroachdb.delete(itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", subCockroachdb.installedCSV, "-n", subCockroachdb.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
9d6301f6-ec7f-4d3e-9184-1d6c3ebe46d1
|
ConnectedOnly-Author:kuiwang-Medium-21484-High-21532-watch special or all namespace by operator group
|
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', 'g "github.com/onsi/ginkgo/v2"', '"path/filepath"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("ConnectedOnly-Author:kuiwang-Medium-21484-High-21532-watch special or all namespace by operator group", func() {
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipNoCapabilities(oc, "marketplace")
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
catsrc = catalogSourceDescription{
name: "olm-21532-catalog",
namespace: "openshift-marketplace",
displayName: "OLM 21532 Catalog",
publisher: "QE",
sourceType: "grpc",
address: "quay.io/olmqe/olm-dep:vcompos-v2-withCache",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "composable-operator",
namespace: "openshift-operators",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "composable-operator",
catalogSourceName: "olm-21532-catalog",
catalogSourceNamespace: "openshift-marketplace",
// startingCSV: "composable-operator.v0.1.3",
startingCSV: "", //get it from package based on currentCSV if ipApproval is Automatic
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: false,
}
project = projectDescription{
name: "olm-enduser-specific-21484",
targetNamespace: oc.Namespace(),
}
cl = checkList{}
)
// OCP-21532
exutil.By("Check the global operator global-operators support all namesapces")
cl.add(newCheck("expect", asAdmin, withoutNamespace, compare, "[]", ok, []string{"og", "global-operators", "-n", "openshift-operators", "-o=jsonpath={.status.namespaces}"}))
exutil.By("create catsrc")
catsrc.createWithCheck(oc, itName, dr)
defer catsrc.delete(itName, dr)
// OCP-21484, OCP-21532
exutil.By("Create operator targeted at all namespace")
sub.create(oc, itName, dr) // the resource is cleaned within g.AfterEach
exutil.By("Create new namespace")
project.create(oc, itName, dr) // the resource is cleaned within g.AfterEach
// OCP-21532
exutil.By("New annotations is added to copied CSV in current namespace")
cl.add(newCheck("expect", asUser, withNamespace, contain, "alm-examples", ok, []string{"csv", sub.installedCSV, "-o=jsonpath={.metadata.annotations}"}))
// OCP-21484, OCP-21532
exutil.By("Check the csv within new namespace is copied. note: the step is slow because it wait to copy csv to new namespace")
cl.add(newCheck("expect", asAdmin, withoutNamespace, compare, "Copied", ok, []string{"csv", sub.installedCSV, "-n", project.name, "-o=jsonpath={.status.reason}"}))
cl.check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
94faae87-3999-4407-86d9-dbb336e86574
|
ConnectedOnly-Author:kuiwang-Medium-24906-Operators requesting cluster-scoped permission can trigger kube GC bug [Serial]
|
['"fmt"', '"os"', '"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-24906-Operators requesting cluster-scoped permission can trigger kube GC bug [Serial]", func() {
architecture.SkipArchitectures(oc, architecture.PPC64LE, architecture.S390X, architecture.MULTI)
exutil.SkipBaselineCaps(oc, "None")
exutil.SkipNoCapabilities(oc, "marketplace")
exutil.SkipIfDisableDefaultCatalogsource(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")
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")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
sub = subscriptionDescription{
subName: "keda",
namespace: "openshift-operators",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "keda",
catalogSourceName: "community-operators",
catalogSourceNamespace: "openshift-marketplace",
startingCSV: "", //get it from package based on currentCSV if ipApproval is Automatic
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: false,
}
cl = checkList{}
)
exutil.By("Create operator targeted at all namespace")
sub.create(oc, itName, dr)
sub.update(oc, itName, dr)
exutil.By("Check clusterrolebinding has no OwnerReferences")
cl.add(newCheck("expect", asAdmin, withoutNamespace, compare, "", ok, []string{"clusterrolebinding", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..OwnerReferences}"}))
exutil.By("Check clusterrole has no OwnerReferences")
cl.add(newCheck("expect", asAdmin, withoutNamespace, compare, "", ok, []string{"clusterrole", fmt.Sprintf("--selector=olm.owner=%s", sub.installedCSV), "-n", sub.namespace, "-o=jsonpath={..OwnerReferences}"}))
//do check parallelly
cl.check(oc)
})
| |||||
test case
|
openshift/openshift-tests-private
|
05a65df2-a52f-48d1-9a2c-7c54fd9c1f60
|
ConnectedOnly-Author:kuiwang-Medium-33241-Enable generated operator component adoption for operators with all ns mode [Serial]
|
['"context"', '"os"', '"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:kuiwang-Medium-33241-Enable generated operator component adoption for operators with all ns mode [Serial]", func() {
if isAks, _ := exutil.IsAKSCluster(context.TODO(), oc); isAks {
g.Skip("skip for ask cluster")
}
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipNoCapabilities(oc, "marketplace")
node, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("node", "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
err = exutil.SetNamespacePrivileged(oc, oc.Namespace())
o.Expect(err).NotTo(o.HaveOccurred())
efips, err := oc.AsAdmin().WithoutNamespace().Run("debug").Args("node/"+node, "--to-namespace="+oc.Namespace(), "--", "chroot", "/host", "fips-mode-setup", "--check").Output()
if err != nil || strings.Contains(efips, "FIPS mode is enabled") {
g.Skip("skip it without impacting function")
}
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")
}
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")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrc = catalogSourceDescription{
name: "catsrc-33241-operator",
namespace: "openshift-marketplace",
displayName: "Test Catsrc 33241 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/olm-api:v4-withCache",
template: catsrcImageTemplate,
}
subCockroachdb = subscriptionDescription{
subName: "cockroachdb33241",
namespace: "openshift-operators",
channel: "stable-5.x",
ipApproval: "Automatic",
operatorPackage: "cockroachdb",
catalogSourceName: catsrc.name,
catalogSourceNamespace: catsrc.namespace,
startingCSV: "", //get it from package based on currentCSV if ipApproval is Automatic
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: false,
}
)
exutil.By("check if cockroachdb is already installed with all ns.")
csvList := getResource(oc, asAdmin, withoutNamespace, "csv", "-n", subCockroachdb.namespace, "-o=jsonpath={.items[*].metadata.name}")
if !strings.Contains(csvList, subCockroachdb.operatorPackage) {
exutil.By("create catsrc")
catsrc.createWithCheck(oc, itName, dr)
defer catsrc.delete(itName, dr)
exutil.By("Create operator targeted at all namespace")
subCockroachdb.create(oc, itName, dr)
csvCockroachdb := csvDescription{
name: subCockroachdb.installedCSV,
namespace: subCockroachdb.namespace,
}
defer subCockroachdb.delete(itName, dr)
defer csvCockroachdb.delete(itName, dr)
crdName := getResource(oc, asAdmin, withoutNamespace, "operator.operators.coreos.com", subCockroachdb.operatorPackage+"."+subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='CustomResourceDefinition')].name}")
o.Expect(crdName).NotTo(o.BeEmpty())
defer doAction(oc, "delete", asAdmin, withoutNamespace, "crd", crdName)
defer doAction(oc, "delete", asAdmin, withoutNamespace, "operator.operators.coreos.com", subCockroachdb.operatorPackage+"."+subCockroachdb.namespace)
exutil.By("Check all resources via operators")
resourceKind := getResource(oc, asAdmin, withoutNamespace, "operator.operators.coreos.com", subCockroachdb.operatorPackage+"."+subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}")
o.Expect(resourceKind).To(o.ContainSubstring("Deployment"))
o.Expect(resourceKind).To(o.ContainSubstring("Role"))
o.Expect(resourceKind).To(o.ContainSubstring("RoleBinding"))
o.Expect(resourceKind).To(o.ContainSubstring("ClusterRole"))
o.Expect(resourceKind).To(o.ContainSubstring("ClusterRoleBinding"))
o.Expect(resourceKind).To(o.ContainSubstring("CustomResourceDefinition"))
o.Expect(resourceKind).To(o.ContainSubstring("Subscription"))
o.Expect(resourceKind).To(o.ContainSubstring("InstallPlan"))
o.Expect(resourceKind).To(o.ContainSubstring("ClusterServiceVersion"))
newCheck("expect", asAdmin, withoutNamespace, contain, subCockroachdb.namespace, ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='ClusterServiceVersion')].namespace}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "InstallSucceeded", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='ClusterServiceVersion')].conditions[*].reason}"}).check(oc)
exutil.By("unlabel resource and it is relabeled automatically")
roleName := getResource(oc, asAdmin, withoutNamespace, "operator.operators.coreos.com", subCockroachdb.operatorPackage+"."+subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='Role')].name}")
o.Expect(roleName).NotTo(o.BeEmpty())
_, err := doAction(oc, "label", asAdmin, withoutNamespace, "-n", subCockroachdb.namespace, "Role", roleName, "operators.coreos.com/"+subCockroachdb.operatorPackage+"."+subCockroachdb.namespace+"-")
o.Expect(err).NotTo(o.HaveOccurred())
newCheck("expect", asAdmin, withoutNamespace, contain, "Role", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
exutil.By("delete opertor and the Operator still exists because of crd")
subCockroachdb.delete(itName, dr)
csvCockroachdb.delete(itName, dr)
newCheck("expect", asAdmin, withoutNamespace, contain, "CustomResourceDefinition", ok, []string{"operator.operators.coreos.com", subCockroachdb.operatorPackage + "." + subCockroachdb.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
exutil.By("reinstall operator and check resource via Operator")
subCockroachdb1 := subCockroachdb
subCockroachdb1.create(oc, itName, dr)
defer subCockroachdb1.delete(itName, dr)
defer doAction(oc, "delete", asAdmin, withoutNamespace, "csv", subCockroachdb1.installedCSV, "-n", subCockroachdb1.namespace)
newCheck("expect", asAdmin, withoutNamespace, contain, "ClusterServiceVersion", ok, []string{"operator.operators.coreos.com", subCockroachdb1.operatorPackage + "." + subCockroachdb1.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, subCockroachdb1.namespace, ok, []string{"operator.operators.coreos.com", subCockroachdb1.operatorPackage + "." + subCockroachdb1.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='ClusterServiceVersion')].namespace}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, contain, "Install", ok, []string{"operator.operators.coreos.com", subCockroachdb1.operatorPackage + "." + subCockroachdb1.namespace, "-o=jsonpath={.status.components.refs[?(.kind=='ClusterServiceVersion')].conditions[*].reason}"}).check(oc)
exutil.By("delete operator and delete Operator and it will be recreated because of crd")
subCockroachdb1.delete(itName, dr)
_, err = doAction(oc, "delete", asAdmin, withoutNamespace, "csv", subCockroachdb1.installedCSV, "-n", subCockroachdb1.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "delete", asAdmin, withoutNamespace, "operator.operators.coreos.com", subCockroachdb1.operatorPackage+"."+subCockroachdb1.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
// here there is issue and take WA
_, err = doAction(oc, "label", asAdmin, withoutNamespace, "crd", crdName, "operators.coreos.com/"+subCockroachdb1.operatorPackage+"."+subCockroachdb1.namespace+"-")
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "label", asAdmin, withoutNamespace, "crd", crdName, "operators.coreos.com/"+subCockroachdb1.operatorPackage+"."+subCockroachdb1.namespace+"=")
o.Expect(err).NotTo(o.HaveOccurred())
//done for WA
newCheck("expect", asAdmin, withoutNamespace, contain, "CustomResourceDefinition", ok, []string{"operator.operators.coreos.com", subCockroachdb1.operatorPackage + "." + subCockroachdb1.namespace, "-o=jsonpath={.status.components.refs[*].kind}"}).check(oc)
} else {
exutil.By("it already exists")
}
})
| |||||
test case
|
openshift/openshift-tests-private
|
7953ace3-b892-479e-a680-909a5eb575b1
|
ConnectedOnly-Author:xzha-High-34181-can add conversion webhooks for singleton operators [Serial]
|
['"context"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"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("ConnectedOnly-Author:xzha-High-34181-can add conversion webhooks for singleton operators [Serial]", func() {
architecture.SkipNonAmd64SingleArch(oc)
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
crwebhook = filepath.Join(buildPruningBaseDir, "cr-webhookTest.yaml")
catsrc = catalogSourceDescription{
name: "catsrc-34181",
namespace: "openshift-marketplace",
displayName: "Test Catsrc 34181 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/webhook-operator-index:0.0.3-v1-cache",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "webhook-operator-34181",
namespace: "openshift-operators",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "webhook-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "openshift-marketplace",
template: subTemplate,
singleNamespace: false,
}
)
exutil.By("create catlog resource")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("Check if the global operator global-operators support all namesapces")
newCheck("expect", asAdmin, withoutNamespace, compare, "[]", ok, []string{"og", "global-operators", "-n", "openshift-operators", "-o=jsonpath={.status.namespaces}"})
exutil.By("create subscription targeted at all namespace")
defer sub.delete(itName, dr)
defer func() {
if sub.installedCSV == "" {
sub.findInstalledCSV(oc, itName, dr)
}
sub.deleteCSV(itName, dr)
}()
defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("crd", "webhooktests.webhook.operators.coreos.io", "-n", "openshift-operators", "--ignore-not-found").Execute()
sub.create(oc, itName, dr)
err := wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := oc.AsAdmin().WithoutNamespace().Run("api-resources").Args("-o", "name").Output()
if err != nil {
e2e.Logf("There is no WebhookTest, err:%v", err)
return false, nil
}
if strings.Contains(output, "webhooktests.webhook.operators.coreos.io") {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "webhooktests.webhook.operators.coreos.io does exist")
exutil.By("check invalid CR")
configFile, err := oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", crwebhook, "-p", "NAME=webhooktest-34181",
"NAMESPACE=openshift-operators", "VALID=false").OutputToFile("config-34181.json")
o.Expect(err).NotTo(o.HaveOccurred())
err = wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
erra := oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", configFile).Execute()
if erra == nil {
e2e.Logf("expect fail and try next")
oc.AsAdmin().WithoutNamespace().Run("delete").Args("WebhookTest", "webhooktest-34181", "-n", "openshift-operators").Execute()
return false, nil
}
e2e.Logf("err:%v", err)
return true, nil
})
exutil.AssertWaitPollNoErr(err, "can not apply webhooktest-34181")
exutil.By("check valid CR")
configFile, err = oc.AsAdmin().Run("process").Args("--ignore-unknown-parameters=true", "-f", crwebhook, "-p", "NAME=webhooktest-34181",
"NAMESPACE=openshift-operators", "VALID=true").OutputToFile("config-34181.json")
o.Expect(err).NotTo(o.HaveOccurred())
defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("WebhookTest", "webhooktest-34181", "-n", "openshift-operators").Execute()
err = wait.PollUntilContextTimeout(context.TODO(), 15*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
erra := oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", configFile).Execute()
if erra != nil {
e2e.Logf("try next, err:%v", erra)
if strings.Contains(erra.Error(), "Internal error occurred") {
return true, nil
}
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, "can not apply webhooktest-34181 again")
})
| |||||
test case
|
openshift/openshift-tests-private
|
c24cd3cf-7877-4ac0-bbd7-eb57c9424ea8
|
ConnectedOnly-Author:xzha-High-40531-High-41051-High-23172-the value of lastUpdateTime of csv and Components of Operator should be correct [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:xzha-High-40531-High-41051-High-23172-the value of lastUpdateTime of csv and Components of Operator should be correct [Serial]", func() {
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipIfDisableDefaultCatalogsource(oc)
exutil.SkipBaselineCaps(oc, "None")
exutil.SkipForSNOCluster(oc)
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
sub = subscriptionDescription{
subName: "sub-40531",
namespace: "openshift-operators",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "learn",
catalogSourceName: "qe-app-registry",
catalogSourceNamespace: "openshift-marketplace",
template: subTemplate,
singleNamespace: false,
}
)
exutil.By("1, Check if the global operator global-operators support all namesapces")
newCheck("expect", asAdmin, withoutNamespace, compare, "[]", ok, []string{"og", "global-operators", "-n", "openshift-operators", "-o=jsonpath={.status.namespaces}"})
exutil.By("2, Create operator targeted at all namespace")
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("3, Create new namespace")
oc.SetupProject()
exutil.By("4, OCP-23172 Check the csv within new namespace is copied.")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", oc.Namespace(), "-o=jsonpath={.status.phase}"}).check(oc)
newCheck("expect", asAdmin, withoutNamespace, compare, "Copied", ok, []string{"csv", sub.installedCSV, "-n", oc.Namespace(), "-o=jsonpath={.status.reason}"})
exutil.By("5, OCP-40531-Check the lastUpdateTime of copied CSV is equal to the original CSV.")
originCh := make(chan string)
defer close(originCh)
copyCh := make(chan string)
defer close(copyCh)
go func() {
originCh <- getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", "openshift-operators", "-o=jsonpath={.status.lastUpdateTime}")
}()
go func() {
copyCh <- getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", oc.Namespace(), "-o=jsonpath={.status.lastUpdateTime}")
}()
lastUpdateTimeOrigin := <-originCh
lastUpdateTimeNew := <-copyCh
e2e.Logf("OriginTimeStamp:%s, CopiedTimeStamp:%s", lastUpdateTimeOrigin, lastUpdateTimeNew)
o.Expect(lastUpdateTimeNew).To(o.Equal(lastUpdateTimeOrigin))
exutil.By("6, OCP-41051-Check Operator.Status.Components does not contain copied CSVs.")
operatorname := sub.operatorPackage + ".openshift-operators"
operatorinfo := getResource(oc, asAdmin, withoutNamespace, "operator.operators.coreos.com", operatorname, "-n", oc.Namespace(), "-o=jsonpath={.status.components.refs}")
o.Expect(operatorinfo).NotTo(o.BeEmpty())
o.Expect(operatorinfo).NotTo(o.ContainSubstring("Copied"))
})
| |||||
test case
|
openshift/openshift-tests-private
|
ce06c7b3-d2da-4723-a8e3-cd622e82ed33
|
Author:xzha-DEPRECATED-ConnectedOnly-Medium-74652-InstallPlan should SUCCESS when multiple CRD versions are served [Disruptive][Serial]
|
['"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("Author:xzha-DEPRECATED-ConnectedOnly-Medium-74652-InstallPlan should SUCCESS when multiple CRD versions are served [Disruptive][Serial]", func() {
architecture.SkipNonAmd64SingleArch(oc)
exutil.SkipIfPlatformTypeNot(oc, "GCP")
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-image-extract.yaml")
var (
catsrc = catalogSourceDescription{
name: "catsrc-74652",
namespace: "openshift-marketplace",
displayName: "Test Catsrc",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/devworkspace-operator-index:release",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "sub-74652",
namespace: "openshift-operators",
catalogSourceName: "catsrc-74652",
catalogSourceNamespace: "openshift-marketplace",
channel: "fast",
ipApproval: "Automatic",
operatorPackage: "devworkspace-operator",
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By("1) create the catalog source")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("2) install sub")
sub.create(oc, itName, dr)
defer func() {
oc.AsAdmin().WithoutNamespace().Run("delete").Args("deployment", "devworkspace-webhook-server", "-n", "openshift-operators").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("service", "devworkspace-webhookserver", "-n", "openshift-operators").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("serviceaccounts", "devworkspace-webhook-server", "-n", "openshift-operators").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("clusterrole", "devworkspace-webhook-server").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("clusterrolebinding", "devworkspace-webhook-server").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("mutatingwebhookconfigurations", "controller.devfile.io").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("validatingwebhookconfigurations", "controller.devfile.io").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("crd", "devworkspaceroutings.controller.devfile.io").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("crd", "devworkspaces.workspace.devfile.io").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("crd", "devworkspacetemplates.workspace.devfile.io").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("crd", "devworkspaceoperatorconfigs.controller.devfile.io").Execute()
oc.AsAdmin().WithoutNamespace().Run("delete").Args("csv", "devworkspace-operator.v0.29.0", "-n", "openshift-operators").Execute()
sub.delete(itName, dr)
}()
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
exutil.By("3) create cr")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("service", "devworkspace-webhookserver", "-n", sub.namespace).Output()
if strings.Contains(output, "TCP") {
e2e.Logf("service is OK")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "service devworkspace-webhookserver is not running")
crFilePath := filepath.Join(buildPruningBaseDir, "cr_devworkspace.yaml")
defer func() {
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
output, _ := oc.AsAdmin().WithoutNamespace().Run("delete").Args("devworkspaces", "empty-devworkspace", "-n", sub.namespace).Output()
e2e.Logf(output)
output, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("devworkspaces", "empty-devworkspace", "-n", sub.namespace).Output()
if strings.Contains(output, "NotFound") {
e2e.Logf("delete devworkspaces SUCCESS")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "delete devworkspaces failed")
}()
err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", crFilePath, "-n", sub.namespace).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("devworkspace", "-n", sub.namespace).Output()
if strings.Contains(output, "Workspace is running") {
e2e.Logf("Workspace is running")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "creating devworkspace is not Succeeded")
exutil.By("4) delete sub/csv")
sub.deleteCSV(itName, dr)
sub.delete(itName, dr)
exutil.By("5) re-create sub")
sub.create(oc, itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).check(oc)
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("service", "devworkspace-webhookserver", "-n", sub.namespace).Output()
if strings.Contains(output, "TCP") {
e2e.Logf("service is OK")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "service devworkspace-webhookserver is not running")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("devworkspace", "-n", sub.namespace).Output()
if strings.Contains(output, "Workspace is running") {
e2e.Logf("Workspace is running: \n%s", output)
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "devworkspace is not running")
})
| |||||
test case
|
openshift/openshift-tests-private
|
2c19eafb-3dd0-4ba7-8184-3e5c00715782
|
VMonly-ConnectedOnly-Author:xzha-Medium-27672-Allow Operator Registry Update Polling with automatic ipApproval [Slow]
|
['"context"', '"fmt"', '"os"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', '"time"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"', '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("VMonly-ConnectedOnly-Author:xzha-Medium-27672-Allow Operator Registry Update Polling with automatic ipApproval [Slow]", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-opm.yaml")
catalogDataDir := filepath.Join(buildPruningBaseDir, "27672")
defer DeleteDir(buildPruningBaseDir, "fixture-testdata")
opmCLI := opm.NewOpmCLI()
opmCLI.ExecCommandPath = catalogDataDir
quayCLI := container.NewQuayCLI()
podmanCLI := container.NewPodmanCLI()
podmanCLI.ExecCommandPath = catalogDataDir
indexTag := "quay.io/olmqe/nginxolm-operator-index:27672-" + getRandomString()
defer podmanCLI.RemoveImage(indexTag)
catsrcName := "catsrc-27672-" + getRandomString()
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: catsrcName,
namespace: namespaceName,
displayName: "Test-Catsrc-27672-auto",
publisher: "Red-Hat",
sourceType: "grpc",
address: indexTag,
interval: "1m0s",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "27672-operator",
namespace: namespaceName,
catalogSourceName: catsrcName,
catalogSourceNamespace: namespaceName,
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By("STEP: create the OperatorGroup ")
defer exutil.RecoverNamespaceRestricted(oc, namespaceName)
exutil.SetNamespacePrivileged(oc, namespaceName)
og.createwithCheck(oc, itName, dr)
exutil.By("STEP 1: prepare CatalogSource index image")
catalogFileName := "catalog"
exutil.By("Generate the index docker file")
_, err := opmCLI.Run("generate").Args("dockerfile", catalogFileName).Output()
o.Expect(err).NotTo(o.HaveOccurred())
dockerFileContent, err := os.ReadFile(filepath.Join(catalogDataDir, catalogFileName+".Dockerfile"))
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(dockerFileContent).To(o.ContainSubstring("--cache-dir=/tmp/cache"))
exutil.By("Build and push the image")
output, err := podmanCLI.Run("build").Args(".", "-f", catalogFileName+".Dockerfile", "-t", indexTag).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Successfully"))
defer quayCLI.DeleteTag(strings.Replace(indexTag, "quay.io/", "", 1))
output, err = podmanCLI.Run("push").Args(indexTag).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Writing manifest to image destination"))
exutil.By("STEP 2: Create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("STEP 3: install operator ")
sub.create(oc, itName, dr)
o.Expect(sub.getCSV().name).To(o.Equal("nginx-operator.v0.0.1"))
exutil.By("STEP 4: update CatalogSource index image")
catalogFileName = "catalog-new"
exutil.By("Generate the index docker file")
_, err = opmCLI.Run("generate").Args("dockerfile", catalogFileName).Output()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("Build and push the image")
output, err = podmanCLI.Run("build").Args(".", "-f", catalogFileName+".Dockerfile", "-t", indexTag).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Successfully"))
output, err = podmanCLI.Run("push").Args(indexTag).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Writing manifest to image destination"))
exutil.By("check packagemanifests has been updated")
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "--selector=catalog="+catsrcName, "--field-selector", "metadata.name=nginx-operator", "-o", "yaml", "-n", catsrc.namespace).Output()
if strings.Contains(output, "nginx-operator.v1.0.1") {
return true, nil
}
return false, nil
})
if err != nil {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "--selector=catalog="+catsrcName, "--field-selector", "metadata.name=nginx-operator", "-o", "yaml", "-n", catsrc.namespace).Output()
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, "packagemanifests is not updated")
exutil.By("STEP 5: check the operator has been updated")
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
sub.findInstalledCSV(oc, itName, dr)
if strings.Compare(sub.installedCSV, "nginx-operator.v1.0.1") == 0 {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("nginx-operator.v1.0.1 of sub %s fails", sub.subName))
})
| |||||
test case
|
openshift/openshift-tests-private
|
d2b7d3ea-8a79-4f17-8733-383629245a17
|
VMonly-ConnectedOnly-Author:xzha-Medium-27672-Allow Operator Registry Update Polling with manual ipApproval [Slow]
|
['"context"', '"fmt"', '"os"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', '"time"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"', '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("VMonly-ConnectedOnly-Author:xzha-Medium-27672-Allow Operator Registry Update Polling with manual ipApproval [Slow]", func() {
architecture.SkipNonAmd64SingleArch(oc)
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate := filepath.Join(buildPruningBaseDir, "catalogsource-opm.yaml")
catalogDataDir := filepath.Join(buildPruningBaseDir, "27672")
defer DeleteDir(buildPruningBaseDir, "fixture-testdata")
opmCLI := opm.NewOpmCLI()
opmCLI.ExecCommandPath = catalogDataDir
quayCLI := container.NewQuayCLI()
podmanCLI := container.NewPodmanCLI()
podmanCLI.ExecCommandPath = catalogDataDir
indexTag := "quay.io/olmqe/nginxolm-operator-index:27672-" + getRandomString()
defer podmanCLI.RemoveImage(indexTag)
catsrcName := "catsrc-27672-" + getRandomString()
oc.SetupProject()
namespaceName := oc.Namespace()
var (
og = operatorGroupDescription{
name: "test-og",
namespace: namespaceName,
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: catsrcName,
namespace: namespaceName,
displayName: "Test-Catsrc-27672-manual",
publisher: "Red-Hat",
sourceType: "grpc",
address: indexTag,
interval: "1m0s",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "27672-operator",
namespace: namespaceName,
catalogSourceName: catsrcName,
catalogSourceNamespace: namespaceName,
channel: "channel-v0",
ipApproval: "Manual",
operatorPackage: "nginx-operator",
singleNamespace: true,
template: subTemplate,
}
)
itName := g.CurrentSpecReport().FullText()
exutil.By("STEP: create the OperatorGroup ")
defer exutil.RecoverNamespaceRestricted(oc, namespaceName)
exutil.SetNamespacePrivileged(oc, namespaceName)
og.createwithCheck(oc, itName, dr)
exutil.By("STEP 1: prepare CatalogSource index image")
catalogFileName := "catalog"
exutil.By("Generate the index docker file")
_, err := opmCLI.Run("generate").Args("dockerfile", catalogFileName).Output()
o.Expect(err).NotTo(o.HaveOccurred())
dockerFileContent, err := os.ReadFile(filepath.Join(catalogDataDir, catalogFileName+".Dockerfile"))
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(dockerFileContent).To(o.ContainSubstring("--cache-dir=/tmp/cache"))
exutil.By("Build and push the image")
output, err := podmanCLI.Run("build").Args(".", "-f", catalogFileName+".Dockerfile", "-t", indexTag).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Successfully"))
defer quayCLI.DeleteTag(strings.Replace(indexTag, "quay.io/", "", 1))
output, err = podmanCLI.Run("push").Args(indexTag).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Writing manifest to image destination"))
exutil.By("STEP 2: Create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("STEP 3: install operator ")
sub.create(oc, itName, dr)
sub.approve(oc, itName, dr)
sub.expectCSV(oc, itName, dr, "nginx-operator.v0.0.1")
exutil.By("STEP 4: update CatalogSource index image")
catalogFileName = "catalog-new"
exutil.By("Generate the index docker file")
_, err = opmCLI.Run("generate").Args("dockerfile", catalogFileName).Output()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("Build and push the image")
output, err = podmanCLI.Run("build").Args(".", "-f", catalogFileName+".Dockerfile", "-t", indexTag).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Successfully"))
output, err = podmanCLI.Run("push").Args(indexTag).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Writing manifest to image destination"))
exutil.By("check packagemanifests has been updated")
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "--selector=catalog="+catsrcName, "--field-selector", "metadata.name=nginx-operator", "-o", "yaml", "-n", catsrc.namespace).Output()
if strings.Contains(output, "nginx-operator.v1.0.1") {
return true, nil
}
return false, nil
})
if err != nil {
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "--selector=catalog="+catsrcName, "--field-selector", "metadata.name=nginx-operator", "-o", "yaml", "-n", catsrc.namespace).Output()
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, "packagemanifests is not updated")
exutil.By("STEP 5: check the operator has been updated")
sub.patch(oc, `{"spec": {"channel": "channel-v1"}}`)
exutil.By("approve the install plan")
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
ipCsv := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installplan.name}{\" \"}{.status.currentCSV}")
if strings.Contains(ipCsv, "nginx-operator.v1.0.1") {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("nginx-operator.v1.0.1 of sub %s fails", sub.subName))
sub.approveSpecificIP(oc, itName, dr, "nginx-operator.v1.0.1", "Complete")
exutil.By("STEP 6: check the csv")
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
sub.findInstalledCSV(oc, itName, dr)
if strings.Compare(sub.installedCSV, "nginx-operator.v1.0.1") == 0 {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("nginx-operator.v1.0.1 of sub %s fails", sub.subName))
})
| |||||
test case
|
openshift/openshift-tests-private
|
d0ea5c18-af94-4fd0-a1c8-16c27861e6ca
|
Author:xzha-DEPRECATED-NonHyperShiftHOST-ConnectedOnly-Medium-45359-Default catalogs need to use the correct tags
|
['"fmt"', '"strings"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("Author:xzha-DEPRECATED-NonHyperShiftHOST-ConnectedOnly-Medium-45359-Default catalogs need to use the correct tags", func() {
exutil.SkipBaselineCaps(oc, "None")
exutil.SkipIfDisableDefaultCatalogsource(oc)
exutil.By("step: get version")
clusterVersion, _, err := exutil.GetClusterVersion(oc)
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("step: oc get catalogsource")
catsrcs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", "-n", "openshift-marketplace").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(catsrcs).NotTo(o.BeEmpty())
e2e.Logf(catsrcs)
defaultCatsrcs := []string{"certified-operators", "community-operators", "redhat-marketplace", "redhat-operators"}
for _, catalogSource := range defaultCatsrcs {
o.Expect(catsrcs).To(o.ContainSubstring(catalogSource))
exutil.By(fmt.Sprintf("step: check image tag of %s", catalogSource))
indexImage, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalogsource", catalogSource, "-n", "openshift-marketplace", "-o=jsonpath={.spec.image}").Output()
if err != nil {
e2e.Failf("fail to get %s's indeximage, error:%v", catalogSource, err)
}
if strings.Contains(indexImage, clusterVersion) {
e2e.Logf("%s", indexImage)
} else {
e2e.Failf("The cluster version is: %s, the indexImage version is: %s", clusterVersion, indexImage)
}
}
})
| |||||
test case
|
openshift/openshift-tests-private
|
9df2704d-8855-4302-8060-80ac3bc0f1a2
|
Author:xzha-ConnectedOnly-Medium-45361-Resolution failed error condition in Subscription should be removed after resolution error is resolved
|
['"context"', '"fmt"', '"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("Author:xzha-ConnectedOnly-Medium-45361-Resolution failed error condition in Subscription should be removed after resolution error is resolved", func() {
architecture.SkipNonAmd64SingleArch(oc)
var (
itName = g.CurrentSpecReport().FullText()
buildIndexBaseDir = exutil.FixturePath("testdata", "olm")
subTemplate = filepath.Join(buildIndexBaseDir, "olm-subscription.yaml")
ogSingleTemplate = filepath.Join(buildIndexBaseDir, "operatorgroup.yaml")
catsrcImageTemplate = filepath.Join(buildIndexBaseDir, "catalogsource-image.yaml")
og = operatorGroupDescription{
name: "og-45361",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "index-45361",
namespace: "",
displayName: "Test Catsrc 45361 Operators",
publisher: "OLM-QE",
sourceType: "grpc",
address: "quay.io/olmqe/nginxolm-operator-index:v1",
interval: "10m",
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "nginx-operator-45361",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "nginx-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
template: subTemplate,
}
)
exutil.By("1) Create new project")
oc.SetupProject()
og.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
exutil.By("2) Create the OperatorGroup ")
og.createwithCheck(oc, itName, dr)
exutil.By("3) Install sub")
sub.createWithoutCheck(oc, itName, dr)
exutil.By("4) 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("5) Sub is created with error message")
message, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions}").Output()
o.Expect(message).To(o.ContainSubstring("index-45361 missing"))
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("6) Create catalog source")
catsrc.create(oc, itName, dr)
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
catsrcStatus, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("catsrc", catsrc.name, "-n", catsrc.namespace, "-o=jsonpath={.status..lastObservedState}").Output()
if strings.Compare(catsrcStatus, "READY") == 0 {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("catalogsource %s is not created", catsrc.name))
exutil.By("7) To wait the csv successed")
sub.findInstalledCSV(oc, itName, dr)
err = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 300*time.Second, false, func(ctx context.Context) (bool, error) {
checknameCsv, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.status.phase}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf(checknameCsv)
if checknameCsv == "Succeeded" {
e2e.Logf("CSV Installed")
return true, nil
}
e2e.Logf("CSV not installed")
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("status.phase of csv %s is not Succeeded", sub.installedCSV))
exutil.By("8) Error message is removed")
newmessage, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.conditions}").Output()
o.Expect(newmessage).NotTo(o.ContainSubstring("index-45361 missing"))
o.Expect(err).NotTo(o.HaveOccurred())
})
| |||||
test case
|
openshift/openshift-tests-private
|
09faffcd-583d-4c4d-9002-cc835158ef77
|
Author:xzha-ConnectedOnly-Medium-43276-oc adm catalog mirror can mirror declaritive index images
|
['"os/exec"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("Author:xzha-ConnectedOnly-Medium-43276-oc adm catalog mirror can mirror declaritive index images", func() {
indexImage := "quay.io/olmqe/etcd-index:dc-new"
operatorAllPath := "operators-all-manifests-" + getRandomString()
defer exec.Command("bash", "-c", "rm -fr ./"+operatorAllPath).Output()
exutil.By("mirror to localhost:5000")
output, err := oc.AsAdmin().WithoutNamespace().Run("adm", "catalog", "mirror").Args("--manifests-only", "--to-manifests="+operatorAllPath, indexImage, "localhost:5000").Output()
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("no digest mapping available for quay.io/olmqe/etcd-bundle:dc, skip writing to ImageContentSourcePolicy"))
o.Expect(output).To(o.ContainSubstring("no digest mapping available for quay.io/olmqe/etcd-index:dc-new, skip writing to ImageContentSourcePolicy"))
o.Expect(output).To(o.ContainSubstring("wrote mirroring manifests"))
exutil.By("check mapping.txt to localhost:5000")
result, err := exec.Command("bash", "-c", "cat ./"+operatorAllPath+"/mapping.txt|grep -E \"localhost:5000/olmqe/etcd-bundle|localhost:5000/olmqe/etcd-index\"").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("mapping result:%s", result)
o.Expect(result).To(o.ContainSubstring("quay.io/olmqe/etcd-bundle:dc=localhost:5000/olmqe/etcd-bundle:dc"))
o.Expect(result).To(o.ContainSubstring("quay.io/olmqe/etcd-index:dc-new=localhost:5000/olmqe/etcd-index:dc-new"))
exutil.By("check icsp yaml to localhost:5000")
result, err = exec.Command("bash", "-c", "cat ./"+operatorAllPath+"/imageContentSourcePolicy.yaml | grep \"localhost:5000\"").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("icsp result:%s", result)
o.Expect(result).To(o.ContainSubstring("- localhost:5000/coreos/etcd-operator"))
})
| |||||
test case
|
openshift/openshift-tests-private
|
cbb30ae6-91ec-4271-9910-c7d81c6ec0fc
|
Author:xzha-ConnectedOnly-VMonly-Medium-25920-Expose bundle data from bundle image container
|
['"path/filepath"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"', '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:xzha-ConnectedOnly-VMonly-Medium-25920-Expose bundle data from bundle image container", func() {
var (
opmBaseDir = exutil.FixturePath("testdata", "opm")
TestDataPath = filepath.Join(opmBaseDir, "etcd_operator")
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
cmTemplate = filepath.Join(buildPruningBaseDir, "cm-template.yaml")
cmName = "cm-25920"
cm = configMapDescription{
name: cmName,
namespace: oc.Namespace(),
template: cmTemplate,
}
itName = g.CurrentSpecReport().FullText()
)
opmCLI := opm.NewOpmCLI()
defer DeleteDir(TestDataPath, "fixture-testdata")
defer DeleteDir(buildPruningBaseDir, "fixture-testdata")
exutil.By("1) create a ConfigMap")
defer cm.delete(itName, dr)
cm.create(oc, itName, dr)
exutil.By("2) opm alpha bundle extract")
_, err := opmCLI.Run("alpha").Args("bundle", "extract", "-c", cmName, "-n", oc.Namespace(), "-k", exutil.KubeConfigPath(), "-m", TestDataPath+"/0.9.2/").Output()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("3) Check the data of this ConfigMap object.")
data, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cm", cmName, "-n", oc.Namespace(), "-o=jsonpath={.metadata.annotations}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(data).To(o.ContainSubstring("operators.operatorframework.io.bundle.channel.default.v1"))
o.Expect(data).To(o.ContainSubstring("operators.operatorframework.io.bundle.channels.v1"))
o.Expect(data).To(o.ContainSubstring("operators.operatorframework.io.bundle.manifests.v1"))
o.Expect(data).To(o.ContainSubstring("operators.operatorframework.io.bundle.mediatype.v1"))
o.Expect(data).To(o.ContainSubstring("operators.operatorframework.io.bundle.metadata.v1"))
o.Expect(data).To(o.ContainSubstring("operators.operatorframework.io.bundle.package.v1"))
})
| |||||
test case
|
openshift/openshift-tests-private
|
09f3c103-de2b-4747-a37f-5ad2111af257
|
VMonly-ConnectedOnly-Author:xzha-Medium-40528-opm can filter the platform/arch of the index image
|
['"os"', '"os/exec"', '"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("VMonly-ConnectedOnly-Author:xzha-Medium-40528-opm can filter the platform/arch of the index image", func() {
baseDir := exutil.FixturePath("testdata", "olm")
TestDataPath := filepath.Join(baseDir, "temp")
indexTmpPath := filepath.Join(TestDataPath, getRandomString())
defer DeleteDir(TestDataPath, indexTmpPath)
err := os.MkdirAll(indexTmpPath, 0755)
o.Expect(err).NotTo(o.HaveOccurred())
indexImage := "registry.redhat.io/redhat/redhat-operator-index:v4.6"
exutil.By("1) check oc adm calalog mirror help")
output, err := oc.AsAdmin().Run("adm").Args("catalog", "mirror", "--help").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("--index-filter-by-os"))
o.Expect(output).NotTo(o.ContainSubstring("--filter-by-os"))
exutil.By("2) run oc adm calalog mirror with --index-filter-by-os=linux/amd64")
dockerconfigjsonpath := filepath.Join(indexTmpPath, ".dockerconfigjson")
defer exec.Command("rm", "-f", dockerconfigjsonpath).Output()
_, err = oc.AsAdmin().Run("extract").Args("secret/pull-secret", "-n", "openshift-config", "--confirm", "--to="+indexTmpPath).Output()
o.Expect(err).NotTo(o.HaveOccurred())
tmpPath1 := filepath.Join(indexTmpPath, "amd64")
output, err = oc.AsAdmin().Run("adm").Args("catalog", "mirror", "--index-filter-by-os=linux/amd64", indexImage,
"localhost:5000", "--manifests-only", "--to-manifests="+tmpPath1, "-a", dockerconfigjsonpath).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("wrote mirroring manifests to "))
exutil.By("3) Check the data of mapping.txt")
result, err := exec.Command("bash", "-c", "cat "+tmpPath1+"/mapping.txt|grep -E redhat-operator-index").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(result).To(o.ContainSubstring("localhost:5000/redhat/redhat-operator-index:v4.6"))
exutil.By("4) run oc adm calalog mirror with --index-filter-by-os=linux/s390x")
tmpPath2 := filepath.Join(indexTmpPath, "s390x")
output, err = oc.AsAdmin().Run("adm").Args("catalog", "mirror", "--index-filter-by-os=linux/s390x", indexImage,
"localhost:5000", "--manifests-only", "--to-manifests="+tmpPath2, "-a", dockerconfigjsonpath).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("wrote mirroring manifests to "))
exutil.By("5) Check the data of mapping.txt")
result, err = exec.Command("bash", "-c", "cat "+tmpPath2+"/mapping.txt|grep -E redhat-operator-index").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(result).To(o.ContainSubstring("localhost:5000/redhat/redhat-operator-index:v4.6"))
exutil.By("6) run oc adm calalog mirror with --index-filter-by-os=linux/abc")
tmpPath3 := filepath.Join(indexTmpPath, "abc")
output, _ = oc.AsAdmin().Run("adm").Args("catalog", "mirror", "--index-filter-by-os=linux/abc", indexImage,
"localhost:5000", "--manifests-only", "--to-manifests="+tmpPath3, "-a", dockerconfigjsonpath).Output()
o.Expect(output).To(o.ContainSubstring("error: the image is a manifest list and contains multiple images"))
})
| |||||
test case
|
openshift/openshift-tests-private
|
979b51e0-05ee-4c53-b779-631d216bdfba
|
VMonly-ConnectedOnly-Author:xzha-High-42979-Bundle authors can explicitly specify arbitrary properties
|
['"context"', '"fmt"', '"io/ioutil"', '"os"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', '"time"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"', '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("VMonly-ConnectedOnly-Author:xzha-High-42979-Bundle authors can explicitly specify arbitrary properties", func() {
if os.Getenv("HTTP_PROXY") != "" || os.Getenv("http_proxy") != "" {
g.Skip("HTTP_PROXY is not empty - skipping test ...")
}
architecture.SkipNonAmd64SingleArch(oc)
var (
containerCLI = container.NewPodmanCLI()
containerTool = "podman"
quayCLI = container.NewQuayCLI()
opmCLI = opm.NewOpmCLI()
bundleImageTag1 = "quay.io/olmqe/cockroachdb-operator:5.0.3-42979-" + getRandomString()
bundleImageTag2 = "quay.io/olmqe/cockroachdb-operator:5.0.4-42979-" + getRandomString()
indexImageTagTmp = "quay.io/olmqe/cockroachdb-index:42979-tmp" + getRandomString()
indexImageTag = "quay.io/olmqe/cockroachdb-index:42979-" + getRandomString()
)
defer containerCLI.RemoveImage(indexImageTag)
defer containerCLI.RemoveImage(bundleImageTag1)
defer containerCLI.RemoveImage(bundleImageTag2)
defer quayCLI.DeleteTag(strings.Replace(indexImageTagTmp, "quay.io/", "", 1))
defer quayCLI.DeleteTag(strings.Replace(indexImageTag, "quay.io/", "", 1))
defer quayCLI.DeleteTag(strings.Replace(bundleImageTag1, "quay.io/", "", 1))
defer quayCLI.DeleteTag(strings.Replace(bundleImageTag2, "quay.io/", "", 1))
output := ""
var err error
exutil.By("build bundle image 1")
opmBaseDir := exutil.FixturePath("testdata", "opm", "cockroachdb", "supportproperties")
TestDataPath1 := filepath.Join(opmBaseDir, "5.0.3")
defer DeleteDir(TestDataPath1, "fixture-testdata")
opmCLI.ExecCommandPath = TestDataPath1
if output, err = opmCLI.Run("alpha").Args("bundle", "build", "-d", "manifests", "-b", containerTool, "-t", bundleImageTag1, "-p", "cockroachdb", "-c", "alpha", "-e", "alpha").Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
if !strings.Contains(output, "Writing annotations.yaml") || !strings.Contains(output, "Writing bundle.Dockerfile") {
e2e.Failf("Failed to execute opm alpha bundle build : %s", output)
}
if output, err = containerCLI.Run("push").Args(bundleImageTag1).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
DeleteDir(TestDataPath1, "fixture-testdata")
exutil.By("build bundle image 2")
opmBaseDir = exutil.FixturePath("testdata", "opm", "cockroachdb", "supportproperties")
TestDataPath2 := filepath.Join(opmBaseDir, "5.0.4")
defer DeleteDir(TestDataPath2, "fixture-testdata")
opmCLI.ExecCommandPath = TestDataPath2
if output, err = opmCLI.Run("alpha").Args("bundle", "build", "-d", "manifests", "-b", containerTool, "-t", bundleImageTag2, "-p", "cockroachdb", "-c", "alpha", "-e", "alpha").Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
if !strings.Contains(output, "Writing annotations.yaml") || !strings.Contains(output, "Writing bundle.Dockerfile") {
e2e.Failf("Failed to execute opm alpha bundle build : %s", output)
}
if output, err = containerCLI.Run("push").Args(bundleImageTag2).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("build index image")
if output, err := opmCLI.Run("index").Args("add", "-b", bundleImageTag1+","+bundleImageTag2, "-t", indexImageTagTmp, "-c", containerTool).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
if output, err := containerCLI.Run("push").Args(indexImageTagTmp).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("Create index directory")
catalogFileName := "catalog"
TmpDataPath := filepath.Join("tmp", "tmp"+getRandomString())
err = os.MkdirAll(TmpDataPath, 0755)
o.Expect(err).NotTo(o.HaveOccurred())
opmCLI.ExecCommandPath = TmpDataPath
exutil.By("Migrate a sqlite-based index image or database file to a file-based catalog")
output, err = opmCLI.Run("migrate").Args(indexImageTagTmp, catalogFileName).Output()
o.Expect(output).To(o.ContainSubstring("file-based catalog"))
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("Generate the index docker file")
_, err = opmCLI.Run("generate").Args("dockerfile", catalogFileName).Output()
o.Expect(err).NotTo(o.HaveOccurred())
dockerFileContent, err := ioutil.ReadFile(filepath.Join(TmpDataPath, catalogFileName+".Dockerfile"))
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(dockerFileContent).To(o.ContainSubstring("--cache-dir=/tmp/cache"))
exutil.By("Build and push the image")
podmanCLI := container.NewPodmanCLI()
podmanCLI.ExecCommandPath = TmpDataPath
output, err = podmanCLI.Run("build").Args(".", "-f", catalogFileName+".Dockerfile", "-t", indexImageTag).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Successfully"))
output, err = podmanCLI.Run("push").Args(indexImageTag).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Writing manifest to image destination"))
var (
itName = g.CurrentSpecReport().FullText()
buildIndexBaseDir = exutil.FixturePath("testdata", "olm")
ogSingleTemplate = filepath.Join(buildIndexBaseDir, "operatorgroup.yaml")
catsrcTemplate = filepath.Join(buildIndexBaseDir, "catalogsource-image-extract.yaml")
subTemplate = filepath.Join(buildIndexBaseDir, "olm-subscription.yaml")
og = operatorGroupDescription{
name: "test-og",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-42979",
namespace: "",
displayName: "Test Catsrc 42979 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: indexImageTag,
template: catsrcTemplate,
}
sub = subscriptionDescription{
subName: "cockroachdb",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "cockroachdb",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "cockroachdb.v5.0.3",
template: subTemplate,
singleNamespace: true,
}
)
defer DeleteDir(buildIndexBaseDir, "fixture-testdata")
oc.SetupProject()
og.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = oc.Namespace()
exutil.By("create the OperatorGroup ")
og.createwithCheck(oc, itName, dr)
exutil.By("Create catalog source")
catsrc.createWithCheck(oc, itName, dr)
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
exists, error := clusterPackageExistsInNamespace(oc, sub, catsrc.namespace)
if !exists || error != nil {
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("package of sub %s does not exist", sub.subName))
exutil.By("install operator")
sub.createWithoutCheck(oc, itName, dr)
sub.expectCSV(oc, itName, dr, "cockroachdb.v5.0.4")
csvOutput := getResource(oc, asAdmin, withoutNamespace, "csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.metadata.annotations}")
o.Expect(string(csvOutput)).To(o.ContainSubstring("version is 5.0.4"))
o.Expect(string(csvOutput)).To(o.ContainSubstring("type5.type5"))
exutil.By("SUCCESS")
})
| |||||
test case
|
openshift/openshift-tests-private
|
946dfc22-62ef-4b94-a44b-2a84960ecf71
|
VMonly-Author:xzha-ConnectedOnly-Medium-43246-Medium-53873-Convert an existing db based index to declarative config
|
['"context"', '"io/ioutil"', '"os"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"path/filepath"', '"strings"', '"time"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"', '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("VMonly-Author:xzha-ConnectedOnly-Medium-43246-Medium-53873-Convert an existing db based index to declarative config", func() {
architecture.SkipNonAmd64SingleArch(oc)
if os.Getenv("HTTP_PROXY") != "" || os.Getenv("http_proxy") != "" {
g.Skip("HTTP_PROXY is not empty - skipping test ...")
}
imagetag := "quay.io/olmqe/community-operator-index:v4.8"
imagetagdc := "quay.io/olmqe/community-operator-index:43246" + getRandomString()
catalogFileName := "catalog"
opmCLI := opm.NewOpmCLI()
quayCLI := container.NewQuayCLI()
exutil.By("Create index directory")
TmpDataPath := filepath.Join("tmp", "tmp"+getRandomString())
err := os.MkdirAll(TmpDataPath, 0755)
o.Expect(err).NotTo(o.HaveOccurred())
opmCLI.ExecCommandPath = TmpDataPath
exutil.By("Migrate a sqlite-based index image or database file to a file-based catalog")
output, err := opmCLI.Run("migrate").Args(imagetag, catalogFileName).Output()
o.Expect(output).To(o.ContainSubstring("file-based catalog"))
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("Generate the index docker file")
_, err = opmCLI.Run("generate").Args("dockerfile", catalogFileName).Output()
o.Expect(err).NotTo(o.HaveOccurred())
dockerFileContent, err := ioutil.ReadFile(filepath.Join(TmpDataPath, catalogFileName+".Dockerfile"))
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(dockerFileContent).To(o.ContainSubstring("--cache-dir=/tmp/cache"))
exutil.By("Build and push the image")
podmanCLI := container.NewPodmanCLI()
podmanCLI.ExecCommandPath = TmpDataPath
output, err = podmanCLI.Run("build").Args(".", "-f", catalogFileName+".Dockerfile", "-t", imagetagdc).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Successfully"))
defer quayCLI.DeleteTag(strings.Replace(imagetagdc, "quay.io/", "", 1))
output, err = podmanCLI.Run("push").Args(imagetagdc).Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("Writing manifest to image destination"))
exutil.By("create namespace and catsrc")
itName := g.CurrentSpecReport().FullText()
buildIndexBaseDir := exutil.FixturePath("testdata", "olm")
catsrcTemplate := filepath.Join(buildIndexBaseDir, "catalogsource-image-extract.yaml")
oc.SetupProject()
ns := oc.Namespace()
catsrc := catalogSourceDescription{
name: "catsrc-43246",
namespace: ns,
displayName: "Test Catsrc 43246 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: imagetagdc,
template: catsrcTemplate,
}
oc.SetupProject()
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc, itName, dr)
exutil.By("check packagemanifest")
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 120*time.Second, false, func(ctx context.Context) (bool, error) {
output, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "--all-namespaces").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(output, "Test Catsrc 43246 Operators") {
return true, nil
}
e2e.Logf("packagemanifest of Test Catsrc 43246 Operators doesn't exist, go next round")
return false, nil
})
if err != nil {
output, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("catsrc", catsrc.name, "-n", ns, "-o=jsonpath={.status}").Output()
e2e.Logf(output)
output, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "-n", ns).Output()
e2e.Logf(output)
output, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", ns).Output()
e2e.Logf(output)
}
exutil.AssertWaitPollNoErr(err, "packagemanifest of Test Catsrc 43246 Operators doesn't exist")
exutil.By("43246 SUCCESS")
})
| |||||
test case
|
openshift/openshift-tests-private
|
f80f7c8c-b8b1-4ea5-919f-2b936bad81dc
|
VMonly-ConnectedOnly-Author:kuiwang-Medium-30835-complete operator upgrades automatically based on SemVer setting default channel in opm alpha bundle build
|
['"os"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"github.com/blang/semver"', '"path/filepath"', '"strings"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"', 'container "github.com/openshift/openshift-tests-private/test/extended/util/container"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("VMonly-ConnectedOnly-Author:kuiwang-Medium-30835-complete operator upgrades automatically based on SemVer setting default channel in opm alpha bundle build", func() {
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())
e2e.Logf("platform: %v", platform)
if proxy != "" || strings.Contains(platform, "openstack") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "none") ||
strings.Contains(platform, "vsphere") || strings.Contains(platform, "osp") || strings.Contains(platform, "ibmcloud") || strings.Contains(platform, "nutanix") ||
os.Getenv("HTTP_PROXY") != "" || os.Getenv("HTTPS_PROXY") != "" || os.Getenv("http_proxy") != "" || os.Getenv("https_proxy") != "" ||
exutil.Is3MasterNoDedicatedWorkerNode(oc) {
g.Skip("it is not supported")
}
var (
itName = g.CurrentSpecReport().FullText()
buildIndexBaseDir = exutil.FixturePath("testdata", "olm")
subTemplate = filepath.Join(buildIndexBaseDir, "olm-subscription.yaml")
ogSingleTemplate = filepath.Join(buildIndexBaseDir, "operatorgroup.yaml")
catsrcImageTemplate = filepath.Join(buildIndexBaseDir, "catalogsource-image.yaml")
containerCLI = container.NewPodmanCLI()
containerTool = "podman"
quayCLI = container.NewQuayCLI()
// these bundles are prepared data, do not need to remove them after case exits.
bundleImageTag1 = "quay.io/olmqe/cockroachdb-operator:5.0.3-30835"
bundleImageTag2 = "quay.io/olmqe/cockroachdb-operator:5.0.4-30835"
// these index are generated by case, need to ensure to remove them after case exits.
indexImageTag1 = "quay.io/olmqe/cockroachdb-index:5.0.3-30835-" + getRandomString()
indexImageTag2 = "quay.io/olmqe/cockroachdb-index:5.0.4-30835-" + getRandomString()
og = operatorGroupDescription{
name: "test-og",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-30835",
namespace: "",
displayName: "Test Catsrc 30835 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: indexImageTag2,
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "cockroachdb",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "cockroachdb",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "cockroachdb.v5.0.3",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
)
defer DeleteDir(buildIndexBaseDir, "fixture-testdata")
defer containerCLI.RemoveImage(indexImageTag1)
defer containerCLI.RemoveImage(indexImageTag2)
defer quayCLI.DeleteTag(strings.Replace(indexImageTag1, "quay.io/", "", 1))
defer quayCLI.DeleteTag(strings.Replace(indexImageTag2, "quay.io/", "", 1))
oc.SetupProject()
og.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
exutil.By("create the OperatorGroup ")
og.createwithCheck(oc, itName, dr)
exutil.By("pull bundle image for index image")
_, err := containerCLI.Run("pull").Args(bundleImageTag1).Output()
o.Expect(err).NotTo(o.HaveOccurred())
_, err = containerCLI.Run("pull").Args(bundleImageTag2).Output()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("build index image 1")
if output, err := opm.NewOpmCLI().Run("index").Args("add", "-b", bundleImageTag1, "-t", indexImageTag1, "-c", containerTool).Output(); err != nil {
e2e.Logf(output)
if strings.Contains(output, "error building") {
g.Skip("skip case because we can not prepare data")
}
o.Expect(err).NotTo(o.HaveOccurred())
}
if output, err := containerCLI.Run("push").Args(indexImageTag1).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("build index image 2")
if output, err := opm.NewOpmCLI().Run("index").Args("add", "-b", bundleImageTag2, "-f", indexImageTag1, "-t", indexImageTag2, "-c", containerTool, "--mode", "semver").Output(); err != nil {
e2e.Logf(output)
if strings.Contains(output, "error building") {
g.Skip("skip case because we can not prepare data")
}
o.Expect(err).NotTo(o.HaveOccurred())
}
if output, err := containerCLI.Run("push").Args(indexImageTag2).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("Create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator")
sub.createWithoutCheck(oc, itName, dr)
sub.expectCSV(oc, itName, dr, "cockroachdb.v5.0.4")
exutil.By("delete the catsrc sub csv") // actually this step could not be necessary because the resource of the project will be removed when the project is removed
catsrc.delete(itName, dr)
sub.delete(itName, dr)
sub.getCSV().delete(itName, dr)
})
| |||||
test case
|
openshift/openshift-tests-private
|
d2645ba7-eb21-440c-b725-f329d317cb9c
|
VMonly-ConnectedOnly-Author:kuiwang-Medium-30860-complete operator upgrades automatically based on SemVer instead of replaces or skips [Slow]
|
['"context"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"github.com/blang/semver"', '"path/filepath"', '"strings"', '"time"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"', 'container "github.com/openshift/openshift-tests-private/test/extended/util/container"', '"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("VMonly-ConnectedOnly-Author:kuiwang-Medium-30860-complete operator upgrades automatically based on SemVer instead of replaces or skips [Slow]", func() {
architecture.SkipNonAmd64SingleArch(oc)
node, errNode := oc.AsAdmin().WithoutNamespace().Run("get").Args("node", "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(errNode).NotTo(o.HaveOccurred())
errSet := exutil.SetNamespacePrivileged(oc, oc.Namespace())
o.Expect(errSet).NotTo(o.HaveOccurred())
efips, errFips := oc.AsAdmin().WithoutNamespace().Run("debug").Args("node/"+node, "--to-namespace="+oc.Namespace(), "--", "chroot", "/host", "fips-mode-setup", "--check").Output()
if errFips != nil || strings.Contains(efips, "FIPS mode is enabled") {
g.Skip("skip it without impacting function")
}
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") {
g.Skip("it is not supported")
}
var (
itName = g.CurrentSpecReport().FullText()
buildIndexBaseDir = exutil.FixturePath("testdata", "olm")
subTemplate = filepath.Join(buildIndexBaseDir, "olm-subscription.yaml")
ogSingleTemplate = filepath.Join(buildIndexBaseDir, "operatorgroup.yaml")
catsrcImageTemplate = filepath.Join(buildIndexBaseDir, "catalogsource-image.yaml")
containerCLI = container.NewPodmanCLI()
containerTool = "podman"
quayCLI = container.NewQuayCLI()
// these bundles are prepared data, do not need to remove them after case exits.
bundleImageTag1 = "quay.io/olmqe/oadp-operator:v0.5.3-2378"
bundleImageTag2 = "quay.io/olmqe/oadp-operator:v0.5.4-2378"
bundleImageTag3 = "quay.io/olmqe/oadp-operator:v0.5.5-2378"
// these index are generated by case, need to ensure to remove them after case exits.
indexImageTag1 = "quay.io/olmqe/mta-index:0.0.3-30860-" + getRandomString()
indexImageTag2 = "quay.io/olmqe/mta-index:0.0.5-30860-" + getRandomString()
indexImageTag3 = "quay.io/olmqe/mta-index:0.0.4-30860-" + getRandomString()
og = operatorGroupDescription{
name: "test-og",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-30860",
namespace: "",
displayName: "Test Catsrc 30860 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: indexImageTag3,
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "oadp",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "oadp-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "oadp-operator.v0.5.3",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
)
defer DeleteDir(buildIndexBaseDir, "fixture-testdata")
defer containerCLI.RemoveImage(indexImageTag1)
defer containerCLI.RemoveImage(indexImageTag2)
defer containerCLI.RemoveImage(indexImageTag3)
defer quayCLI.DeleteTag(strings.Replace(indexImageTag1, "quay.io/", "", 1))
defer quayCLI.DeleteTag(strings.Replace(indexImageTag2, "quay.io/", "", 1))
defer quayCLI.DeleteTag(strings.Replace(indexImageTag3, "quay.io/", "", 1))
oc.SetupProject()
og.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
exutil.By("create the OperatorGroup ")
og.createwithCheck(oc, itName, dr)
exutil.By("pull bundle image for index image")
_, err := containerCLI.Run("pull").Args(bundleImageTag1).Output()
o.Expect(err).NotTo(o.HaveOccurred())
_, err = containerCLI.Run("pull").Args(bundleImageTag2).Output()
o.Expect(err).NotTo(o.HaveOccurred())
_, err = containerCLI.Run("pull").Args(bundleImageTag3).Output()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("build index image 1")
if output, err := opm.NewOpmCLI().Run("index").Args("add", "-b", bundleImageTag1, "-t", indexImageTag1, "-c", containerTool, "--mode", "semver").Output(); err != nil {
e2e.Logf(output)
if strings.Contains(output, "error building") {
g.Skip("skip case because we can not prepare data")
}
o.Expect(err).NotTo(o.HaveOccurred())
}
if output, err := containerCLI.Run("push").Args(indexImageTag1).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("build index image 2")
if output, err := opm.NewOpmCLI().Run("index").Args("add", "-b", bundleImageTag2, "-f", indexImageTag1, "-t", indexImageTag2, "-c", containerTool, "--mode", "semver").Output(); err != nil {
e2e.Logf(output)
if strings.Contains(output, "error building") {
g.Skip("skip case because we can not prepare data")
}
o.Expect(err).NotTo(o.HaveOccurred())
}
if output, err := containerCLI.Run("push").Args(indexImageTag2).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("build index image 3")
if output, err := opm.NewOpmCLI().Run("index").Args("add", "-b", bundleImageTag3, "-f", indexImageTag2, "-t", indexImageTag3, "-c", containerTool, "--mode", "semver").Output(); err != nil {
e2e.Logf(output)
if strings.Contains(output, "error building") {
g.Skip("skip case because we can not prepare data")
}
o.Expect(err).NotTo(o.HaveOccurred())
}
if output, err := containerCLI.Run("push").Args(indexImageTag3).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("Create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator")
sub.createWithoutCheck(oc, itName, dr) // actually it is operator upgrade
state := ""
err = wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 240*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
}
return false, nil
})
if err != nil {
e2e.Logf("state is %v", state)
if len(state) == 0 {
g.Skip("the opertor does not start installation")
}
if strings.Compare(state, "UpgradeAvailable") == 0 {
newCheck("expect", asAdmin, withoutNamespace, compare, "oadp-operator.v0.5.4", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installedCSV}"}).check(oc)
} else {
e2e.Failf("the operator does not start upgrade")
}
} else {
sub.expectCSV(oc, itName, dr, "oadp-operator.v0.5.5")
}
exutil.By("delete the catsrc sub csv") // actually this step could not be necessary because the resource of the project will be removed when the project is removed
catsrc.delete(itName, dr)
sub.delete(itName, dr)
sub.getCSV().delete(itName, dr)
})
| |||||
test case
|
openshift/openshift-tests-private
|
b8f785bb-b773-4f99-be0f-b00dcaadba10
|
VMonly-ConnectedOnly-Author:kuiwang-Medium-30674-complete operator upgrades automatically based on SemVer without setting default channel
|
['"os"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"github.com/blang/semver"', '"path/filepath"', '"strings"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"', 'container "github.com/openshift/openshift-tests-private/test/extended/util/container"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("VMonly-ConnectedOnly-Author:kuiwang-Medium-30674-complete operator upgrades automatically based on SemVer without setting default channel", func() {
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())
e2e.Logf("platform: %v", platform)
if proxy != "" || strings.Contains(platform, "openstack") || strings.Contains(platform, "baremetal") || strings.Contains(platform, "none") ||
strings.Contains(platform, "vsphere") || strings.Contains(platform, "osp") || strings.Contains(platform, "ibmcloud") || strings.Contains(platform, "nutanix") ||
os.Getenv("HTTP_PROXY") != "" || os.Getenv("HTTPS_PROXY") != "" || os.Getenv("http_proxy") != "" || os.Getenv("https_proxy") != "" ||
exutil.Is3MasterNoDedicatedWorkerNode(oc) {
g.Skip("it is not supported")
}
var (
itName = g.CurrentSpecReport().FullText()
buildIndexBaseDir = exutil.FixturePath("testdata", "olm")
subTemplate = filepath.Join(buildIndexBaseDir, "olm-subscription.yaml")
ogSingleTemplate = filepath.Join(buildIndexBaseDir, "operatorgroup.yaml")
catsrcImageTemplate = filepath.Join(buildIndexBaseDir, "catalogsource-image.yaml")
containerCLI = container.NewPodmanCLI()
containerTool = "podman"
quayCLI = container.NewQuayCLI()
// these bundles are prepared data, do not need to remove them after case exits.
bundleImageTag1 = "quay.io/olmqe/cockroachdb-operator:5.0.3-30674"
bundleImageTag2 = "quay.io/olmqe/cockroachdb-operator:5.0.4-30674"
// these index are generated by case, need to ensure to remove them after case exits.
indexImageTag1 = "quay.io/olmqe/cockroachdb-index:5.0.3-30674-" + getRandomString()
indexImageTag2 = "quay.io/olmqe/cockroachdb-index:5.0.4-30674-" + getRandomString()
og = operatorGroupDescription{
name: "test-og",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-30674",
namespace: "",
displayName: "Test Catsrc 30674 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: indexImageTag2,
template: catsrcImageTemplate,
}
sub = subscriptionDescription{
subName: "cockroachdb",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "cockroachdb",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "cockroachdb.v5.0.3",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
)
defer DeleteDir(buildIndexBaseDir, "fixture-testdata")
defer containerCLI.RemoveImage(indexImageTag1)
defer containerCLI.RemoveImage(indexImageTag2)
defer quayCLI.DeleteTag(strings.Replace(indexImageTag1, "quay.io/", "", 1))
defer quayCLI.DeleteTag(strings.Replace(indexImageTag2, "quay.io/", "", 1))
oc.SetupProject()
og.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
exutil.By("create the OperatorGroup ")
og.createwithCheck(oc, itName, dr)
exutil.By("pull bundle image for index image")
_, err := containerCLI.Run("pull").Args(bundleImageTag1).Output()
o.Expect(err).NotTo(o.HaveOccurred())
_, err = containerCLI.Run("pull").Args(bundleImageTag2).Output()
o.Expect(err).NotTo(o.HaveOccurred())
exutil.By("build index image 1")
if output, err := opm.NewOpmCLI().Run("index").Args("add", "-b", bundleImageTag1, "-t", indexImageTag1, "-c", containerTool).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
if output, err := containerCLI.Run("push").Args(indexImageTag1).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("build index image 2")
if output, err := opm.NewOpmCLI().Run("index").Args("add", "-b", bundleImageTag2, "-f", indexImageTag1, "-t", indexImageTag2, "-c", containerTool, "--mode", "semver").Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
if output, err := containerCLI.Run("push").Args(indexImageTag2).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("Create catalog source")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator")
sub.createWithoutCheck(oc, itName, dr)
sub.expectCSV(oc, itName, dr, "cockroachdb.v5.0.4")
exutil.By("delete the catsrc sub csv") // actually this step could not be necessary because the resource of the project will be removed when the project is removed
catsrc.delete(itName, dr)
sub.delete(itName, dr)
sub.getCSV().delete(itName, dr)
})
| |||||
test case
|
openshift/openshift-tests-private
|
47a94e01-6b76-49b1-b294-0e52ca4bf7c3
|
VMonly-ConnectedOnly-Author:kuiwang-Medium-29810-The bundle and index image reated successfully when spec replaces field is null
|
['"github.com/openshift/openshift-tests-private/test/extended/util/architecture"', '"github.com/blang/semver"', '"path/filepath"', '"strings"', 'opm "github.com/openshift/openshift-tests-private/test/extended/opm"', 'container "github.com/openshift/openshift-tests-private/test/extended/util/container"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("VMonly-ConnectedOnly-Author:kuiwang-Medium-29810-The bundle and index image reated successfully when spec replaces field is null", func() {
architecture.SkipNonAmd64SingleArch(oc)
node, errNode := oc.AsAdmin().WithoutNamespace().Run("get").Args("node", "--selector=node.openshift.io/os_id=rhcos,node-role.kubernetes.io/master=", "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(errNode).NotTo(o.HaveOccurred())
errSet := exutil.SetNamespacePrivileged(oc, oc.Namespace())
o.Expect(errSet).NotTo(o.HaveOccurred())
efips, errFips := oc.AsAdmin().WithoutNamespace().Run("debug").Args("node/"+node, "--to-namespace="+oc.Namespace(), "--", "chroot", "/host", "fips-mode-setup", "--check").Output()
if errFips != nil || strings.Contains(efips, "FIPS mode is enabled") {
g.Skip("skip it without impacting function")
}
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") {
g.Skip("it is not supported")
}
var (
itName = g.CurrentSpecReport().FullText()
buildIndexBaseDir = exutil.FixturePath("testdata", "olm")
ogSingleTemplate = filepath.Join(buildIndexBaseDir, "operatorgroup.yaml")
opmBaseDir = exutil.FixturePath("testdata", "opm")
containerCLI = container.NewPodmanCLI()
containerTool = "podman"
quayCLI = container.NewQuayCLI()
opmCLI = opm.NewOpmCLI()
// these bundles are generated by case, need to ensure to remove them after case exits.
bundleImageTag1 = "quay.io/olmqe/cockroachdb-operator:5.0.3-29810-" + getRandomString()
bundleImageTag2 = "quay.io/olmqe/cockroachdb-operator:5.0.4-29810-" + getRandomString()
// these index are generated by case, need to ensure to remove them after case exits.
indexImageTag1 = "quay.io/olmqe/cockroachdb-index:5.0.3-29810-" + getRandomString()
indexImageTag2 = "quay.io/olmqe/cockroachdb-index:5.0.4-29810-" + getRandomString()
og = operatorGroupDescription{
name: "test-og",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-29810",
namespace: "",
displayName: "Test Catsrc 29810 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: indexImageTag2,
template: "",
}
sub = subscriptionDescription{
subName: "cockroachdb",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "cockroachdb",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "cockroachdb.v5.0.3",
currentCSV: "",
installedCSV: "",
template: "",
singleNamespace: true,
}
)
defer DeleteDir(buildIndexBaseDir, "fixture-testdata")
defer containerCLI.RemoveImage(indexImageTag1)
defer containerCLI.RemoveImage(indexImageTag2)
defer containerCLI.RemoveImage(bundleImageTag1)
defer containerCLI.RemoveImage(bundleImageTag2)
defer quayCLI.DeleteTag(strings.Replace(indexImageTag1, "quay.io/", "", 1))
defer quayCLI.DeleteTag(strings.Replace(indexImageTag2, "quay.io/", "", 1))
defer quayCLI.DeleteTag(strings.Replace(bundleImageTag1, "quay.io/", "", 1))
defer quayCLI.DeleteTag(strings.Replace(bundleImageTag2, "quay.io/", "", 1))
oc.SetupProject()
og.namespace = oc.Namespace()
catsrc.namespace = oc.Namespace()
sub.namespace = oc.Namespace()
sub.catalogSourceNamespace = catsrc.namespace
exutil.By("create the OperatorGroup ")
og.createwithCheck(oc, itName, dr)
output := ""
var err error
exutil.By("build bundle image 1")
TestDataPath1 := filepath.Join(opmBaseDir, "cockroachdb", "supportsemver")
defer DeleteDir(TestDataPath1, "fixture-testdata")
opmCLI.ExecCommandPath = TestDataPath1
if output, err = opmCLI.Run("alpha").Args("bundle", "build", "-d", "5.0.3", "-b", "podman", "-t", bundleImageTag1, "-p", "cockroachdb", "-c", "alpha", "-e", "alpha").Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
if !strings.Contains(output, "Writing annotations.yaml") || !strings.Contains(output, "Writing bundle.Dockerfile") {
e2e.Failf("Failed to execute opm alpha bundle build : %s", output)
}
if output, err = containerCLI.Run("push").Args(bundleImageTag1).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
DeleteDir(TestDataPath1, "fixture-testdata")
exutil.By("build bundle image 2")
opmBaseDir = exutil.FixturePath("testdata", "opm")
TestDataPath2 := filepath.Join(opmBaseDir, "cockroachdb", "supportsemver")
defer DeleteDir(TestDataPath2, "fixture-testdata")
opmCLI.ExecCommandPath = TestDataPath2
if output, err = opmCLI.Run("alpha").Args("bundle", "build", "-d", "5.0.4", "-b", "podman", "-t", bundleImageTag2, "-p", "cockroachdb", "-c", "alpha", "-e", "alpha").Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
if !strings.Contains(output, "Writing annotations.yaml") || !strings.Contains(output, "Writing bundle.Dockerfile") {
e2e.Failf("Failed to execute opm alpha bundle build : %s", output)
}
if output, err = containerCLI.Run("push").Args(bundleImageTag2).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("build index image 1")
if output, err := opmCLI.Run("index").Args("add", "-b", bundleImageTag1, "-t", indexImageTag1, "-c", containerTool).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
if output, err := containerCLI.Run("push").Args(indexImageTag1).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("build index image 2")
if output, err := opmCLI.Run("index").Args("add", "-b", bundleImageTag2, "-f", indexImageTag1, "-t", indexImageTag2, "-c", containerTool, "--mode", "semver").Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
if output, err := containerCLI.Run("push").Args(indexImageTag2).Output(); err != nil {
e2e.Logf(output)
o.Expect(err).NotTo(o.HaveOccurred())
}
exutil.By("Create catalog source")
buildIndexBaseDir = exutil.FixturePath("testdata", "olm")
catsrc.template = filepath.Join(buildIndexBaseDir, "catalogsource-image.yaml")
catsrc.createWithCheck(oc, itName, dr)
exutil.By("install operator")
sub.template = filepath.Join(buildIndexBaseDir, "olm-subscription.yaml")
sub.createWithoutCheck(oc, itName, dr)
sub.expectCSV(oc, itName, dr, "cockroachdb.v5.0.4")
exutil.By("delete the catsrc sub csv") // actually this step could not be necessary because the resource of the project will be removed when the project is removed
catsrc.delete(itName, dr)
sub.delete(itName, dr)
sub.getCSV().delete(itName, dr)
})
| |||||
test case
|
openshift/openshift-tests-private
|
fe248e83-7ab2-431f-80d9-8d5054f6590a
|
VMonly-ConnectedOnly-Author:kuiwang-Medium-30695-oc adm catalog mirror should mirror bundle images
|
['"os/exec"', '"github.com/openshift/openshift-tests-private/test/extended/util/architecture"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("VMonly-ConnectedOnly-Author:kuiwang-Medium-30695-oc adm catalog mirror should mirror bundle images", func() {
architecture.SkipArchitectures(oc, architecture.PPC64LE, architecture.S390X, architecture.MULTI)
var (
// it is prepared index, and no need to remove it.
indexImageTag = "quay.io/olmqe/cockroachdb-index:2.1.11-30695"
cockroachdbPath = "operators-cockroachdb-manifests-" + getRandomString()
)
defer exec.Command("bash", "-c", "rm -fr ./"+cockroachdbPath).Output()
exutil.By("mirror to localhost:5000")
output, err := oc.AsAdmin().WithoutNamespace().Run("adm", "catalog", "mirror").Args("--manifests-only", "--to-manifests="+cockroachdbPath, indexImageTag, "localhost:5000").Output()
e2e.Logf("the output is %v", output)
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(output).To(o.ContainSubstring("operators-cockroachdb-manifests"))
exutil.By("check mapping.txt to localhost:5000")
result, err := exec.Command("bash", "-c", "cat ./"+cockroachdbPath+"/mapping.txt|grep -E \"quay.io/kuiwang/cockroachdb-operator\"").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(result).To(o.ContainSubstring("cockroachdb-operator:2.1.11"))
})
| |||||
test case
|
openshift/openshift-tests-private
|
97ed6581-024e-4ef1-a6b6-559d74c8d814
|
Author:jiazha-ROSA-OSD_CCS-ARO-NonHyperShiftHOST-High-21953-Ensure that operator deployment is in the master node
|
['"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-21953-Ensure that operator deployment is in the master node", func() {
exutil.SkipBaselineCaps(oc, "None")
var (
err error
msg string
olmErrs = true
olmJpath = "-o=jsonpath={@.spec.template.spec.nodeSelector}"
olmNamespace = "openshift-marketplace"
olmNodeName string
olmPodFullName string
olmPodName = "marketplace-operator"
nodeRole = "node-role.kubernetes.io/master"
nodes string
nodeStatus bool
pod string
pods string
status []string
x []string
)
exutil.By("Get deployment")
msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", "-n", olmNamespace, olmPodName, olmJpath).Output()
if err != nil {
e2e.Logf("Unable to get deployment -n %v %v %v.", olmNamespace, olmPodName, olmJpath)
}
o.Expect(err).NotTo(o.HaveOccurred())
if len(msg) < 1 || !strings.Contains(msg, nodeRole) {
e2e.Failf("Could not find %v variable %v for %v: %v", olmJpath, nodeRole, olmPodName, msg)
}
exutil.By("Look at pods")
// look for the marketplace-operator pod's full name
pods, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", olmNamespace, "-o", "wide").Output()
if err != nil {
e2e.Logf("Unable to query pods -n %v %v %v.", olmNamespace, err, pods)
}
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(pods).NotTo(o.ContainSubstring("No resources found"))
// e2e.Logf("Pods %v ", pods)
for _, pod = range strings.Split(pods, "\n") {
if len(pod) <= 0 {
continue
}
// Find the node in the pod
if strings.Contains(pod, olmPodName) {
x = strings.Fields(pod)
olmPodFullName = x[0]
// olmNodeName = x[6]
olmNodeName, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-n", olmNamespace, olmPodFullName, "-o=jsonpath={.spec.nodeName}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
olmErrs = false
// e2e.Logf("Found pod is %v", pod)
break
}
}
if olmErrs {
e2e.Failf("Unable to find the full pod name for %v in %v: %v.", olmPodName, olmNamespace, pods)
}
exutil.By("Query node label value")
// Look at the setting for the node to be on the master
olmErrs = true
nodes, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "-n", olmNamespace, olmNodeName, "-o=jsonpath={.metadata.labels}").Output()
if err != nil {
e2e.Failf("Unable to query nodes -n %v %v %v.", olmNamespace, err, nodes)
}
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(nodes).To(o.ContainSubstring("node-role.kubernetes.io/master"))
exutil.By("look at oc get nodes")
// Found the setting, verify that it's really on the master node
msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "-n", olmNamespace, olmNodeName, "--show-labels", "--no-headers").Output()
if err != nil {
e2e.Failf("Unable to query the %v node of pod %v for %v's status", olmNodeName, olmPodFullName, msg)
}
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(msg).NotTo(o.ContainSubstring("No resources found"))
status = strings.Fields(msg)
if strings.Contains(status[2], "master") {
olmErrs = false
nodeStatus = true
e2e.Logf("node %v is a %v", olmNodeName, status[2])
}
if olmErrs || !nodeStatus {
e2e.Failf("The node %v of %v pod is not a master:%v", olmNodeName, olmPodFullName, msg)
}
exutil.By("Finish")
e2e.Logf("The pod %v is on the master node %v", olmPodFullName, olmNodeName)
})
| |||||
test case
|
openshift/openshift-tests-private
|
fe417bc6-b1bc-4ad7-8cb3-e4771c9d7b3a
|
ROSA-OSD_CCS-HyperShiftMGMT-Author:bandrade-High-45408-Eliminate use of imagestreams in catalog management
|
['"strings"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("ROSA-OSD_CCS-HyperShiftMGMT-Author:bandrade-High-45408-Eliminate use of imagestreams in catalog management", func() {
controlProject := hostedClusterNS + "-" + guestClusterName
if !isAKS {
exutil.SkipBaselineCaps(oc, "None")
exutil.By("1) check if uses the ImageStream resource")
isOutput, err := oc.AsAdmin().Run("get").Args("is", "catalogs", "-n", controlProject, "-o", "yaml").Output()
if err != nil {
e2e.Failf("Fail to get cronjob in project: %s, error:%v", controlProject, err)
}
is := []string{"certified-operators", "community-operators", "redhat-marketplace", "redhat-operators"}
for _, imageStream := range is {
if !strings.Contains(isOutput, imageStream) {
e2e.Failf("find ImageStream:%s in project:%v", imageStream, controlProject)
}
}
}
exutil.By("2) check if Deployment uses the ImageStream")
deploys := []string{"certified-operators-catalog", "community-operators-catalog", "redhat-marketplace-catalog", "redhat-operators-catalog"}
for _, deploy := range deploys {
annotations, err := oc.AsAdmin().Run("get").Args("deployment", "-n", controlProject, deploy, "-o=jsonpath={.metadata.annotations}").Output()
if err != nil {
e2e.Failf("Fail to get deploy:%s in project: %s, error:%v", deploy, controlProject, err)
}
if !isAKS {
if !strings.Contains(strings.ToLower(annotations), "imagestream") {
e2e.Failf("The deploy does not use ImageStream: %v", annotations)
}
} else {
if strings.Contains(strings.ToLower(annotations), "imagestream") {
e2e.Failf("The deploy does not use ImageStream: %v", annotations)
}
}
}
})
| |||||
test case
|
openshift/openshift-tests-private
|
7f8e1ead-e975-4043-8879-e9b6ee16ed47
|
Author:jiazha-ROSA-OSD_CCS-ARO-OSD_CCS-HyperShiftMGMT-High-45348-High-45543-Enable hypershift to deploy OperatorLifecycleManager resources
|
['"fmt"', '"os/exec"', '"encoding/json"', '"path/filepath"', '"strings"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("Author:jiazha-ROSA-OSD_CCS-ARO-OSD_CCS-HyperShiftMGMT-High-45348-High-45543-Enable hypershift to deploy OperatorLifecycleManager resources", func() {
exutil.By("1, check if any resource running in the guest cluster")
projects := []string{"openshift-operator-lifecycle-manager", "openshift-marketplace"}
for _, project := range projects {
resource, err := oc.AsAdmin().AsGuestKubeconf().Run("get").Args("pods", "-n", project).Output()
if err != nil {
e2e.Failf("Fail to get resource in project: %s, error:%v", project, err)
}
// now, for guest cluster, there is may have a custom catalog resource for testing
if project == "openshift-marketplace" && strings.Contains(resource, "marketplace-operator") {
e2e.Failf("Found Marketplace related resources running on the guest cluster")
}
if project != "openshift-marketplace" && !strings.Contains(resource, "No resources found") {
e2e.Failf("Found OLM related resources running on the guest cluster")
}
}
buildPruningBaseDir := exutil.FixturePath("testdata", "olm")
dr := make(describerResrouce)
itName := g.CurrentSpecReport().FullText()
dr.addIr(itName)
exutil.By("2, create an OperatorGroup")
ns := "guest-cluster-45543"
err := oc.AsGuestKubeconf().Run("create").Args("ns", ns).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
defer oc.AsGuestKubeconf().Run("delete").Args("ns", ns).Execute()
ogSingleTemplate := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
og := operatorGroupDescription{
name: "og-45348",
namespace: ns,
template: ogSingleTemplate,
}
defer og.delete(itName, dr)
og.createwithCheck(oc.AsGuestKubeconf(), itName, dr)
// exutil.By("2, create a CatalogSource that in a random project")
// csImageTemplate := filepath.Join(buildPruningBaseDir, "cs-image-template.yaml")
// cmdString := `oc version -o json | jq -r '.openshiftVersion' | cut -d '.' -f1,2`
// if isAKS {
// cmdString = fmt.Sprintf(`oc --kubeconfig=%s version -o json | jq -r '.openshiftVersion' | cut -d '.' -f1,2`, guestClusterKube)
// }
// ocpVersionByte, err := exec.Command("bash", "-c", cmdString).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-45348",
// namespace: ns,
// displayName: "QE Operators",
// publisher: "QE",
// sourceType: "grpc",
// address: indexImage,
// template: csImageTemplate,
// }
// defer cs.delete(itName, dr)
// cs.createWithCheck(oc.AsGuestKubeconf(), itName, dr)
exutil.By("3, subscribe to learn-operator.v0.0.3")
subTemplate := filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
sub := subscriptionDescription{
subName: "sub-45348",
namespace: ns,
// catalogSourceName: "cs-45348",
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.AsGuestKubeconf(), itName, dr)
defer sub.deleteCSV(itName, dr)
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", "learn-operator.v0.0.3", "-n", ns, "-o=jsonpath={.status.phase}"}).check(oc.AsGuestKubeconf())
})
| |||||
test case
|
openshift/openshift-tests-private
|
8d201d5e-7e31-438b-a33c-9bf4c0727daa
|
ROSA-OSD_CCS-HyperShiftMGMT-ConnectedOnly-Author:kuiwang-Medium-45381-Support custom catalogs in hypershift
|
['"path/filepath"']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm.go
|
g.It("ROSA-OSD_CCS-HyperShiftMGMT-ConnectedOnly-Author:kuiwang-Medium-45381-Support custom catalogs in hypershift", func() {
var (
itName = g.CurrentSpecReport().FullText()
buildPruningBaseDir = exutil.FixturePath("testdata", "olm")
ogSingleTemplate = filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subTemplate = filepath.Join(buildPruningBaseDir, "olm-subscription.yaml")
catsrcImageTemplate = filepath.Join(buildPruningBaseDir, "catalogsource-image.yaml")
og = operatorGroupDescription{
name: "og-singlenamespace",
namespace: "",
template: ogSingleTemplate,
}
catsrc = catalogSourceDescription{
name: "catsrc-2378-operator",
namespace: "",
displayName: "Test Catsrc 2378 Operators",
publisher: "Red Hat",
sourceType: "grpc",
address: "quay.io/olmqe/olm-index:OLM-2378-Oadp-GoodOne-multi",
template: catsrcImageTemplate,
}
subOadp = subscriptionDescription{
subName: "oadp-operator",
namespace: "",
channel: "alpha",
ipApproval: "Automatic",
operatorPackage: "oadp-operator",
catalogSourceName: catsrc.name,
catalogSourceNamespace: "",
startingCSV: "oadp-operator.v0.5.3",
currentCSV: "",
installedCSV: "",
template: subTemplate,
singleNamespace: true,
}
dr = make(describerResrouce)
)
exutil.By("init resource")
dr.addIr(itName)
ns := "guest-cluster-45381"
err := oc.AsGuestKubeconf().Run("create").Args("ns", ns).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
defer oc.AsGuestKubeconf().Run("delete").Args("ns", ns).Execute()
og.namespace = ns
catsrc.namespace = ns
subOadp.namespace = ns
subOadp.catalogSourceNamespace = catsrc.namespace
exutil.By("create catalog source")
defer catsrc.delete(itName, dr)
catsrc.createWithCheck(oc.AsGuestKubeconf(), itName, dr)
exutil.By("Create og")
defer og.delete(itName, dr)
og.create(oc.AsGuestKubeconf(), itName, dr)
exutil.By("install OADP")
defer subOadp.delete(itName, dr)
subOadp.create(oc.AsGuestKubeconf(), itName, dr)
defer subOadp.deleteCSV(itName, dr)
exutil.By("Check the oadp-operator.v0.5.3 is installed successfully")
newCheck("expect", asAdmin, withoutNamespace, compare, "Succeeded", ok, []string{"csv", subOadp.installedCSV, "-n", subOadp.namespace, "-o=jsonpath={.status.phase}"}).check(oc.AsGuestKubeconf())
})
| |||||
test
|
openshift/openshift-tests-private
|
b55c061e-5c4b-4a41-9376-37c6d56f118f
|
olm_utils
|
import (
"context"
"crypto/x509"
"encoding/base64"
"encoding/json"
"encoding/pem"
"fmt"
"net/http"
"os"
g "github.com/onsi/ginkgo/v2"
o "github.com/onsi/gomega"
"golang.org/x/oauth2"
"io/ioutil"
"math/rand"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
exutil "github.com/openshift/openshift-tests-private/test/extended/util"
"github.com/tidwall/gjson"
"k8s.io/apimachinery/pkg/util/wait"
e2e "k8s.io/kubernetes/test/e2e/framework"
)
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
package operators
import (
"context"
"crypto/x509"
"encoding/base64"
"encoding/json"
"encoding/pem"
"fmt"
"net/http"
"os"
g "github.com/onsi/ginkgo/v2"
o "github.com/onsi/gomega"
"golang.org/x/oauth2"
"io/ioutil"
"math/rand"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
exutil "github.com/openshift/openshift-tests-private/test/extended/util"
"github.com/tidwall/gjson"
"k8s.io/apimachinery/pkg/util/wait"
e2e "k8s.io/kubernetes/test/e2e/framework"
)
const (
asAdmin = true
asUser = false
withoutNamespace = true
withNamespace = false
compare = true
contain = false
requireNS = true
notRequireNS = false
present = true
notPresent = false
ok = true
nok = false
)
type csvDescription struct {
name string
namespace string
}
// the method is to delete csv.
func (csv csvDescription) delete(itName string, dr describerResrouce) {
e2e.Logf("remove %s, ns %s", csv.name, csv.namespace)
dr.getIr(itName).remove(csv.name, "csv", csv.namespace)
}
type subscriptionDescription struct {
subName string `json:"name"`
namespace string `json:"namespace"`
channel string `json:"channel"`
ipApproval string `json:"installPlanApproval"`
operatorPackage string `json:"spec.name"`
catalogSourceName string `json:"source"`
catalogSourceNamespace string `json:"sourceNamespace"`
startingCSV string `json:"startingCSV,omitempty"`
configMapRef string `json:"configMapRef,omitempty"`
secretRef string `json:"secretRef,omitempty"`
currentCSV string
installedCSV string
template string
singleNamespace bool
ipCsv string
clusterType string
}
// PrometheusQueryResult the prometheus query result
type PrometheusQueryResult struct {
Data struct {
Result []struct {
Metric struct {
Name string `json:"__name__"`
Approval string `json:"approval"`
Channel string `json:"channel"`
Container string `json:"container"`
Endpoint string `json:"endpoint"`
Installed string `json:"installed"`
Instance string `json:"instance"`
Job string `json:"job"`
SrcName string `json:"name"`
Namespace string `json:"namespace"`
Package string `json:"package"`
Pod string `json:"pod"`
Service string `json:"service"`
} `json:"metric"`
Value []interface{} `json:"value"`
} `json:"result"`
ResultType string `json:"resultType"`
} `json:"data"`
Status string `json:"status"`
}
// the method is to create sub, and save the sub resrouce into dr. and more create csv possible depending on sub.ipApproval
// if sub.ipApproval is Automatic, it will wait the sub's state become AtLatestKnown and get installed csv as sub.installedCSV, and save csv into dr
// if sub.ipApproval is not Automatic, it will just wait sub's state become UpgradePending
func (sub *subscriptionDescription) create(oc *exutil.CLI, itName string, dr describerResrouce) {
// for most operator subscription failure, the reason is that there is a left cluster-scoped CSV.
// I'd like to print all CSV before create it.
// allCSVs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "--all-namespaces").Output()
// if err != nil {
// e2e.Failf("!!! Couldn't get all CSVs:%v\n", err)
// }
// e2e.Logf("!!! Get all CSVs in this cluster:\n%s\n", allCSVs)
sub.createWithoutCheck(oc, itName, dr)
if strings.Compare(sub.ipApproval, "Automatic") == 0 {
sub.findInstalledCSVWithSkip(oc, itName, dr, true)
} else {
newCheck("expect", asAdmin, withoutNamespace, compare, "UpgradePending", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.state}"}).check(oc)
}
}
// It's for the manual subscription to get its latest status, such as, the installedCSV.
func (sub *subscriptionDescription) update(oc *exutil.CLI, itName string, dr describerResrouce) {
installedCSV := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installedCSV}")
o.Expect(installedCSV).NotTo(o.BeEmpty())
if strings.Compare(sub.installedCSV, installedCSV) != 0 {
sub.installedCSV = installedCSV
dr.getIr(itName).add(newResource(oc, "csv", sub.installedCSV, requireNS, sub.namespace))
}
e2e.Logf("updating the subscription to get the latest installedCSV: %s", sub.installedCSV)
}
// the method is to just create sub, and save it to dr, do not check its state.
// Note that, this func doesn't get the installedCSV, this may lead to your operator CSV won't be deleted when calling sub.deleteCSV()
func (sub *subscriptionDescription) createWithoutCheck(oc *exutil.CLI, itName string, dr describerResrouce) {
//isAutomatic := strings.Compare(sub.ipApproval, "Automatic") == 0
//startingCSV is not necessary. And, if there are multi same package from different CatalogSource, it will lead to error.
//if strings.Compare(sub.currentCSV, "") == 0 {
// sub.currentCSV = getResource(oc, asAdmin, withoutNamespace, "packagemanifest", sub.operatorPackage, fmt.Sprintf("-o=jsonpath={.status.channels[?(@.name==\"%s\")].currentCSV}", sub.channel))
// o.Expect(sub.currentCSV).NotTo(o.BeEmpty())
//}
//if isAutomatic {
// sub.startingCSV = sub.currentCSV
//} else {
// o.Expect(sub.startingCSV).NotTo(o.BeEmpty())
//}
// for most operator subscription failure, the reason is that there is a left cluster-scoped CSV.
// I'd like to print all CSV before create it.
// It prints many lines which descrease the exact match for RP, and increase log size.
// So, change it to one line with necessary information csv name and namespace.
allCSVs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "--all-namespaces", "-o=jsonpath={range .items[*]}{@.metadata.name}{\",\"}{@.metadata.namespace}{\":\"}{end}").Output()
if err != nil {
if strings.Contains(allCSVs, "unexpected EOF") || strings.Contains(err.Error(), "status 1") {
g.Skip(fmt.Sprintf("skip case with %v", allCSVs+err.Error()))
}
e2e.Failf("!!! Couldn't get all CSVs:%v\n", err)
}
csvMap := make(map[string][]string)
csvList := strings.Split(allCSVs, ":")
for _, csv := range csvList {
if strings.Compare(csv, "") == 0 {
continue
}
name := strings.Split(csv, ",")[0]
ns := strings.Split(csv, ",")[1]
val, ok := csvMap[name]
if ok {
if strings.HasPrefix(ns, "openshift-") {
alreadyOpenshiftDefaultNS := false
for _, v := range val {
if strings.Contains(v, "openshift-") {
alreadyOpenshiftDefaultNS = true // normally one default operator exists in all openshift- ns, like elasticsearch-operator
// only add one openshift- ns to indicate. to save log size and line size. Or else one line
// will be greater than 3k
break
}
}
if !alreadyOpenshiftDefaultNS {
val = append(val, ns)
csvMap[name] = val
}
} else {
val = append(val, ns)
csvMap[name] = val
}
} else {
nsSlice := make([]string, 20)
nsSlice[1] = ns
csvMap[name] = nsSlice
}
}
for name, ns := range csvMap {
e2e.Logf("getting csv is %v, the related NS is %v", name, ns)
}
e2e.Logf("create sub %s", sub.subName)
applyFn := applyResourceFromTemplate
if strings.Compare(sub.clusterType, "microshift") == 0 {
applyFn = applyResourceFromTemplateOnMicroshift
}
err = applyFn(oc, "--ignore-unknown-parameters=true", "-f", sub.template, "-p", "SUBNAME="+sub.subName, "SUBNAMESPACE="+sub.namespace, "CHANNEL="+sub.channel,
"APPROVAL="+sub.ipApproval, "OPERATORNAME="+sub.operatorPackage, "SOURCENAME="+sub.catalogSourceName, "SOURCENAMESPACE="+sub.catalogSourceNamespace,
"STARTINGCSV="+sub.startingCSV, "CONFIGMAPREF="+sub.configMapRef, "SECRETREF="+sub.secretRef)
o.Expect(err).NotTo(o.HaveOccurred())
dr.getIr(itName).add(newResource(oc, "sub", sub.subName, requireNS, sub.namespace))
}
// the method is to check if the sub's state is AtLatestKnown.
// if it is AtLatestKnown, get installed csv from sub and save it to dr.
// if it is not AtLatestKnown, raise error.
func (sub *subscriptionDescription) findInstalledCSV(oc *exutil.CLI, itName string, dr describerResrouce) {
sub.findInstalledCSVWithSkip(oc, itName, dr, false)
}
func (sub *subscriptionDescription) findInstalledCSVWithSkip(oc *exutil.CLI, itName string, dr describerResrouce, skip bool) {
err := wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) {
state, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.state}").Output()
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 {
message, _ := oc.AsAdmin().WithoutNamespace().Run("describe").Args("sub", sub.subName, "-n", sub.namespace).Output()
e2e.Logf(message)
if sub.assertToSkipSpecificMessage(message) && skip {
g.Skip(fmt.Sprintf("the case skip without issue and impacted by others: %s", message))
}
message, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace,
"-o=jsonpath={.status.conditions[?(@.type==\"ResolutionFailed\")].message}").Output()
if sub.assertToSkipSpecificMessage(message) && skip {
g.Skip(fmt.Sprintf("the case skip without issue and impacted by others: %s", message))
}
message, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("installplan", "-n", sub.namespace, "-o=jsonpath-as-json={..status}").Output()
e2e.Logf(message)
message, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", sub.catalogSourceNamespace).Output()
e2e.Logf(message)
message, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", sub.namespace).Output()
e2e.Logf(message)
message, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("event", "-n", sub.namespace).Output()
e2e.Logf(message)
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("sub %s stat is not AtLatestKnown", sub.subName))
installedCSV := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installedCSV}")
o.Expect(installedCSV).NotTo(o.BeEmpty())
if strings.Compare(sub.installedCSV, installedCSV) != 0 {
sub.installedCSV = installedCSV
dr.getIr(itName).add(newResource(oc, "csv", sub.installedCSV, requireNS, sub.namespace))
}
e2e.Logf("the installed CSV name is %s", sub.installedCSV)
}
func (sub *subscriptionDescription) assertToSkipSpecificMessage(message string) bool {
specificMessages := []string{
"subscription sub-learn-46964 requires @existing/openshift-operators//learn-operator.v0.0.3",
"error using catalogsource openshift-marketplace/qe-app-registry",
"failed to list bundles: rpc error: code = Unavailable desc = connection error",
"Unable to connect to the server",
}
for _, specificMessage := range specificMessages {
if strings.Contains(message, specificMessage) {
return true
}
}
return false
}
// the method is to check if the cv parameter is same to the installed csv.
// if not same, raise error.
// if same, nothong happen.
func (sub *subscriptionDescription) expectCSV(oc *exutil.CLI, itName string, dr describerResrouce, cv string) {
err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 480*time.Second, false, func(ctx context.Context) (bool, error) {
sub.findInstalledCSV(oc, itName, dr)
if strings.Compare(sub.installedCSV, cv) == 0 {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("expected csv %s not found", cv))
}
// the method is to approve the install plan when you create sub with sub.ipApproval != Automatic
// normally firstly call sub.create(), then call this method sub.approve. it is used to operator upgrade case.
func (sub *subscriptionDescription) approve(oc *exutil.CLI, itName string, dr describerResrouce) {
err := wait.PollUntilContextTimeout(context.TODO(), 6*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) {
for strings.Compare(sub.installedCSV, "") == 0 {
state := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.state}")
if strings.Compare(state, "AtLatestKnown") == 0 {
sub.installedCSV = getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installedCSV}")
dr.getIr(itName).add(newResource(oc, "csv", sub.installedCSV, requireNS, sub.namespace))
e2e.Logf("it is already done, and the installed CSV name is %s", sub.installedCSV)
continue
}
ipCsv := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installplan.name}{\" \"}{.status.currentCSV}")
sub.ipCsv = ipCsv + "##" + sub.ipCsv
installPlan := strings.Fields(ipCsv)[0]
o.Expect(installPlan).NotTo(o.BeEmpty())
e2e.Logf("try to approve installPlan %s", installPlan)
patchResource(oc, asAdmin, withoutNamespace, "installplan", installPlan, "-n", sub.namespace, "--type", "merge", "-p", "{\"spec\": {\"approved\": true}}")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 70*time.Second, false, func(ctx context.Context) (bool, error) {
err := newCheck("expect", asAdmin, withoutNamespace, compare, "Complete", ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
if err != nil {
e2e.Logf("the get error is %v, and try next", err)
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("installPlan %s is not Complete", installPlan))
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("not found installed csv for %s", sub.subName))
}
// The user can approve the specific InstallPlan:
// NAME CSV APPROVAL APPROVED
// install-vmwlk etcdoperator.v0.9.4 Manual false
// install-xqgtx etcdoperator.v0.9.2 Manual true
// sub.approveSpecificIP(oc, itName, dr, "etcdoperator.v0.9.2", "Complete") approve this "etcdoperator.v0.9.2" InstallPlan only
func (sub *subscriptionDescription) approveSpecificIP(oc *exutil.CLI, itName string, dr describerResrouce, csvName string, phase string) {
// fix https://github.com/openshift/openshift-tests-private/issues/735
var state string
wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 120*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, "UpgradePending") == 0 {
return true, nil
}
return false, nil
})
if strings.Compare(state, "UpgradePending") == 0 {
e2e.Logf("--> The expected CSV: %s", csvName)
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 90*time.Second, false, func(ctx context.Context) (bool, error) {
ipCsv := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installplan.name}{\" \"}{.status.currentCSV}")
if strings.Contains(ipCsv, csvName) {
installPlan := strings.Fields(ipCsv)[0]
if len(installPlan) == 0 {
return false, fmt.Errorf("installPlan is empty")
}
e2e.Logf("---> Get the pending InstallPlan %s", installPlan)
patchResource(oc, asAdmin, withoutNamespace, "installplan", installPlan, "-n", sub.namespace, "--type", "merge", "-p", "{\"spec\": {\"approved\": true}}")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 70*time.Second, false, func(ctx context.Context) (bool, error) {
err := newCheck("expect", asAdmin, withoutNamespace, compare, phase, ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
if err != nil {
return false, nil
}
return true, nil
})
// break the wait loop and return an error
if err != nil {
return true, fmt.Errorf("installPlan %s is not %s", installPlan, phase)
}
return true, nil
} else {
e2e.Logf("--> Not found the expected CSV(%s), the current IP:%s", csvName, ipCsv)
return false, nil
}
})
if err != nil && strings.Contains(err.Error(), "installPlan") {
e2e.Failf(err.Error())
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("--> Not found the expected CSV: %s", csvName))
} else {
CSVs := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installedCSV}{\" \"}{.status.currentCSV}")
e2e.Logf("---> No need any apporval operation, the InstalledCSV and currentCSV are the same: %s", CSVs)
}
}
// the method is to construct one csv object.
func (sub *subscriptionDescription) getCSV() csvDescription {
e2e.Logf("csv is %s, namespace is %s", sub.installedCSV, sub.namespace)
return csvDescription{sub.installedCSV, sub.namespace}
}
// get the reference InstallPlan
func (sub *subscriptionDescription) getIP(oc *exutil.CLI) string {
var installPlan string
waitErr := wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
var err error
installPlan, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installPlanRef.name}").Output()
if strings.Compare(installPlan, "") == 0 || err != nil {
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(waitErr, fmt.Sprintf("sub %s has no installplan", sub.subName))
o.Expect(installPlan).NotTo(o.BeEmpty())
return installPlan
}
// the method is to get the CR version from alm-examples of csv if it exists
func (sub *subscriptionDescription) getInstanceVersion(oc *exutil.CLI) string {
version := ""
output := strings.Split(getResource(oc, asUser, withoutNamespace, "csv", sub.installedCSV, "-n", sub.namespace, "-o=jsonpath={.metadata.annotations.alm-examples}"), "\n")
for _, line := range output {
if strings.Contains(line, "\"version\"") {
version = strings.Trim(strings.Fields(strings.TrimSpace(line))[1], "\"")
break
}
}
o.Expect(version).NotTo(o.BeEmpty())
e2e.Logf("sub cr version is %s", version)
return version
}
// the method is obsolete
func (sub *subscriptionDescription) createInstance(oc *exutil.CLI, instance string) {
path := filepath.Join(e2e.TestContext.OutputDir, sub.namespace+"-"+"instance.json")
err := ioutil.WriteFile(path, []byte(instance), 0644)
o.Expect(err).NotTo(o.HaveOccurred())
err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-n", sub.namespace, "-f", path).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
// the method is to delete sub which is saved when calling sub.create() or sub.createWithoutCheck()
func (sub *subscriptionDescription) delete(itName string, dr describerResrouce) {
e2e.Logf("remove sub %s, ns is %s", sub.subName, sub.namespace)
dr.getIr(itName).remove(sub.subName, "sub", sub.namespace)
}
func (sub *subscriptionDescription) deleteCSV(itName string, dr describerResrouce) {
e2e.Logf("remove csv %s, ns is %s, the subscription is: %s", sub.installedCSV, sub.namespace, sub)
dr.getIr(itName).remove(sub.installedCSV, "csv", sub.namespace)
}
// the method is to patch sub object
func (sub *subscriptionDescription) patch(oc *exutil.CLI, patch string) {
patchResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "--type", "merge", "-p", patch)
}
type subscriptionDescriptionProxy struct {
subscriptionDescription
httpProxy string
httpsProxy string
noProxy string
}
// the method is to just create sub with proxy, and save it to dr, do not check its state.
func (sub *subscriptionDescriptionProxy) createWithoutCheck(oc *exutil.CLI, itName string, dr describerResrouce) {
e2e.Logf("install subscriptionDescriptionProxy")
err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", sub.template, "-p", "SUBNAME="+sub.subName, "SUBNAMESPACE="+sub.namespace, "CHANNEL="+sub.channel,
"APPROVAL="+sub.ipApproval, "OPERATORNAME="+sub.operatorPackage, "SOURCENAME="+sub.catalogSourceName, "SOURCENAMESPACE="+sub.catalogSourceNamespace, "STARTINGCSV="+sub.startingCSV,
"SUBHTTPPROXY="+sub.httpProxy, "SUBHTTPSPROXY="+sub.httpsProxy, "SUBNOPROXY="+sub.noProxy)
o.Expect(err).NotTo(o.HaveOccurred())
dr.getIr(itName).add(newResource(oc, "sub", sub.subName, requireNS, sub.namespace))
e2e.Logf("install subscriptionDescriptionProxy %s SUCCESS", sub.subName)
}
func (sub *subscriptionDescriptionProxy) create(oc *exutil.CLI, itName string, dr describerResrouce) {
sub.createWithoutCheck(oc, itName, dr)
if strings.Compare(sub.ipApproval, "Automatic") == 0 {
sub.findInstalledCSVWithSkip(oc, itName, dr, true)
} else {
newCheck("expect", asAdmin, withoutNamespace, compare, "UpgradePending", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.state}"}).check(oc)
}
}
type crdDescription struct {
name string
template string
}
// the method is to create CRD with template and save it to dr.
func (crd *crdDescription) create(oc *exutil.CLI, itName string, dr describerResrouce) {
err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", crd.template, "-p", "NAME="+crd.name)
o.Expect(err).NotTo(o.HaveOccurred())
dr.getIr(itName).add(newResource(oc, "crd", crd.name, notRequireNS, ""))
e2e.Logf("create crd %s SUCCESS", crd.name)
}
// the method is to delete CRD.
func (crd *crdDescription) delete(oc *exutil.CLI) {
e2e.Logf("remove crd %s, withoutNamespace is %v", crd.name, withoutNamespace)
removeResource(oc, asAdmin, withoutNamespace, "crd", crd.name)
}
type configMapDescription struct {
name string
namespace string
template string
}
// the method is to create cm with template and save it to dr
func (cm *configMapDescription) create(oc *exutil.CLI, itName string, dr describerResrouce) {
err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", cm.template, "-p", "NAME="+cm.name, "NAMESPACE="+cm.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
dr.getIr(itName).add(newResource(oc, "cm", cm.name, requireNS, cm.namespace))
e2e.Logf("create cm %s SUCCESS", cm.name)
}
// the method is to patch cm.
func (cm *configMapDescription) patch(oc *exutil.CLI, patch string) {
patchResource(oc, asAdmin, withoutNamespace, "cm", cm.name, "-n", cm.namespace, "--type", "merge", "-p", patch)
}
// the method is to delete cm.
func (cm *configMapDescription) delete(itName string, dr describerResrouce) {
e2e.Logf("remove cm %s, ns is %v", cm.name, cm.namespace)
dr.getIr(itName).remove(cm.name, "cm", cm.namespace)
}
type catalogSourceDescription struct {
name string
namespace string
displayName string
publisher string
sourceType string
address string
template string
priority int
secret string
interval string
imageTemplate string
clusterType string
}
// the method is to create catalogsource with template, and save it to dr.
func (catsrc *catalogSourceDescription) create(oc *exutil.CLI, itName string, dr describerResrouce) {
if strings.Compare(catsrc.interval, "") == 0 {
catsrc.interval = "10m0s"
e2e.Logf("set interval to be 10m0s")
}
applyFn := applyResourceFromTemplate
if strings.Compare(catsrc.clusterType, "microshift") == 0 {
applyFn = applyResourceFromTemplateOnMicroshift
}
err := applyFn(oc, "--ignore-unknown-parameters=true", "-f", catsrc.template,
"-p", "NAME="+catsrc.name, "NAMESPACE="+catsrc.namespace, "ADDRESS="+catsrc.address, "SECRET="+catsrc.secret,
"DISPLAYNAME="+"\""+catsrc.displayName+"\"", "PUBLISHER="+"\""+catsrc.publisher+"\"", "SOURCETYPE="+catsrc.sourceType,
"INTERVAL="+catsrc.interval, "IMAGETEMPLATE="+catsrc.imageTemplate)
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Compare(catsrc.clusterType, "microshift") != 0 {
catsrc.setSCCRestricted(oc)
}
dr.getIr(itName).add(newResource(oc, "catsrc", catsrc.name, requireNS, catsrc.namespace))
e2e.Logf("create catsrc %s SUCCESS", catsrc.name)
}
func (catsrc *catalogSourceDescription) setSCCRestricted(oc *exutil.CLI) {
if strings.Compare(catsrc.namespace, "openshift-marketplace") == 0 {
e2e.Logf("the namespace is openshift-marketplace, skip setting SCC")
return
}
psa := "restricted"
if exutil.IsHypershiftHostedCluster(oc) {
e2e.Logf("cluster is Hypershift Hosted Cluster, cannot get default PSA setting, use default value restricted")
} else {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("configmaps", "-n", "openshift-kube-apiserver", "config", `-o=jsonpath={.data.config\.yaml}`).Output()
o.Expect(err).NotTo(o.HaveOccurred())
psa = gjson.Get(output, "admission.pluginConfig.PodSecurity.configuration.defaults.enforce").String()
e2e.Logf("pod-security.kubernetes.io/enforce is %s", string(psa))
}
if strings.Contains(string(psa), "restricted") {
originSCC := catsrc.getSCC(oc)
e2e.Logf("spec.grpcPodConfig.securityContextConfig is %s", originSCC)
if strings.Compare(originSCC, "") == 0 {
e2e.Logf("set spec.grpcPodConfig.securityContextConfig to be restricted")
err := oc.AsAdmin().WithoutNamespace().Run("patch").Args("catsrc", catsrc.name, "-n", catsrc.namespace, "--type=merge", "-p", `{"spec":{"grpcPodConfig":{"securityContextConfig":"restricted"}}}`).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
} else {
e2e.Logf("spec.grpcPodConfig.securityContextConfig is %s, skip setting", originSCC)
}
}
}
func (catsrc *catalogSourceDescription) getSCC(oc *exutil.CLI) string {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catsrc", catsrc.name, "-n", catsrc.namespace, "-o=jsonpath={.spec.grpcPodConfig.securityContextConfig}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
return output
}
func (catsrc *catalogSourceDescription) createWithCheck(oc *exutil.CLI, itName string, dr describerResrouce) {
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")
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("catsrc %s lastObservedState is not READY", catsrc.name))
e2e.Logf("catsrc %s lastObservedState is READY", catsrc.name)
}
// the method is to delete catalogsource.
func (catsrc *catalogSourceDescription) delete(itName string, dr describerResrouce) {
e2e.Logf("delete carsrc %s, ns is %s", catsrc.name, catsrc.namespace)
dr.getIr(itName).remove(catsrc.name, "catsrc", catsrc.namespace)
}
type customResourceDescription struct {
name string
namespace string
typename string
template string
}
// the method is to create CR with template, and save it to dr.
func (crinstance *customResourceDescription) create(oc *exutil.CLI, itName string, dr describerResrouce) {
errCR := wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) {
err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", crinstance.template,
"-p", "NAME="+crinstance.name, "NAMESPACE="+crinstance.namespace)
if err != nil {
e2e.Logf("met error: %v, try next round ...", err.Error())
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(errCR, "cr etcdcluster is not created")
dr.getIr(itName).add(newResource(oc, crinstance.typename, crinstance.name, requireNS, crinstance.namespace))
e2e.Logf("create CR %s SUCCESS", crinstance.name)
}
// the method is to delete CR
func (crinstance *customResourceDescription) delete(itName string, dr describerResrouce) {
e2e.Logf("delete crinstance %s, type is %s, ns is %s", crinstance.name, crinstance.typename, crinstance.namespace)
dr.getIr(itName).remove(crinstance.name, crinstance.typename, crinstance.namespace)
}
type operatorGroupDescription struct {
name string
namespace string
multinslabel string
template string
serviceAccountName string
upgradeStrategy string
clusterType string
}
// the method is to check if og exist. if not existing, create it with template and save it to dr.
// if existing, nothing happen.
func (og *operatorGroupDescription) createwithCheck(oc *exutil.CLI, itName string, dr describerResrouce) {
output, err := doAction(oc, "get", asAdmin, false, "operatorgroup")
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(output, "No resources found") {
e2e.Logf(fmt.Sprintf("No operatorgroup in project: %s, create one: %s", og.namespace, og.name))
og.create(oc, itName, dr)
} else {
e2e.Logf(fmt.Sprintf("Already exist operatorgroup in project: %s", og.namespace))
}
}
// the method is to create og and save it to dr
// if og.multinslabel is not set, it will create og with ownnamespace or allnamespace depending on template
// if og.multinslabel is set, it will create og with multinamespace.
func (og *operatorGroupDescription) create(oc *exutil.CLI, itName string, dr describerResrouce) {
var err error
applyFn := applyResourceFromTemplate
if strings.Compare(og.clusterType, "microshift") == 0 {
applyFn = applyResourceFromTemplateOnMicroshift
}
if strings.Compare(og.multinslabel, "") != 0 && strings.Compare(og.serviceAccountName, "") != 0 {
err = applyFn(oc, "--ignore-unknown-parameters=true", "-f", og.template, "-p", "NAME="+og.name, "NAMESPACE="+og.namespace, "MULTINSLABEL="+og.multinslabel, "SERVICE_ACCOUNT_NAME="+og.serviceAccountName)
} else if strings.Compare(og.multinslabel, "") == 0 && strings.Compare(og.serviceAccountName, "") == 0 && strings.Compare(og.upgradeStrategy, "") == 0 {
err = applyFn(oc, "--ignore-unknown-parameters=true", "-f", og.template, "-p", "NAME="+og.name, "NAMESPACE="+og.namespace)
} else if strings.Compare(og.multinslabel, "") != 0 {
err = applyFn(oc, "--ignore-unknown-parameters=true", "-f", og.template, "-p", "NAME="+og.name, "NAMESPACE="+og.namespace, "MULTINSLABEL="+og.multinslabel)
} else if strings.Compare(og.upgradeStrategy, "") != 0 {
err = applyFn(oc, "--ignore-unknown-parameters=true", "-f", og.template, "-p", "NAME="+og.name, "NAMESPACE="+og.namespace, "UPGRADESTRATEGY="+og.upgradeStrategy)
} else {
err = applyFn(oc, "--ignore-unknown-parameters=true", "-f", og.template, "-p", "NAME="+og.name, "NAMESPACE="+og.namespace, "SERVICE_ACCOUNT_NAME="+og.serviceAccountName)
}
o.Expect(err).NotTo(o.HaveOccurred())
dr.getIr(itName).add(newResource(oc, "og", og.name, requireNS, og.namespace))
e2e.Logf("create og %s success", og.name)
}
// the method is to delete og
func (og *operatorGroupDescription) delete(itName string, dr describerResrouce) {
e2e.Logf("delete og %s, ns is %s", og.name, og.namespace)
dr.getIr(itName).remove(og.name, "og", og.namespace)
}
// the struct and its method are obsolete because no operatorSource anymore.
type operatorSourceDescription struct {
name string
namespace string
namelabel string
registrynamespace string
displayname string
publisher string
template string
deploymentName string
}
func (osrc *operatorSourceDescription) create(oc *exutil.CLI, itName string, dr describerResrouce) {
err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", osrc.template, "-p", "NAME="+osrc.name, "NAMESPACE="+osrc.namespace,
"NAMELABEL="+osrc.namelabel, "REGISTRYNAMESPACE="+osrc.registrynamespace, "DISPLAYNAME="+osrc.displayname, "PUBLISHER="+osrc.publisher)
o.Expect(err).NotTo(o.HaveOccurred())
dr.getIr(itName).add(newResource(oc, "opsrc", osrc.name, requireNS, osrc.namespace))
e2e.Logf("create operatorSource %s success", osrc.name)
}
func (osrc *operatorSourceDescription) delete(itName string, dr describerResrouce) {
e2e.Logf("delete operatorSource %s, ns is %s", osrc.name, osrc.namespace)
dr.getIr(itName).remove(osrc.name, "opsrc", osrc.namespace)
}
func (osrc *operatorSourceDescription) getRunningNodes(oc *exutil.CLI) string {
nodesNames := getResource(oc, asAdmin, withoutNamespace, "pod", fmt.Sprintf("--selector=marketplace.operatorSource=%s", osrc.name), "-n", osrc.namespace, "-o=jsonpath={.items[*]..nodeName}")
o.Expect(nodesNames).NotTo(o.BeEmpty())
e2e.Logf("getRunningNodes: nodesNames %s", nodesNames)
return nodesNames
}
func (osrc *operatorSourceDescription) getDeployment(oc *exutil.CLI) {
output := getResource(oc, asAdmin, withoutNamespace, "deployment", fmt.Sprintf("--selector=opsrc-owner-name=%s", osrc.name), "-n", osrc.namespace, "-o=jsonpath={.items[0].metadata.name}")
o.Expect(output).NotTo(o.BeEmpty())
e2e.Logf("getDeployment: deploymentName %s", output)
osrc.deploymentName = output
}
func (osrc *operatorSourceDescription) patchDeployment(oc *exutil.CLI, content string) {
if strings.Compare(osrc.deploymentName, "") == 0 {
osrc.deploymentName = osrc.name
}
patchResource(oc, asAdmin, withoutNamespace, "deployment", osrc.deploymentName, "-n", osrc.namespace, "--type", "merge", "-p", content)
}
func (osrc *operatorSourceDescription) getTolerations(oc *exutil.CLI) string {
if strings.Compare(osrc.deploymentName, "") == 0 {
osrc.deploymentName = osrc.name
}
output := getResource(oc, asAdmin, withoutNamespace, "deployment", osrc.deploymentName, "-n", osrc.namespace, "-o=jsonpath={.spec.template.spec.tolerations}")
if strings.Compare(output, "") == 0 {
e2e.Logf("no tolerations %v", output)
return "\"tolerations\": null"
}
tolerations := "\"tolerations\": " + convertLMtoJSON(output)
e2e.Logf("the tolerations:===%v===", tolerations)
return tolerations
}
// //the struct and its method are obsolete because no csc anymore.
type catalogSourceConfigDescription struct {
name string
namespace string
packages string
targetnamespace string
source string
template string
}
func (csc *catalogSourceConfigDescription) create(oc *exutil.CLI, itName string, dr describerResrouce) {
err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", csc.template, "-p", "NAME="+csc.name, "NAMESPACE="+csc.namespace,
"PACKAGES="+csc.packages, "TARGETNAMESPACE="+csc.targetnamespace, "SOURCE="+csc.source)
o.Expect(err).NotTo(o.HaveOccurred())
dr.getIr(itName).add(newResource(oc, "csc", csc.name, requireNS, csc.namespace))
e2e.Logf("create catalogSourceConfig %s success", csc.name)
}
func (csc *catalogSourceConfigDescription) delete(itName string, dr describerResrouce) {
e2e.Logf("delete catalogSourceConfig %s, ns is %s", csc.name, csc.namespace)
dr.getIr(itName).remove(csc.name, "csc", csc.namespace)
}
type projectDescription struct {
name string
targetNamespace string
}
// the method is to check if the project exists. if not, create it with name, and go to it.
// if existing, nothing happen.
func (p *projectDescription) createwithCheck(oc *exutil.CLI, itName string, dr describerResrouce) {
output, err := doAction(oc, "get", asAdmin, withoutNamespace, "project", p.name)
if err != nil {
e2e.Logf(fmt.Sprintf("Output: %s, cannot find the %s project, create one", output, p.name))
_, err := doAction(oc, "adm", asAdmin, withoutNamespace, "new-project", p.name)
o.Expect(err).NotTo(o.HaveOccurred())
dr.getIr(itName).add(newResource(oc, "project", p.name, notRequireNS, ""))
_, err = doAction(oc, "project", asAdmin, withoutNamespace, p.name)
o.Expect(err).NotTo(o.HaveOccurred())
} else {
e2e.Logf(fmt.Sprintf("project: %s already exist!", p.name))
}
}
// the method is to delete project with name if exist. and then create it with name, and back to project with targetNamespace
func (p *projectDescription) create(oc *exutil.CLI, itName string, dr describerResrouce) {
removeResource(oc, asAdmin, withoutNamespace, "project", p.name)
_, err := doAction(oc, "new-project", asAdmin, withoutNamespace, p.name, "--skip-config-write")
o.Expect(err).NotTo(o.HaveOccurred())
dr.getIr(itName).add(newResource(oc, "project", p.name, notRequireNS, ""))
_, err = doAction(oc, "project", asAdmin, withoutNamespace, p.targetNamespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
// the method is to label project
func (p *projectDescription) label(oc *exutil.CLI, label string) {
_, err := doAction(oc, "label", asAdmin, withoutNamespace, "ns", p.name, "env="+label)
o.Expect(err).NotTo(o.HaveOccurred())
}
// the method is to delete project
func (p *projectDescription) delete(oc *exutil.CLI) {
_, err := doAction(oc, "delete", asAdmin, withoutNamespace, "project", p.name)
o.Expect(err).NotTo(o.HaveOccurred())
}
func (p *projectDescription) deleteWithForce(oc *exutil.CLI) {
// remove Finalizer
_, err := doAction(oc, "delete", asAdmin, withoutNamespace, "all", "--all", "-n", p.name, "--force", "--grace-period=0", "--wait=false")
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "delete", asAdmin, withoutNamespace, "csv", "--all", "-n", p.name, "--force", "--grace-period=0", "--wait=false")
o.Expect(err).NotTo(o.HaveOccurred())
_, err = doAction(oc, "delete", asAdmin, withoutNamespace, "project", p.name, "--force", "--grace-period=0", "--wait=false")
o.Expect(err).NotTo(o.HaveOccurred())
}
type serviceAccountDescription struct {
name string
namespace string
definitionfile string
}
// the method is to construct one sa.
func newSa(name, namespace string) *serviceAccountDescription {
return &serviceAccountDescription{
name: name,
namespace: namespace,
definitionfile: "",
}
}
// the method is to get sa definition.
func (sa *serviceAccountDescription) getDefinition(oc *exutil.CLI) {
parameters := []string{"sa", sa.name, "-n", sa.namespace, "-o=json"}
definitionfile, err := oc.AsAdmin().WithoutNamespace().Run("get").Args(parameters...).OutputToFile("sa-config.json")
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("getDefinition: definitionfile is %s", definitionfile)
sa.definitionfile = definitionfile
}
// the method is to delete sa
func (sa *serviceAccountDescription) delete(oc *exutil.CLI) {
e2e.Logf("delete sa %s, ns is %s", sa.name, sa.namespace)
_, err := doAction(oc, "delete", asAdmin, withoutNamespace, "sa", sa.name, "-n", sa.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
// the method is to apply sa with its member definitionfile
func (sa *serviceAccountDescription) reapply(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", sa.definitionfile).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
// the method is to check if what sa can do is expected with expected parameter.
func (sa *serviceAccountDescription) checkAuth(oc *exutil.CLI, expected string, cr string) {
err := wait.PollUntilContextTimeout(context.TODO(), 20*time.Second, 420*time.Second, false, func(ctx context.Context) (bool, error) {
output, _ := doAction(oc, "auth", asAdmin, withNamespace, "--as", fmt.Sprintf("system:serviceaccount:%s:%s", sa.namespace, sa.name), "can-i", "create", cr)
e2e.Logf("the result of checkAuth:%v", output)
if strings.Contains(output, expected) {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("sa %s expects %s permssion to create %s, but no", sa.name, expected, cr))
}
type roleDescription struct {
name string
namespace string
template string
}
// the method is to create role with template
func (role *roleDescription) create(oc *exutil.CLI) {
err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", role.template,
"-p", "NAME="+role.name, "NAMESPACE="+role.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
// the method is to construct one Role object.
func newRole(name string, namespace string) *roleDescription {
return &roleDescription{
name: name,
namespace: namespace,
}
}
// the method is to patch Role object.
func (role *roleDescription) patch(oc *exutil.CLI, patch string) {
patchResource(oc, asAdmin, withoutNamespace, "role", role.name, "-n", role.namespace, "--type", "merge", "-p", patch)
}
// the method is to get rules from Role object.
func (role *roleDescription) getRules(oc *exutil.CLI) string {
return role.getRulesWithDelete(oc, "nodelete")
}
// the method is to get new rule without delete parameter based on current role.
func (role *roleDescription) getRulesWithDelete(oc *exutil.CLI, delete string) string {
var roleboday map[string]interface{}
output := getResource(oc, asAdmin, withoutNamespace, "role", role.name, "-n", role.namespace, "-o=json")
err := json.Unmarshal([]byte(output), &roleboday)
o.Expect(err).NotTo(o.HaveOccurred())
rules := roleboday["rules"].([]interface{})
handleRuleAttribute := func(rc *strings.Builder, rt string, r map[string]interface{}) {
rc.WriteString("\"" + rt + "\":[")
items := r[rt].([]interface{})
e2e.Logf("%s:%v, and the len:%v", rt, items, len(items))
for i, v := range items {
vc := v.(string)
rc.WriteString("\"" + vc + "\"")
if i != len(items)-1 {
rc.WriteString(",")
}
}
rc.WriteString("]")
if strings.Compare(rt, "verbs") != 0 {
rc.WriteString(",")
}
}
var rc strings.Builder
rc.WriteString("[")
for _, rv := range rules {
rule := rv.(map[string]interface{})
if strings.Compare(delete, "nodelete") != 0 && strings.Compare(rule["apiGroups"].([]interface{})[0].(string), delete) == 0 {
continue
}
rc.WriteString("{")
handleRuleAttribute(&rc, "apiGroups", rule)
handleRuleAttribute(&rc, "resources", rule)
handleRuleAttribute(&rc, "verbs", rule)
rc.WriteString("},")
}
result := strings.TrimSuffix(rc.String(), ",") + "]"
e2e.Logf("rc:%v", result)
return result
}
type rolebindingDescription struct {
name string
namespace string
rolename string
saname string
template string
}
// the method is to create role with template
func (rolebinding *rolebindingDescription) create(oc *exutil.CLI) {
err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", rolebinding.template,
"-p", "NAME="+rolebinding.name, "NAMESPACE="+rolebinding.namespace, "SA_NAME="+rolebinding.saname, "ROLE_NAME="+rolebinding.rolename)
o.Expect(err).NotTo(o.HaveOccurred())
}
type secretDescription struct {
name string
namespace string
saname string
sectype string
template string
}
// the method is to create secret with template
func (secret *secretDescription) create(oc *exutil.CLI) {
err := applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", secret.template,
"-p", "NAME="+secret.name, "NAMESPACE="+secret.namespace, "SANAME="+secret.saname, "TYPE="+secret.sectype)
o.Expect(err).NotTo(o.HaveOccurred())
}
type checkDescription struct {
method string
executor bool
inlineNamespace bool
expectAction bool
expectContent string
expect bool
resource []string
}
// the method is to make newCheck object.
// the method parameter is expect, it will check something is expceted or not
// the method parameter is present, it will check something exists or not
// the executor is asAdmin, it will exectue oc with Admin
// the executor is asUser, it will exectue oc with User
// the inlineNamespace is withoutNamespace, it will execute oc with WithoutNamespace()
// the inlineNamespace is withNamespace, it will execute oc with WithNamespace()
// the expectAction take effective when method is expect, if it is contain, it will check if the strings contain substring with expectContent parameter
//
// if it is compare, it will check the strings is samme with expectContent parameter
//
// the expectContent is the content we expected
// the expect is ok, contain or compare result is OK for method == expect, no error raise. if not OK, error raise
// the expect is nok, contain or compare result is NOK for method == expect, no error raise. if OK, error raise
// the expect is ok, resource existing is OK for method == present, no error raise. if resource not existing, error raise
// the expect is nok, resource not existing is OK for method == present, no error raise. if resource existing, error raise
func newCheck(method string, executor bool, inlineNamespace bool, expectAction bool,
expectContent string, expect bool, resource []string) checkDescription {
return checkDescription{
method: method,
executor: executor,
inlineNamespace: inlineNamespace,
expectAction: expectAction,
expectContent: expectContent,
expect: expect,
resource: resource,
}
}
// the method is to check the resource per definition of the above described newCheck.
func (ck checkDescription) check(oc *exutil.CLI) {
switch ck.method {
case "present":
ok := isPresentResource(oc, ck.executor, ck.inlineNamespace, ck.expectAction, ck.resource...)
o.Expect(ok).To(o.BeTrue())
case "expect":
err := expectedResource(oc, ck.executor, ck.inlineNamespace, ck.expectAction, ck.expectContent, ck.expect, ck.resource...)
if err != nil {
getResource(oc, asAdmin, withoutNamespace, "pod", "-n", "openshift-marketplace")
getResource(oc, asAdmin, withoutNamespace, "og", "-n", oc.Namespace(), "-o", "yaml")
getResource(oc, asAdmin, withoutNamespace, "catalogsource", "-n", oc.Namespace(), "-o", "yaml")
getResource(oc, asAdmin, withoutNamespace, "subscription", "-n", oc.Namespace(), "-o", "yaml")
getResource(oc, asAdmin, withoutNamespace, "ip", "-n", oc.Namespace())
getResource(oc, asAdmin, withoutNamespace, "csv", "-n", oc.Namespace())
getResource(oc, asAdmin, withoutNamespace, "pods", "-n", oc.Namespace())
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("expected content %s not found by %v", ck.expectContent, ck.resource))
default:
err := fmt.Errorf("unknown method")
o.Expect(err).NotTo(o.HaveOccurred())
}
}
// the method is to check the resource, but not assert it which is diffrence with the method check().
func (ck checkDescription) checkWithoutAssert(oc *exutil.CLI) error {
switch ck.method {
case "present":
ok := isPresentResource(oc, ck.executor, ck.inlineNamespace, ck.expectAction, ck.resource...)
if ok {
return nil
}
return fmt.Errorf("it is not epxected")
case "expect":
return expectedResource(oc, ck.executor, ck.inlineNamespace, ck.expectAction, ck.expectContent, ck.expect, ck.resource...)
default:
return fmt.Errorf("unknown method")
}
}
// it is the check list so that all the check are done in parallel.
type checkList []checkDescription
// the method is to add one check
func (cl checkList) add(ck checkDescription) checkList {
cl = append(cl, ck)
return cl
}
// the method is to make check list empty.
func (cl checkList) empty() checkList {
cl = cl[0:0]
return cl
}
// the method is to execute all the check in parallel.
func (cl checkList) check(oc *exutil.CLI) {
var wg sync.WaitGroup
for _, ck := range cl {
wg.Add(1)
go func(ck checkDescription) {
defer g.GinkgoRecover()
defer wg.Done()
ck.check(oc)
}(ck)
}
wg.Wait()
}
type resourceDescription struct {
oc *exutil.CLI
asAdmin bool
withoutNamespace bool
kind string
name string
requireNS bool
namespace string
}
// the method is to construc one resource so that it can be deleted with itResource and describerResrouce
// oc is the oc client
// asAdmin means when deleting resource, we take admin role
// withoutNamespace means when deleting resource, we take WithoutNamespace
// kind is the kind of resource
// name is the name of resource
// namespace is the namesapce of resoruce. it is "" for cluster level resource
// if requireNS is requireNS, need to add "-n" parameter. used for project level resource
// if requireNS is notRequireNS, no need to add "-n". used for cluster level resource
func newResource(oc *exutil.CLI, kind string, name string, nsflag bool, namespace string) resourceDescription {
return resourceDescription{
oc: oc,
asAdmin: asAdmin,
withoutNamespace: withoutNamespace,
kind: kind,
name: name,
requireNS: nsflag,
namespace: namespace,
}
}
// the method is to delete resource.
func (r resourceDescription) delete() {
if r.withoutNamespace && r.requireNS {
removeResource(r.oc, r.asAdmin, r.withoutNamespace, r.kind, r.name, "-n", r.namespace)
} else {
removeResource(r.oc, r.asAdmin, r.withoutNamespace, r.kind, r.name)
}
}
// the struct to save the resource created in g.It, and it take name+kind+namespace as key to save resoruce of g.It.
type itResource map[string]resourceDescription
func (ir itResource) add(r resourceDescription) {
ir[r.name+r.kind+r.namespace] = r
}
func (ir itResource) get(name string, kind string, namespace string) resourceDescription {
r, ok := ir[name+kind+namespace]
o.Expect(ok).To(o.BeTrue())
return r
}
func (ir itResource) remove(name string, kind string, namespace string) {
rKey := name + kind + namespace
if r, ok := ir[rKey]; ok {
r.delete()
delete(ir, rKey)
}
}
func (ir itResource) cleanup() {
for _, r := range ir {
e2e.Logf("cleanup resource %s, %s", r.kind, r.name)
ir.remove(r.name, r.kind, r.namespace)
}
}
// the struct is to save g.It in g.Describe, and map the g.It name to itResource so that it can get all resource of g.Describe per g.It.
type describerResrouce map[string]itResource
func (dr describerResrouce) addIr(itName string) {
dr[itName] = itResource{}
}
func (dr describerResrouce) getIr(itName string) itResource {
ir, ok := dr[itName]
if !ok {
e2e.Logf("!!! couldn't find the itName:%s, print the describerResrouce:%v", itName, dr)
}
o.Expect(ok).To(o.BeTrue())
return ir
}
func (dr describerResrouce) rmIr(itName string) {
delete(dr, itName)
}
// the method is to convert to json format from one map sting got with -jsonpath
func convertLMtoJSON(content string) string {
var jb strings.Builder
jb.WriteString("[")
items := strings.Split(strings.TrimSuffix(strings.TrimPrefix(content, "["), "]"), "map")
for _, item := range items {
if strings.Compare(item, "") == 0 {
continue
}
kvs := strings.Fields(strings.TrimSuffix(strings.TrimPrefix(item, "["), "]"))
jb.WriteString("{")
for ki, kv := range kvs {
p := strings.Split(kv, ":")
jb.WriteString("\"" + p[0] + "\":")
jb.WriteString("\"" + p[1] + "\"")
if ki < len(kvs)-1 {
jb.WriteString(", ")
}
}
jb.WriteString("},")
}
return strings.TrimSuffix(jb.String(), ",") + "]"
}
// the method is to get random string with length 8.
func getRandomString() string {
chars := "abcdefghijklmnopqrstuvwxyz0123456789"
seed := rand.New(rand.NewSource(time.Now().UnixNano()))
buffer := make([]byte, 8)
for index := range buffer {
buffer[index] = chars[seed.Intn(len(chars))]
}
return string(buffer)
}
// the method is to update z version of kube version of platform.
func generateUpdatedKubernatesVersion(oc *exutil.CLI) string {
subKubeVersions := strings.Split(getKubernetesVersion(oc), ".")
zVersion, _ := strconv.Atoi(subKubeVersions[1])
subKubeVersions[1] = strconv.Itoa(zVersion + 1)
return strings.Join(subKubeVersions[0:2], ".") + ".0"
}
// the method is to get kube versoin of the platform.
func getKubernetesVersion(oc *exutil.CLI) string {
output, err := doAction(oc, "version", asAdmin, withoutNamespace, "-o=json")
o.Expect(err).NotTo(o.HaveOccurred())
var result map[string]interface{}
err = json.Unmarshal([]byte(output), &result)
o.Expect(err).NotTo(o.HaveOccurred())
gitVersion := result["serverVersion"].(map[string]interface{})["gitVersion"]
e2e.Logf("gitVersion is %v", gitVersion)
return strings.TrimPrefix(gitVersion.(string), "v")
}
// the method is to create one resource with template
func applyResourceFromTemplate(oc *exutil.CLI, parameters ...string) error {
var configFile string
err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 15*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := oc.AsAdmin().Run("process").Args(parameters...).OutputToFile(getRandomString() + "olm-config.json")
if err != nil {
e2e.Logf("the err:%v, and try next round", err)
return false, nil
}
configFile = output
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("can not process %v", parameters))
e2e.Logf("the file of resource is %s", configFile)
return oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", configFile).Execute()
}
// the method is to check the presence of the resource
// asAdmin means if taking admin to check it
// withoutNamespace means if take WithoutNamespace() to check it.
// present means if you expect the resource presence or not. if it is ok, expect presence. if it is nok, expect not present.
func isPresentResource(oc *exutil.CLI, asAdmin bool, withoutNamespace bool, present bool, parameters ...string) bool {
return checkPresent(oc, 3, 70, asAdmin, withoutNamespace, present, parameters...)
}
// the method is basic method to check the presence of the resource
// asAdmin means if taking admin to check it
// withoutNamespace means if take WithoutNamespace() to check it.
// present means if you expect the resource presence or not. if it is ok, expect presence. if it is nok, expect not present.
func checkPresent(oc *exutil.CLI, intervalSec int, durationSec int, asAdmin bool, withoutNamespace bool, present bool, parameters ...string) bool {
parameters = append(parameters, "--ignore-not-found")
err := wait.PollUntilContextTimeout(context.TODO(), time.Duration(intervalSec)*time.Second, time.Duration(durationSec)*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := doAction(oc, "get", asAdmin, withoutNamespace, parameters...)
if err != nil {
e2e.Logf("the get error is %v, and try next", err)
return false, nil
}
if !present && strings.Compare(output, "") == 0 {
return true, nil
}
if present && strings.Compare(output, "") != 0 {
return true, nil
}
return false, nil
})
return err == nil
}
// the method is to patch one resource
// asAdmin means if taking admin to patch it
// withoutNamespace means if take WithoutNamespace() to patch it.
func patchResource(oc *exutil.CLI, asAdmin bool, withoutNamespace bool, parameters ...string) {
_, err := doAction(oc, "patch", asAdmin, withoutNamespace, parameters...)
o.Expect(err).NotTo(o.HaveOccurred())
}
// the method is to execute something in pod to get output
// asAdmin means if taking admin to execute it
// withoutNamespace means if take WithoutNamespace() to execute it.
func execResource(oc *exutil.CLI, asAdmin bool, withoutNamespace bool, parameters ...string) string {
var result string
err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 6*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := doAction(oc, "exec", asAdmin, withoutNamespace, parameters...)
if err != nil {
e2e.Logf("the exec error is %v, and try next", err)
return false, nil
}
result = output
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("can not exec %v", parameters))
e2e.Logf("the result of exec resource:%v", result)
return result
}
// the method is to get something from resource. it is "oc get xxx" actaully
// asAdmin means if taking admin to get it
// withoutNamespace means if take WithoutNamespace() to get it.
func getResource(oc *exutil.CLI, asAdmin bool, withoutNamespace bool, parameters ...string) string {
var result string
var err error
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) {
result, err = doAction(oc, "get", asAdmin, withoutNamespace, parameters...)
if err != nil {
e2e.Logf("output is %v, error is %v, and try next", result, err)
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("can not get %v", parameters))
e2e.Logf("$oc get %v, the returned resource:%v", parameters, result)
return result
}
func getResourceNoEmpty(oc *exutil.CLI, asAdmin bool, withoutNamespace bool, parameters ...string) string {
var result string
var err error
err = wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 150*time.Second, false, func(ctx context.Context) (bool, error) {
result, err = doAction(oc, "get", asAdmin, withoutNamespace, parameters...)
if err != nil || strings.TrimSpace(result) == "" {
e2e.Logf("output is %v, error is %v, and try next", result, err)
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("can not get %v without empty", parameters))
e2e.Logf("$oc get %v, the returned resource:%v", parameters, result)
return result
}
// the method is to check one resource's attribution is expected or not.
// asAdmin means if taking admin to check it
// withoutNamespace means if take WithoutNamespace() to check it.
// isCompare means if containing or exactly comparing. if it is contain, it check result contain content. if it is compare, it compare the result with content exactly.
// content is the substing to be expected
// the expect is ok, contain or compare result is OK for method == expect, no error raise. if not OK, error raise
// the expect is nok, contain or compare result is NOK for method == expect, no error raise. if OK, error raise
func expectedResource(oc *exutil.CLI, asAdmin bool, withoutNamespace bool, isCompare bool, content string, expect bool, parameters ...string) error {
expectMap := map[bool]string{
true: "do",
false: "do not",
}
cc := func(a, b string, ic bool) bool {
bs := strings.Split(b, "+2+")
ret := false
for _, s := range bs {
if (ic && strings.Compare(a, s) == 0) || (!ic && strings.Contains(a, s)) {
ret = true
}
}
return ret
}
e2e.Logf("Running: oc get asAdmin(%t) withoutNamespace(%t) %s", asAdmin, withoutNamespace, strings.Join(parameters, " "))
// The detault timeout
timeString := "150s"
// extract the custom timeout
if strings.Contains(content, "-TIME-WAIT-") {
timeString = strings.Split(content, "-TIME-WAIT-")[1]
content = strings.Split(content, "-TIME-WAIT-")[0]
e2e.Logf("! reset the timeout to %s", timeString)
}
timeout, err := time.ParseDuration(timeString)
if err != nil {
e2e.Failf("! Fail to parse the timeout value:%s, err:%v", content, err)
}
return wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, timeout, false, func(ctx context.Context) (bool, error) {
output, err := doAction(oc, "get", asAdmin, withoutNamespace, parameters...)
if err != nil {
e2e.Logf("the get error is %v, and try next", err)
return false, nil
}
e2e.Logf("---> we %v expect value: %s, in returned value: %s", expectMap[expect], content, output)
if isCompare && expect && cc(output, content, isCompare) {
e2e.Logf("the output %s matches one of the content %s, expected", output, content)
return true, nil
}
if isCompare && !expect && !cc(output, content, isCompare) {
e2e.Logf("the output %s does not matche the content %s, expected", output, content)
return true, nil
}
if !isCompare && expect && cc(output, content, isCompare) {
e2e.Logf("the output %s contains one of the content %s, expected", output, content)
return true, nil
}
if !isCompare && !expect && !cc(output, content, isCompare) {
e2e.Logf("the output %s does not contain the content %s, expected", output, content)
return true, nil
}
e2e.Logf("---> Not as expected! Return false")
return false, nil
})
}
// the method is to remove resource
// asAdmin means if taking admin to remove it
// withoutNamespace means if take WithoutNamespace() to remove it.
func removeResource(oc *exutil.CLI, asAdmin bool, withoutNamespace bool, parameters ...string) {
output, err := doAction(oc, "delete", asAdmin, withoutNamespace, parameters...)
if err != nil && (strings.Contains(output, "NotFound") || strings.Contains(output, "No resources found")) {
e2e.Logf("the resource is deleted already")
return
}
o.Expect(err).NotTo(o.HaveOccurred())
err = wait.PollUntilContextTimeout(context.TODO(), 4*time.Second, 160*time.Second, false, func(ctx context.Context) (bool, error) {
output, err := doAction(oc, "get", asAdmin, withoutNamespace, parameters...)
if err != nil && (strings.Contains(output, "NotFound") || strings.Contains(output, "No resources found")) {
e2e.Logf("the resource is delete successfully")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("can not remove %v", parameters))
}
// the method is to do something with oc.
// asAdmin means if taking admin to do it
// withoutNamespace means if take WithoutNamespace() to do it.
func doAction(oc *exutil.CLI, action string, asAdmin bool, withoutNamespace bool, parameters ...string) (string, error) {
if asAdmin && withoutNamespace {
return oc.AsAdmin().WithoutNamespace().Run(action).Args(parameters...).Output()
}
if asAdmin && !withoutNamespace {
return oc.AsAdmin().Run(action).Args(parameters...).Output()
}
if !asAdmin && withoutNamespace {
return oc.WithoutNamespace().Run(action).Args(parameters...).Output()
}
if !asAdmin && !withoutNamespace {
return oc.Run(action).Args(parameters...).Output()
}
return "", nil
}
func clusterPackageExists(oc *exutil.CLI, sub subscriptionDescription) (bool, error) {
found := false
var v []string
msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "-o=jsonpath={range .items[*]}{@.metadata.name}{\",\"}{@.metadata.labels.catalog}{\"\\n\"}{end}").Output()
if err == nil {
for _, s := range strings.Fields(msg) {
v = strings.Split(s, ",")
if v[0] == sub.operatorPackage && v[1] == sub.catalogSourceName {
found = true
e2e.Logf("%v matches: %v", s, sub.operatorPackage)
break
}
}
}
// add logging on failures
if !found {
e2e.Logf("%v was not found in \n%v", sub.operatorPackage, msg)
}
return found, err
}
func clusterPackageExistsInNamespace(oc *exutil.CLI, sub subscriptionDescription, namespace string) (bool, error) {
found := false
var v []string
var msg string
var err error
if namespace == "all" {
msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "--all-namespaces", "-o=jsonpath={range .items[*]}{@.metadata.name}{\",\"}{@.metadata.labels.catalog}{\"\\n\"}{end}").Output()
} else {
msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("packagemanifest", "-n", namespace, "-o=jsonpath={range .items[*]}{@.metadata.name}{\",\"}{@.metadata.labels.catalog}{\"\\n\"}{end}").Output()
}
if err == nil {
for _, s := range strings.Fields(msg) {
v = strings.Split(s, ",")
if v[0] == sub.operatorPackage && v[1] == sub.catalogSourceName {
found = true
e2e.Logf("%v matches: %v", s, sub.operatorPackage)
break
}
}
}
if !found {
e2e.Logf("%v was not found in \n%v", sub.operatorPackage, msg)
}
return found, err
}
// Return a github client
func githubClient() (context.Context, *http.Client) {
ctx := context.Background()
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")},
)
tc := oauth2.NewClient(ctx, ts)
return ctx, tc
}
// GetDirPath return a string of dir path
func GetDirPath(filePathStr string, filePre string) string {
if !strings.Contains(filePathStr, "/") || filePathStr == "/" {
return ""
}
dir, file := filepath.Split(filePathStr)
if strings.HasPrefix(file, filePre) {
return filePathStr
}
return GetDirPath(filepath.Dir(dir), filePre)
}
// DeleteDir delete the dir
func DeleteDir(filePathStr string, filePre string) bool {
filePathToDelete := GetDirPath(filePathStr, filePre)
if filePathToDelete == "" || !strings.Contains(filePathToDelete, filePre) {
e2e.Logf("there is no such dir %s", filePre)
return false
}
e2e.Logf("remove dir %s", filePathToDelete)
os.RemoveAll(filePathToDelete)
if _, err := os.Stat(filePathToDelete); err == nil {
e2e.Logf("delele dir %s failed", filePathToDelete)
return false
}
return true
}
// CheckUpgradeStatus check upgrade status
func CheckUpgradeStatus(oc *exutil.CLI, expectedStatus string) {
e2e.Logf("Check the Upgradeable status of the OLM, expected: %s", expectedStatus)
err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 60*time.Second, false, func(ctx context.Context) (bool, error) {
upgradeable, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("co", "operator-lifecycle-manager", "-o=jsonpath={.status.conditions[?(@.type==\"Upgradeable\")].status}").Output()
if err != nil {
e2e.Failf("Fail to get the Upgradeable status of the OLM: %v", err)
}
if upgradeable != expectedStatus {
return false, nil
}
e2e.Logf("The Upgraableable status should be %s, and get %s", expectedStatus, upgradeable)
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("Upgradeable status of the OLM %s is not expected", expectedStatus))
}
func getSAToken(oc *exutil.CLI, sa, ns string) (string, error) {
e2e.Logf("Getting a token assgined to specific serviceaccount from %s namespace...", ns)
token, err := oc.AsAdmin().WithoutNamespace().Run("create").Args("token", sa, "-n", ns).Output()
if err != nil {
if strings.Contains(token, "unknown command") { // oc client is old version, create token is not supported
e2e.Logf("oc create token is not supported by current client, use oc sa get-token instead")
token, err = oc.AsAdmin().WithoutNamespace().Run("sa").Args("get-token", sa, "-n", ns).Output()
} else {
return "", err
}
}
return token, err
}
func notInList(target string, strArray []string) bool {
for _, element := range strArray {
if target == element {
return false
}
}
return true
}
func logDebugInfo(oc *exutil.CLI, ns string, resource ...string) {
for _, resourceIndex := range resource {
e2e.Logf("oc get %s:", resourceIndex)
output, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args(resourceIndex, "-n", ns).Output()
if strings.Contains(resourceIndex, "event") {
var warningEventList []string
lines := strings.Split(output, "\n")
for _, line := range lines {
if strings.Contains(line, "Warning") {
warningStr := strings.Split(line, "Warning")[1]
if notInList(warningStr, warningEventList) {
warningEventList = append(warningEventList, "Warning"+warningStr)
}
}
}
e2e.Logf(strings.Join(warningEventList, "\n"))
} else {
e2e.Logf(output)
}
}
}
func isSNOCluster(oc *exutil.CLI) bool {
//Only 1 master, 1 worker node and with the same hostname.
masterNodes, _ := exutil.GetClusterNodesBy(oc, "master")
workerNodes, _ := exutil.GetClusterNodesBy(oc, "worker")
e2e.Logf("masterNodes:%s, workerNodes:%s", masterNodes, workerNodes)
if len(masterNodes) == 1 && len(workerNodes) == 1 && masterNodes[0] == workerNodes[0] {
e2e.Logf("This is a SNO cluster")
return true
}
return false
}
func assertOrCheckMCP(oc *exutil.CLI, mcp string, is int, dm int, skip bool) {
var machineCount string
err := wait.PollUntilContextTimeout(context.TODO(), time.Duration(is)*time.Second, time.Duration(dm)*time.Minute, false, func(ctx context.Context) (bool, error) {
machineCount, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("mcp", mcp, "-o=jsonpath={.status.machineCount}{\" \"}{.status.readyMachineCount}{\" \"}{.status.unavailableMachineCount}{\" \"}{.status.degradedMachineCount}").Output()
indexCount := strings.Fields(machineCount)
if strings.Compare(indexCount[0], indexCount[1]) == 0 && strings.Compare(indexCount[2], "0") == 0 && strings.Compare(indexCount[3], "0") == 0 {
return true, nil
}
return false, nil
})
e2e.Logf("MachineCount:ReadyMachineCountunavailableMachineCountdegradedMachineCount: %v", machineCount)
if err != nil {
if skip {
g.Skip(fmt.Sprintf("the mcp %v is not correct status, so skip it", machineCount))
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("macineconfigpool %v update failed", mcp))
}
}
func getAllCSV(oc *exutil.CLI) []string {
allCSVs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "--all-namespaces", `-o=jsonpath={range .items[*]}{@.metadata.name}{","}{@.metadata.namespace}{","}{@.status.reason}{":"}{end}`).Output()
if err != nil {
e2e.Failf("!!! Couldn't get all CSVs:%v\n", err)
}
var csvListOutput []string
csvList := strings.Split(allCSVs, ":")
for _, csv := range csvList {
if strings.Compare(csv, "") == 0 {
continue
}
name := strings.Split(csv, ",")[0]
ns := strings.Split(csv, ",")[1]
reason := strings.Split(csv, ",")[2]
if strings.Compare(reason, "Copied") == 0 {
continue
}
csvListOutput = append(csvListOutput, ns+":"+name)
}
return csvListOutput
}
// ToDo:
func CreateCatalog(oc *exutil.CLI, catalogName, indexImage, catalogTemplate string) {
catalog, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalog", catalogName).Output()
if err != nil {
if strings.Contains(catalog, "not found") {
err = applyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", catalogTemplate, "-p", fmt.Sprintf("NAME=%s", catalogName), fmt.Sprintf("IMAGE=%s", indexImage))
if err != nil {
e2e.Logf("Failed to create catalog %s: %s", catalogName, err)
// we do not asser it here because it is possible race condition. it means two cases create it at same
// time, and the second will raise error
}
// here we will assert if the catalog is created successfully with checking unpack status.
// need to check unpack status before continue to use it
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
phase, errPhase := oc.AsAdmin().WithoutNamespace().Run("get").Args("catalog", catalogName, "-o=jsonpath={.status.phase}").Output()
if errPhase != nil {
e2e.Logf("%v, next try", errPhase)
return false, nil
}
if strings.Compare(phase, "Unpacked") == 0 {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, "catalog unpack fails")
} else {
o.Expect(err).NotTo(o.HaveOccurred())
}
}
}
func getCertRotation(oc *exutil.CLI, secretName, namespace string) (certsLastUpdated, certsRotateAt time.Time) {
var certsEncoding string
var err error
err = wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 180*time.Second, false, func(ctx context.Context) (bool, error) {
certsEncoding, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("secret", secretName, "-n", namespace, "-o=jsonpath={.data}").Output()
if err != nil {
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("Fail to get the certsEncoding, certsEncoding:%v, error:%v", certsEncoding, err))
certs, err := base64.StdEncoding.DecodeString(gjson.Get(certsEncoding, `tls\.crt`).String())
if err != nil {
e2e.Failf("Fail to get the certs:%v, error:%v", certs, err)
}
block, _ := pem.Decode(certs)
if block == nil {
e2e.Failf("failed to parse certificate PEM")
}
dates, err := x509.ParseCertificate(block.Bytes)
if err != nil {
e2e.Failf("Fail to parse certificate:\n%v, error:%v", string(certs), err)
}
notBefore := dates.NotBefore
notAfter := dates.NotAfter
// code: https://github.com/jianzhangbjz/operator-framework-olm/commit/7275a55186a59fcb9845cbe3a9a99c56a7afbd1d
duration, _ := time.ParseDuration("5m")
secondsDifference := notBefore.Add(duration).Sub(notAfter).Seconds()
if secondsDifference > 3 || secondsDifference < -3 {
e2e.Failf("the duration is incorrect, notBefore:%v, notAfter:%v, secondsDifference:%v", notBefore, notAfter, secondsDifference)
}
g.By("rotation will be 1 minutes earlier than expiration")
certsLastUpdadString, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.status.certsLastUpdated}").Output()
if err != nil {
e2e.Failf("Fail to get certsLastUpdated, error:%v", err)
}
certsRotateAtString, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "packageserver", "-n", "openshift-operator-lifecycle-manager", "-o=jsonpath={.status.certsRotateAt}").Output()
if err != nil {
e2e.Failf("Fail to get certsRotateAt, error:%v", err)
}
duration2, _ := time.ParseDuration("4m")
certsLastUpdated, _ = time.Parse(time.RFC3339, certsLastUpdadString)
certsRotateAt, _ = time.Parse(time.RFC3339, certsRotateAtString)
// certsLastUpdated:2022-08-23 08:59:45
// certsRotateAt:2022-08-23 09:03:44
// due to https://issues.redhat.com/browse/OCPBUGS-444, there is a 1s difference, so here check if seconds difference in 3s.
secondsDifference = certsLastUpdated.Add(duration2).Sub(certsRotateAt).Seconds()
if secondsDifference > 3 || secondsDifference < -3 {
e2e.Failf("the certsRotateAt beyond 3s than expected, certsLastUpdated:%v, certsRotateAt:%v", certsLastUpdated, certsRotateAt)
}
return certsLastUpdated, certsRotateAt
}
// Common user use oc client apply yaml template
func applyResourceFromTemplateOnMicroshift(oc *exutil.CLI, parameters ...string) error {
configFile := exutil.ParameterizedTemplateByReplaceToFile(oc, parameters...)
e2e.Logf("the file of resource is %s", configFile)
return oc.WithoutNamespace().Run("apply").Args("-f", configFile).Execute()
}
// return a map that pod's image is key and imagePullPolicy is value
func GetPodImageAndPolicy(oc *exutil.CLI, podName, project string) (imageMap map[string]string) {
imageMap = make(map[string]string)
if podName == "" || project == "" {
return imageMap
}
containers := []string{"initContainers", "containers"}
for _, v := range containers {
imageNameSlice := []string{}
imagePullPolicySlice := []string{}
jsonPathImage := fmt.Sprintf("-o=jsonpath={.spec.%s[*].image}", v)
jsonPathPolicy := fmt.Sprintf("-o=jsonpath={.spec.%s[*].imagePullPolicy}", v)
imageNames, err := oc.AsAdmin().WithoutNamespace().Run("get").Args(podName, jsonPathImage, "-n", project).Output()
// sometimes some job's pod maybe deleted so skip it
if err != nil {
if !strings.Contains(imageNames, "NotFound") {
e2e.Failf("Fail to get image(%s), error:%s", podName, imageNames)
}
} else {
imageNameSlice = strings.Split(imageNames, " ")
}
imagePullPolicys, err := oc.AsAdmin().WithoutNamespace().Run("get").Args(podName, jsonPathPolicy, "-n", project).Output()
if err != nil {
if !strings.Contains(imagePullPolicys, "NotFound") {
e2e.Failf("Fail to get imagePullPolicy(%s), error:%s", podName, imagePullPolicys)
}
} else {
imagePullPolicySlice = strings.Split(imagePullPolicys, " ")
}
if len(imageNameSlice) < 1 || len(imagePullPolicySlice) < 1 {
continue
}
for i := 0; i < len(imageNameSlice); i++ {
if _, ok := imageMap[imageNameSlice[i]]; !ok {
imageMap[imageNameSlice[i]] = imagePullPolicySlice[i]
}
}
}
return imageMap
}
// return a pod slice
func getProjectPods(oc *exutil.CLI, project string) (podSlice []string) {
podSlice = []string{}
if project == "" {
return podSlice
}
pods, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-o", "name", "-n", project).Output()
if err != nil {
e2e.Failf("Fail to get %s pods, error:%v", project, err)
}
podSlice = strings.Split(pods, "\n")
return podSlice
}
func ClusterHasEnabledFIPS(oc *exutil.CLI) bool {
firstNode, err := exutil.GetFirstMasterNode(oc)
msgIfErr := fmt.Sprintf("ERROR Could not get first node to check FIPS '%v' %v", firstNode, err)
o.Expect(err).NotTo(o.HaveOccurred(), msgIfErr)
o.Expect(firstNode).NotTo(o.BeEmpty(), msgIfErr)
// hardcode the default project since its enforce is privileged as default
fipsModeStatus, err := oc.AsAdmin().Run("debug").Args("-n", "default", "node/"+firstNode, "--", "chroot", "/host", "fips-mode-setup", "--check").Output()
msgIfErr = fmt.Sprintf("ERROR Could not check FIPS on node %v: '%v' %v", firstNode, fipsModeStatus, err)
o.Expect(err).NotTo(o.HaveOccurred(), msgIfErr)
o.Expect(fipsModeStatus).NotTo(o.BeEmpty(), msgIfErr)
// This will be true or false
return strings.Contains(fipsModeStatus, "FIPS mode is enabled.")
}
|
package operators
| ||||
function
|
openshift/openshift-tests-private
|
b584a57b-1eb9-487e-871a-0f1fd1102b9c
|
delete
|
['csvDescription']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
func (csv csvDescription) delete(itName string, dr describerResrouce) {
e2e.Logf("remove %s, ns %s", csv.name, csv.namespace)
dr.getIr(itName).remove(csv.name, "csv", csv.namespace)
}
|
operators
| ||||
function
|
openshift/openshift-tests-private
|
bace81eb-2edb-4119-81da-6b23c93a5290
|
create
|
['"strings"']
|
['subscriptionDescription']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
func (sub *subscriptionDescription) create(oc *exutil.CLI, itName string, dr describerResrouce) {
// for most operator subscription failure, the reason is that there is a left cluster-scoped CSV.
// I'd like to print all CSV before create it.
// allCSVs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "--all-namespaces").Output()
// if err != nil {
// e2e.Failf("!!! Couldn't get all CSVs:%v\n", err)
// }
// e2e.Logf("!!! Get all CSVs in this cluster:\n%s\n", allCSVs)
sub.createWithoutCheck(oc, itName, dr)
if strings.Compare(sub.ipApproval, "Automatic") == 0 {
sub.findInstalledCSVWithSkip(oc, itName, dr, true)
} else {
newCheck("expect", asAdmin, withoutNamespace, compare, "UpgradePending", ok, []string{"sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.state}"}).check(oc)
}
}
|
operators
| |||
function
|
openshift/openshift-tests-private
|
148c0f23-0adc-43dc-9f42-c28da2553e60
|
update
|
['"strings"']
|
['subscriptionDescription']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
func (sub *subscriptionDescription) update(oc *exutil.CLI, itName string, dr describerResrouce) {
installedCSV := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installedCSV}")
o.Expect(installedCSV).NotTo(o.BeEmpty())
if strings.Compare(sub.installedCSV, installedCSV) != 0 {
sub.installedCSV = installedCSV
dr.getIr(itName).add(newResource(oc, "csv", sub.installedCSV, requireNS, sub.namespace))
}
e2e.Logf("updating the subscription to get the latest installedCSV: %s", sub.installedCSV)
}
|
operators
| |||
function
|
openshift/openshift-tests-private
|
528c4054-6445-4211-9be3-30ef34ed84e0
|
createWithoutCheck
|
['"fmt"', '"strings"']
|
['subscriptionDescription']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
func (sub *subscriptionDescription) createWithoutCheck(oc *exutil.CLI, itName string, dr describerResrouce) {
//isAutomatic := strings.Compare(sub.ipApproval, "Automatic") == 0
//startingCSV is not necessary. And, if there are multi same package from different CatalogSource, it will lead to error.
//if strings.Compare(sub.currentCSV, "") == 0 {
// sub.currentCSV = getResource(oc, asAdmin, withoutNamespace, "packagemanifest", sub.operatorPackage, fmt.Sprintf("-o=jsonpath={.status.channels[?(@.name==\"%s\")].currentCSV}", sub.channel))
// o.Expect(sub.currentCSV).NotTo(o.BeEmpty())
//}
//if isAutomatic {
// sub.startingCSV = sub.currentCSV
//} else {
// o.Expect(sub.startingCSV).NotTo(o.BeEmpty())
//}
// for most operator subscription failure, the reason is that there is a left cluster-scoped CSV.
// I'd like to print all CSV before create it.
// It prints many lines which descrease the exact match for RP, and increase log size.
// So, change it to one line with necessary information csv name and namespace.
allCSVs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", "--all-namespaces", "-o=jsonpath={range .items[*]}{@.metadata.name}{\",\"}{@.metadata.namespace}{\":\"}{end}").Output()
if err != nil {
if strings.Contains(allCSVs, "unexpected EOF") || strings.Contains(err.Error(), "status 1") {
g.Skip(fmt.Sprintf("skip case with %v", allCSVs+err.Error()))
}
e2e.Failf("!!! Couldn't get all CSVs:%v\n", err)
}
csvMap := make(map[string][]string)
csvList := strings.Split(allCSVs, ":")
for _, csv := range csvList {
if strings.Compare(csv, "") == 0 {
continue
}
name := strings.Split(csv, ",")[0]
ns := strings.Split(csv, ",")[1]
val, ok := csvMap[name]
if ok {
if strings.HasPrefix(ns, "openshift-") {
alreadyOpenshiftDefaultNS := false
for _, v := range val {
if strings.Contains(v, "openshift-") {
alreadyOpenshiftDefaultNS = true // normally one default operator exists in all openshift- ns, like elasticsearch-operator
// only add one openshift- ns to indicate. to save log size and line size. Or else one line
// will be greater than 3k
break
}
}
if !alreadyOpenshiftDefaultNS {
val = append(val, ns)
csvMap[name] = val
}
} else {
val = append(val, ns)
csvMap[name] = val
}
} else {
nsSlice := make([]string, 20)
nsSlice[1] = ns
csvMap[name] = nsSlice
}
}
for name, ns := range csvMap {
e2e.Logf("getting csv is %v, the related NS is %v", name, ns)
}
e2e.Logf("create sub %s", sub.subName)
applyFn := applyResourceFromTemplate
if strings.Compare(sub.clusterType, "microshift") == 0 {
applyFn = applyResourceFromTemplateOnMicroshift
}
err = applyFn(oc, "--ignore-unknown-parameters=true", "-f", sub.template, "-p", "SUBNAME="+sub.subName, "SUBNAMESPACE="+sub.namespace, "CHANNEL="+sub.channel,
"APPROVAL="+sub.ipApproval, "OPERATORNAME="+sub.operatorPackage, "SOURCENAME="+sub.catalogSourceName, "SOURCENAMESPACE="+sub.catalogSourceNamespace,
"STARTINGCSV="+sub.startingCSV, "CONFIGMAPREF="+sub.configMapRef, "SECRETREF="+sub.secretRef)
o.Expect(err).NotTo(o.HaveOccurred())
dr.getIr(itName).add(newResource(oc, "sub", sub.subName, requireNS, sub.namespace))
}
|
operators
| |||
function
|
openshift/openshift-tests-private
|
c7092239-7763-4e58-8d59-debb4ad914e8
|
findInstalledCSV
|
['subscriptionDescription']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
func (sub *subscriptionDescription) findInstalledCSV(oc *exutil.CLI, itName string, dr describerResrouce) {
sub.findInstalledCSVWithSkip(oc, itName, dr, false)
}
|
operators
| ||||
function
|
openshift/openshift-tests-private
|
30422fc0-9bd9-4d58-8180-4525c59043a4
|
findInstalledCSVWithSkip
|
['"context"', '"encoding/json"', '"fmt"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['subscriptionDescription']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
func (sub *subscriptionDescription) findInstalledCSVWithSkip(oc *exutil.CLI, itName string, dr describerResrouce, skip bool) {
err := wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) {
state, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.state}").Output()
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 {
message, _ := oc.AsAdmin().WithoutNamespace().Run("describe").Args("sub", sub.subName, "-n", sub.namespace).Output()
e2e.Logf(message)
if sub.assertToSkipSpecificMessage(message) && skip {
g.Skip(fmt.Sprintf("the case skip without issue and impacted by others: %s", message))
}
message, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", sub.subName, "-n", sub.namespace,
"-o=jsonpath={.status.conditions[?(@.type==\"ResolutionFailed\")].message}").Output()
if sub.assertToSkipSpecificMessage(message) && skip {
g.Skip(fmt.Sprintf("the case skip without issue and impacted by others: %s", message))
}
message, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("installplan", "-n", sub.namespace, "-o=jsonpath-as-json={..status}").Output()
e2e.Logf(message)
message, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", sub.catalogSourceNamespace).Output()
e2e.Logf(message)
message, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", sub.namespace).Output()
e2e.Logf(message)
message, _ = oc.AsAdmin().WithoutNamespace().Run("get").Args("event", "-n", sub.namespace).Output()
e2e.Logf(message)
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("sub %s stat is not AtLatestKnown", sub.subName))
installedCSV := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installedCSV}")
o.Expect(installedCSV).NotTo(o.BeEmpty())
if strings.Compare(sub.installedCSV, installedCSV) != 0 {
sub.installedCSV = installedCSV
dr.getIr(itName).add(newResource(oc, "csv", sub.installedCSV, requireNS, sub.namespace))
}
e2e.Logf("the installed CSV name is %s", sub.installedCSV)
}
|
operators
| |||
function
|
openshift/openshift-tests-private
|
a87af406-3e4c-4c42-8d04-c86c79db06b6
|
assertToSkipSpecificMessage
|
['"strings"']
|
['subscriptionDescription']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
func (sub *subscriptionDescription) assertToSkipSpecificMessage(message string) bool {
specificMessages := []string{
"subscription sub-learn-46964 requires @existing/openshift-operators//learn-operator.v0.0.3",
"error using catalogsource openshift-marketplace/qe-app-registry",
"failed to list bundles: rpc error: code = Unavailable desc = connection error",
"Unable to connect to the server",
}
for _, specificMessage := range specificMessages {
if strings.Contains(message, specificMessage) {
return true
}
}
return false
}
|
operators
| |||
function
|
openshift/openshift-tests-private
|
68eb044d-180f-4584-9562-a0cd9325cff3
|
expectCSV
|
['"context"', '"fmt"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['subscriptionDescription']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
func (sub *subscriptionDescription) expectCSV(oc *exutil.CLI, itName string, dr describerResrouce, cv string) {
err := wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 480*time.Second, false, func(ctx context.Context) (bool, error) {
sub.findInstalledCSV(oc, itName, dr)
if strings.Compare(sub.installedCSV, cv) == 0 {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("expected csv %s not found", cv))
}
|
operators
| |||
function
|
openshift/openshift-tests-private
|
6ad8e5b5-edff-42c8-ab69-e80eb7de4317
|
approve
|
['"context"', '"fmt"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['subscriptionDescription']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
func (sub *subscriptionDescription) approve(oc *exutil.CLI, itName string, dr describerResrouce) {
err := wait.PollUntilContextTimeout(context.TODO(), 6*time.Second, 360*time.Second, false, func(ctx context.Context) (bool, error) {
for strings.Compare(sub.installedCSV, "") == 0 {
state := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.state}")
if strings.Compare(state, "AtLatestKnown") == 0 {
sub.installedCSV = getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installedCSV}")
dr.getIr(itName).add(newResource(oc, "csv", sub.installedCSV, requireNS, sub.namespace))
e2e.Logf("it is already done, and the installed CSV name is %s", sub.installedCSV)
continue
}
ipCsv := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installplan.name}{\" \"}{.status.currentCSV}")
sub.ipCsv = ipCsv + "##" + sub.ipCsv
installPlan := strings.Fields(ipCsv)[0]
o.Expect(installPlan).NotTo(o.BeEmpty())
e2e.Logf("try to approve installPlan %s", installPlan)
patchResource(oc, asAdmin, withoutNamespace, "installplan", installPlan, "-n", sub.namespace, "--type", "merge", "-p", "{\"spec\": {\"approved\": true}}")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 70*time.Second, false, func(ctx context.Context) (bool, error) {
err := newCheck("expect", asAdmin, withoutNamespace, compare, "Complete", ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
if err != nil {
e2e.Logf("the get error is %v, and try next", err)
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("installPlan %s is not Complete", installPlan))
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("not found installed csv for %s", sub.subName))
}
|
operators
| |||
function
|
openshift/openshift-tests-private
|
35605af3-313b-429d-9053-690d4878964b
|
approveSpecificIP
|
['"context"', '"fmt"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['subscriptionDescription']
|
github.com/openshift/openshift-tests-private/test/extended/operators/olm_utils.go
|
func (sub *subscriptionDescription) approveSpecificIP(oc *exutil.CLI, itName string, dr describerResrouce, csvName string, phase string) {
// fix https://github.com/openshift/openshift-tests-private/issues/735
var state string
wait.PollUntilContextTimeout(context.TODO(), 3*time.Second, 120*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, "UpgradePending") == 0 {
return true, nil
}
return false, nil
})
if strings.Compare(state, "UpgradePending") == 0 {
e2e.Logf("--> The expected CSV: %s", csvName)
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 90*time.Second, false, func(ctx context.Context) (bool, error) {
ipCsv := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installplan.name}{\" \"}{.status.currentCSV}")
if strings.Contains(ipCsv, csvName) {
installPlan := strings.Fields(ipCsv)[0]
if len(installPlan) == 0 {
return false, fmt.Errorf("installPlan is empty")
}
e2e.Logf("---> Get the pending InstallPlan %s", installPlan)
patchResource(oc, asAdmin, withoutNamespace, "installplan", installPlan, "-n", sub.namespace, "--type", "merge", "-p", "{\"spec\": {\"approved\": true}}")
err := wait.PollUntilContextTimeout(context.TODO(), 10*time.Second, 70*time.Second, false, func(ctx context.Context) (bool, error) {
err := newCheck("expect", asAdmin, withoutNamespace, compare, phase, ok, []string{"installplan", installPlan, "-n", sub.namespace, "-o=jsonpath={.status.phase}"}).checkWithoutAssert(oc)
if err != nil {
return false, nil
}
return true, nil
})
// break the wait loop and return an error
if err != nil {
return true, fmt.Errorf("installPlan %s is not %s", installPlan, phase)
}
return true, nil
} else {
e2e.Logf("--> Not found the expected CSV(%s), the current IP:%s", csvName, ipCsv)
return false, nil
}
})
if err != nil && strings.Contains(err.Error(), "installPlan") {
e2e.Failf(err.Error())
}
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("--> Not found the expected CSV: %s", csvName))
} else {
CSVs := getResource(oc, asAdmin, withoutNamespace, "sub", sub.subName, "-n", sub.namespace, "-o=jsonpath={.status.installedCSV}{\" \"}{.status.currentCSV}")
e2e.Logf("---> No need any apporval operation, the InstalledCSV and currentCSV are the same: %s", CSVs)
}
}
|
operators
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.