Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,22 @@
"exclude": "topology==\"External\""
}
},
{
"name": "[sig-olmv1][Jira:OLM] OLM v1 for stress PolarionID:81509-[OTP][Skipped:Disconnected][OlmStress]olmv1 create mass operator to see if they all are installed successfully [Slow][Timeout:330m]",
"labels": {
"Extended": {},
"NonHyperShiftHOST": {},
"StressTest": {}
},
"resources": {
"isolation": {}
},
"source": "openshift:payload:olmv1",
"lifecycle": "blocking",
"environmentSelector": {
"exclude": "topology==\"External\""
}
},
{
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 Catalogs should be installed",
"labels": {},
Expand Down
15 changes: 14 additions & 1 deletion openshift/tests-extension/test/qe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,20 @@ All migrated test case code needs the following changes to run in the new test f

**Environment Validation for Disconnected-Supporting Migrated Test Cases:**

If your test case supports disconnected environments, you MUST call `ValidateAccessEnvironment` at the beginning of the test:
**When to use `ValidateAccessEnvironment`:**

1. **Test cases that create ClusterCatalog or ClusterExtension**:
- If your test supports disconnected environments (both connected+disconnected, or disconnected-only)
- AND your test creates ClusterCatalog or ClusterExtension resources
- **MUST** call `ValidateAccessEnvironment(oc)` at the beginning of the test
- This applies to both newly created test cases and migrated test cases

2. **Test cases that do NOT create both ClusterCatalog or ClusterExtension**:
- Optional to use `ValidateAccessEnvironment(oc)`
- Using it won't cause errors, but it's not required
- The validation is primarily for ensuring catalog images can be mirrored

**Usage example:**

```go
g.It("test case supporting disconnected", func() {
Expand Down
146 changes: 146 additions & 0 deletions openshift/tests-extension/test/qe/specs/olmv1_stress.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
package specs

import (
"fmt"
"path/filepath"
"time"

g "github.com/onsi/ginkgo/v2"
o "github.com/onsi/gomega"
e2e "k8s.io/kubernetes/test/e2e/framework"

exutil "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util"
olmv1util "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util/olmv1util"
)

var _ = g.Describe("[sig-olmv1][Jira:OLM] OLM v1 for stress", func() {

defer g.GinkgoRecover()
var (
oc = exutil.NewCLIWithoutNamespace("default")
)

g.BeforeEach(func() {
exutil.SkipMicroshift(oc)
exutil.SkipNoOLMv1Core(oc)
})

// author: kuiwang@redhat.com
g.It("PolarionID:81509-[OTP][Skipped:Disconnected][OlmStress]olmv1 create mass operator to see if they all are installed successfully [Slow][Timeout:330m]", g.Label("StressTest"), g.Label("NonHyperShiftHOST"), func() {
var (
caseID = "81509"
prefixCatalog = "catalog-" + caseID
prefixSa = "sa-" + caseID
prefixCe = "ce-" + caseID
prefixNs = "ns-" + caseID
prefixPackage = "stress-olmv1-c"
prefixImage = "quay.io/olmqe/stress-index:vokv"
nsOc = "openshift-operator-controller"
nsCatalog = "openshift-catalogd"
catalogLabel = "control-plane=catalogd-controller-manager"
ocLabel = "control-plane=operator-controller-controller-manager"
baseDir = exutil.FixturePath("testdata", "olm")
clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml")
clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml")
saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml")
)

if !olmv1util.IsPodReady(oc, nsCatalog, catalogLabel) {
_, _ = olmv1util.Get(oc, "pod", "-n", nsCatalog, "-l", catalogLabel, "-o", "yaml")
exutil.AssertWaitPollNoErr(fmt.Errorf("the pod with %s is not correct", catalogLabel), "the pod with app=catalog-operator is not correct")
}
if !olmv1util.IsPodReady(oc, nsOc, ocLabel) {
_, _ = olmv1util.Get(oc, "pod", "-n", nsOc, "-l", ocLabel, "-o", "yaml")
exutil.AssertWaitPollNoErr(fmt.Errorf("the pod with %s is not correct", ocLabel), "the pod with app=olm-operator is not correct")
}

startTime := time.Now().UTC()
e2e.Logf("Start time: %s", startTime.Format(time.RFC3339))

// for i := 0; i < 500; i++ {
for i := 900; i < 969; i++ {
// it is not enough with 330m for one case if we run 100 times
e2e.Logf("=================it is round %v=================", i)
ns := fmt.Sprintf("%s-%d", prefixNs, i)
clustercatalog := olmv1util.ClusterCatalogDescription{
Name: fmt.Sprintf("%s-%d", prefixCatalog, i),
Imageref: fmt.Sprintf("%s%d", prefixImage, i),
Template: clustercatalogTemplate,
}
saCrb := olmv1util.SaCLusterRolebindingDescription{
Name: fmt.Sprintf("%s-%d", prefixSa, i),
Namespace: ns,
Template: saClusterRoleBindingTemplate,
}
ce := olmv1util.ClusterExtensionDescription{
Name: fmt.Sprintf("%s-%d", prefixCe, i),
PackageName: fmt.Sprintf("%s%d", prefixPackage, i),
Channel: "alpha",
Version: ">=0.0.1",
InstallNamespace: ns,
SaName: fmt.Sprintf("%s-%d", prefixSa, i),
Template: clusterextensionTemplate,
}
g.By(fmt.Sprintf("Create namespace for %d", i))
// defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute()
// it take time delete ns which is not necessary. currently 5.5h is not enough to delete them.
// so I prefer to keep ns to save case duration
err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute()
o.Expect(err).NotTo(o.HaveOccurred())

o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue())

g.By(fmt.Sprintf("Create clustercatalog for %d", i))
e2e.Logf("=========Create clustercatalog %v=========", clustercatalog.Name)
defer clustercatalog.Delete(oc)
err = clustercatalog.CreateWithoutCheck(oc)
o.Expect(err).NotTo(o.HaveOccurred())
clustercatalog.WaitCatalogStatus(oc, "true", "Serving", 0)

g.By(fmt.Sprintf("Create SA for clusterextension for %d", i))
defer saCrb.Delete(oc)
saCrb.Create(oc)

g.By(fmt.Sprintf("check ce to be installed for %d", i))
e2e.Logf("=========Create clusterextension %v=========", ce.Name)
defer ce.Delete(oc)
err = ce.CreateWithoutCheck(oc)
o.Expect(err).NotTo(o.HaveOccurred())
ce.CheckClusterExtensionCondition(oc, "Progressing", "reason", "Succeeded", 10, 600, 0)
ce.WaitClusterExtensionCondition(oc, "Installed", "True", 0)
}

endTime := time.Now().UTC()
e2e.Logf("End time: %v", endTime.Format(time.RFC3339))

duration := endTime.Sub(startTime)
minutes := int(duration.Minutes())
if minutes < 1 {
minutes = 1
}

podName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", catalogLabel, "-o=jsonpath={.items[0].metadata.name}", "-n", nsCatalog).Output()
if err == nil {
if !olmv1util.WriteErrToArtifactDir(oc, nsCatalog, podName, "error", "Unhandled|Reconciler error|level=info", caseID, minutes) {
e2e.Logf("no error log into artifact for pod %s in %s", podName, nsCatalog)
}
}
podName, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", ocLabel, "-o=jsonpath={.items[0].metadata.name}", "-n", nsOc).Output()
if err == nil {
if !olmv1util.WriteErrToArtifactDir(oc, nsOc, podName, "error", "Unhandled|Reconciler error|level=info", caseID, minutes) {
e2e.Logf("no error log into artifact for pod %s in %s", podName, nsOc)
}
}

if !olmv1util.IsPodReady(oc, nsCatalog, catalogLabel) {
_, _ = olmv1util.Get(oc, "pod", "-n", nsCatalog, "-l", catalogLabel, "-o", "yaml")
exutil.AssertWaitPollNoErr(fmt.Errorf("the pod with %s is not correct", catalogLabel), "the pod with app=catalog-operator is not correct")
}
if !olmv1util.IsPodReady(oc, nsOc, ocLabel) {
_, _ = olmv1util.Get(oc, "pod", "-n", nsOc, "-l", ocLabel, "-o", "yaml")
exutil.AssertWaitPollNoErr(fmt.Errorf("the pod with %s is not correct", ocLabel), "the pod with app=olm-operator is not correct")
}

})

})
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ func SkipNonAmd64SingleArch(oc *exutil.CLI) Architecture {
func getNodeArchitectures(oc *exutil.CLI) []string {
output, err := oc.WithoutNamespace().AsAdmin().Run("get").Args("nodes", "-o=jsonpath={.items[*].status.nodeInfo.architecture}").Output()
if err != nil {
e2e.Failf("unable to get cluster node architectures: %v", err)
g.Skip(fmt.Sprintf("unable to get cluster node architectures: %v", err))
}
if output == "" {
e2e.Failf("no nodes found or architecture information missing")
g.Skip("no nodes found or architecture information missing")
}
return strings.Fields(output) // Use Fields instead of Split to handle multiple spaces
}
Expand All @@ -97,7 +97,7 @@ func getNodeArchitectures(oc *exutil.CLI) []string {
func GetAvailableArchitecturesSet(oc *exutil.CLI) []Architecture {
architectureStrings := getNodeArchitectures(oc)
if len(architectureStrings) == 0 {
e2e.Failf("no node architectures found")
g.Skip("no node architectures found")
}

// Use map for deduplication with Architecture as key
Expand Down Expand Up @@ -199,7 +199,7 @@ func (a Architecture) String() string {
func ClusterArchitecture(oc *exutil.CLI) Architecture {
architectureStrings := getNodeArchitectures(oc)
if len(architectureStrings) == 0 {
e2e.Failf("no node architectures found")
g.Skip("no node architectures found")
}

// Filter out empty strings and convert to Architecture
Expand All @@ -211,7 +211,7 @@ func ClusterArchitecture(oc *exutil.CLI) Architecture {
}

if len(architectures) == 0 {
e2e.Failf("no valid node architectures found")
g.Skip("no valid node architectures found")
}

// Check if all architectures are the same
Expand Down Expand Up @@ -267,7 +267,7 @@ func GetControlPlaneArch(oc *exutil.CLI) Architecture {

architectureStr = strings.TrimSpace(architectureStr)
if architectureStr == "" {
e2e.Failf("Control plane node %s has no architecture information", masterNode)
g.Skip(fmt.Sprintf("Control plane node %s has no architecture information", masterNode))
}

return FromString(architectureStr)
Expand Down
2 changes: 1 addition & 1 deletion openshift/tests-extension/test/qe/util/olmv1util/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ func HasExternalNetworkAccess(oc *exutil.CLI) bool {
// Note: In disconnected environments, curl will fail and bash will return non-zero exit code,
// causing DebugNodeWithChroot to return an error. We ignore this error and rely on output checking.
cmd := `timeout 10 curl -k https://quay.io > /dev/null 2>&1; [ $? -eq 0 ] && echo "connected"`
output, _ := exutil.DebugNodeWithChroot(oc, masterNode, "bash", "-c", cmd)
output, _ := exutil.DebugNodeWithOptionsAndChroot(oc, masterNode, []string{"--to-namespace=default"}, "bash", "-c", cmd)

// Check if the output contains "connected"
// - Connected environment: curl succeeds -> echo "connected" -> output contains "connected"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- endpoint: {{.PROMETHEUS_URL}}
token: {{.PROMETHEUS_TOKEN}}
step: 10s
skipTLSVerify: true
metrics:
- metrics-profiles/metrics-aggregated.yml
indexer:
type: local
metricsDirectory: collected-metrics-{{.UUID}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Containers & pod metrics

- query: (sum(irate(container_cpu_usage_seconds_total{container="manager",namespace="openshift-catalogd"}[2m]) * 100) by (container, pod)) > 0
metricName: containerCPU-Catlogd

- query: (sum(irate(container_cpu_usage_seconds_total{container="manager",namespace="openshift-operator-controller"}[2m]) * 100) by (container, pod)) > 0
metricName: containerCPU-OpCon
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
global:
gc: {{.GC}}
gcMetrics: {{.GC_METRICS}}
measurements:
- name: podLatency


jobs:
- name: {{.OPERATION}}
jobType: create
jobIterations: {{.JOB_ITERATIONS}}
namespace: {{.OPERATION}}
namespacedIterations: {{.NAMESPACED_ITERATIONS}}
iterationsPerNamespace: {{.ITERATIONS_PER_NAMESPACE}}
cleanup: true
podWait: true
waitWhenFinished: true
maxWaitTimeout: {{.MAX_WAIT_TIMEOUT}}
jobIterationDelay: {{.JOB_ITERATION_DELAY}}
jobPause: {{.JOB_PAUSE}}
qps: {{.QPS}}
burst: {{.BURST}}
executionMode: parallel
verifyObjects: true
errorOnVerify: true
skipIndexing: false
preLoadImages: true
preLoadPeriod: 15s
churn: false
defaultMissingKeysWithZero: false
namespaceLabels:
security.openshift.io/scc.podSecurityLabelSync: false
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/audit: privileged
pod-security.kubernetes.io/warn: privileged
objects:

- objectTemplate: templates/catalogd.yml
replicas: 1
inputVars:
prefixImageName: "quay.io/olmqe/stress-index:vokv"
waitOptions:
customStatusPaths:
- key: ".conditions[] | select(.type==\"Serving\") | .status"
value: "True"

- objectTemplate: templates/clusterrole.yml
replicas: 1

- objectTemplate: templates/sa.yml
replicas: 1

- objectTemplate: templates/clusterrolebinding.yml
replicas: 1
inputVars:
prefixNamespace: {{.OPERATION}}

- objectTemplate: templates/ce.yml
replicas: 1
inputVars:
prefixNamespace: {{.OPERATION}}
prefixPkgName: {{.PREFIX_PKG_NAME_V1}}
waitOptions:
customStatusPaths:
- key: ".conditions[] | select(.type==\"Installed\") | .status"
value: "True"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: olm.operatorframework.io/v1
kind: ClusterCatalog
metadata:
name: "clustercatalog-{{.Iteration}}"
spec:
source:
type: Image
image:
ref: "{{.prefixImageName}}{{.Iteration}}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
name: "ce-{{.Iteration}}"
spec:
namespace: "{{.prefixNamespace}}-{{.Iteration}}"
serviceAccount:
name: "ins-sa-{{.Iteration}}"
source:
sourceType: Catalog
catalog:
packageName: "{{.prefixPkgName}}{{.Iteration}}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: "ins-admin-clusterrole-{{.Iteration}}"
rules:
- apiGroups:
- "*"
resources:
- "*"
verbs:
- "*"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: "ins-admin-clusterrole-binding-{{.Iteration}}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: "ins-admin-clusterrole-{{.Iteration}}"
subjects:
- kind: ServiceAccount
name: "ins-sa-{{.Iteration}}"
namespace: "{{.prefixNamespace}}-{{.Iteration}}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: "ins-sa-{{.Iteration}}"
6 changes: 6 additions & 0 deletions openshift/tests-extension/test/qe/util/stress/util/ma.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python3

from ma.cli.__main__ import main

if __name__ == "__main__":
main()
Loading