|
| 1 | +package specs |
| 2 | + |
| 3 | +import ( |
| 4 | + "fmt" |
| 5 | + "path/filepath" |
| 6 | + "time" |
| 7 | + |
| 8 | + g "github.com/onsi/ginkgo/v2" |
| 9 | + o "github.com/onsi/gomega" |
| 10 | + e2e "k8s.io/kubernetes/test/e2e/framework" |
| 11 | + |
| 12 | + exutil "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util" |
| 13 | + olmv1util "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util/olmv1util" |
| 14 | +) |
| 15 | + |
| 16 | +var _ = g.Describe("[sig-olmv1][Jira:OLM] OLM v1 for stress", func() { |
| 17 | + |
| 18 | + defer g.GinkgoRecover() |
| 19 | + var ( |
| 20 | + oc = exutil.NewCLIWithoutNamespace("default") |
| 21 | + ) |
| 22 | + |
| 23 | + g.BeforeEach(func() { |
| 24 | + exutil.SkipMicroshift(oc) |
| 25 | + exutil.SkipNoOLMv1Core(oc) |
| 26 | + }) |
| 27 | + |
| 28 | + |
| 29 | + 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() { |
| 30 | + var ( |
| 31 | + caseID = "81509" |
| 32 | + prefixCatalog = "catalog-" + caseID |
| 33 | + prefixSa = "sa-" + caseID |
| 34 | + prefixCe = "ce-" + caseID |
| 35 | + prefixNs = "ns-" + caseID |
| 36 | + prefixPackage = "stress-olmv1-c" |
| 37 | + prefixImage = "quay.io/olmqe/stress-index:vokv" |
| 38 | + nsOc = "openshift-operator-controller" |
| 39 | + nsCatalog = "openshift-catalogd" |
| 40 | + catalogLabel = "control-plane=catalogd-controller-manager" |
| 41 | + ocLabel = "control-plane=operator-controller-controller-manager" |
| 42 | + baseDir = exutil.FixturePath("testdata", "olm") |
| 43 | + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") |
| 44 | + clusterextensionTemplate = filepath.Join(baseDir, "clusterextension.yaml") |
| 45 | + saClusterRoleBindingTemplate = filepath.Join(baseDir, "sa-admin.yaml") |
| 46 | + ) |
| 47 | + |
| 48 | + if !olmv1util.IsPodReady(oc, nsCatalog, catalogLabel) { |
| 49 | + _, _ = olmv1util.Get(oc, "pod", "-n", nsCatalog, "-l", catalogLabel, "-o", "yaml") |
| 50 | + exutil.AssertWaitPollNoErr(fmt.Errorf("the pod with %s is not correct", catalogLabel), "the pod with app=catalog-operator is not correct") |
| 51 | + } |
| 52 | + if !olmv1util.IsPodReady(oc, nsOc, ocLabel) { |
| 53 | + _, _ = olmv1util.Get(oc, "pod", "-n", nsOc, "-l", ocLabel, "-o", "yaml") |
| 54 | + exutil.AssertWaitPollNoErr(fmt.Errorf("the pod with %s is not correct", ocLabel), "the pod with app=olm-operator is not correct") |
| 55 | + } |
| 56 | + |
| 57 | + startTime := time.Now().UTC() |
| 58 | + e2e.Logf("Start time: %s", startTime.Format(time.RFC3339)) |
| 59 | + |
| 60 | + // for i := 0; i < 500; i++ { |
| 61 | + for i := 900; i < 969; i++ { |
| 62 | + // it is not enough with 330m for one case if we run 100 times |
| 63 | + e2e.Logf("=================it is round %v=================", i) |
| 64 | + ns := fmt.Sprintf("%s-%d", prefixNs, i) |
| 65 | + clustercatalog := olmv1util.ClusterCatalogDescription{ |
| 66 | + Name: fmt.Sprintf("%s-%d", prefixCatalog, i), |
| 67 | + Imageref: fmt.Sprintf("%s%d", prefixImage, i), |
| 68 | + Template: clustercatalogTemplate, |
| 69 | + } |
| 70 | + saCrb := olmv1util.SaCLusterRolebindingDescription{ |
| 71 | + Name: fmt.Sprintf("%s-%d", prefixSa, i), |
| 72 | + Namespace: ns, |
| 73 | + Template: saClusterRoleBindingTemplate, |
| 74 | + } |
| 75 | + ce := olmv1util.ClusterExtensionDescription{ |
| 76 | + Name: fmt.Sprintf("%s-%d", prefixCe, i), |
| 77 | + PackageName: fmt.Sprintf("%s%d", prefixPackage, i), |
| 78 | + Channel: "alpha", |
| 79 | + Version: ">=0.0.1", |
| 80 | + InstallNamespace: ns, |
| 81 | + SaName: fmt.Sprintf("%s-%d", prefixSa, i), |
| 82 | + Template: clusterextensionTemplate, |
| 83 | + } |
| 84 | + g.By(fmt.Sprintf("Create namespace for %d", i)) |
| 85 | + // defer oc.WithoutNamespace().AsAdmin().Run("delete").Args("ns", ns, "--ignore-not-found").Execute() |
| 86 | + // it takes time to delete ns which is not necessary. currently 5.5h is not enough to delete them. |
| 87 | + // so I prefer to keep ns to save case duration |
| 88 | + err := oc.WithoutNamespace().AsAdmin().Run("create").Args("ns", ns).Execute() |
| 89 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 90 | + o.Expect(olmv1util.Appearance(oc, exutil.Appear, "ns", ns)).To(o.BeTrue()) |
| 91 | + |
| 92 | + g.By(fmt.Sprintf("Create clustercatalog for %d", i)) |
| 93 | + e2e.Logf("=========Create clustercatalog %v=========", clustercatalog.Name) |
| 94 | + defer clustercatalog.Delete(oc) |
| 95 | + err = clustercatalog.CreateWithoutCheck(oc) |
| 96 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 97 | + clustercatalog.WaitCatalogStatus(oc, "true", "Serving", 0) |
| 98 | + |
| 99 | + g.By(fmt.Sprintf("Create SA for clusterextension for %d", i)) |
| 100 | + defer saCrb.Delete(oc) |
| 101 | + saCrb.Create(oc) |
| 102 | + |
| 103 | + g.By(fmt.Sprintf("check ce to be installed for %d", i)) |
| 104 | + e2e.Logf("=========Create clusterextension %v=========", ce.Name) |
| 105 | + defer ce.Delete(oc) |
| 106 | + err = ce.CreateWithoutCheck(oc) |
| 107 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 108 | + ce.CheckClusterExtensionCondition(oc, "Progressing", "reason", "Succeeded", 10, 600, 0) |
| 109 | + ce.WaitClusterExtensionCondition(oc, "Installed", "True", 0) |
| 110 | + } |
| 111 | + |
| 112 | + endTime := time.Now().UTC() |
| 113 | + e2e.Logf("End time: %v", endTime.Format(time.RFC3339)) |
| 114 | + |
| 115 | + duration := endTime.Sub(startTime) |
| 116 | + minutes := int(duration.Minutes()) |
| 117 | + if minutes < 1 { |
| 118 | + minutes = 1 |
| 119 | + } |
| 120 | + |
| 121 | + podName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", catalogLabel, "-o=jsonpath={.items[0].metadata.name}", "-n", nsCatalog).Output() |
| 122 | + if err == nil { |
| 123 | + if !olmv1util.WriteErrToArtifactDir(oc, nsCatalog, podName, "error", "Unhandled|Reconciler error|level=info", caseID, minutes) { |
| 124 | + e2e.Logf("no error log into artifact for pod %s in %s", podName, nsCatalog) |
| 125 | + } |
| 126 | + } |
| 127 | + podName, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "-l", ocLabel, "-o=jsonpath={.items[0].metadata.name}", "-n", nsOc).Output() |
| 128 | + if err == nil { |
| 129 | + if !olmv1util.WriteErrToArtifactDir(oc, nsOc, podName, "error", "Unhandled|Reconciler error|level=info", caseID, minutes) { |
| 130 | + e2e.Logf("no error log into artifact for pod %s in %s", podName, nsOc) |
| 131 | + } |
| 132 | + } |
| 133 | + |
| 134 | + if !olmv1util.IsPodReady(oc, nsCatalog, catalogLabel) { |
| 135 | + _, _ = olmv1util.Get(oc, "pod", "-n", nsCatalog, "-l", catalogLabel, "-o", "yaml") |
| 136 | + exutil.AssertWaitPollNoErr(fmt.Errorf("the pod with %s is not correct", catalogLabel), "the pod with app=catalog-operator is not correct") |
| 137 | + } |
| 138 | + if !olmv1util.IsPodReady(oc, nsOc, ocLabel) { |
| 139 | + _, _ = olmv1util.Get(oc, "pod", "-n", nsOc, "-l", ocLabel, "-o", "yaml") |
| 140 | + exutil.AssertWaitPollNoErr(fmt.Errorf("the pod with %s is not correct", ocLabel), "the pod with app=olm-operator is not correct") |
| 141 | + } |
| 142 | + |
| 143 | + }) |
| 144 | + |
| 145 | +}) |
0 commit comments