diff --git a/test/e2e/bundle_e2e_test.go b/test/e2e/bundle_e2e_test.go index 4d1aae0940..d52c348edc 100644 --- a/test/e2e/bundle_e2e_test.go +++ b/test/e2e/bundle_e2e_test.go @@ -62,7 +62,7 @@ var _ = Describe("Installing bundles with new object types", func() { imageName = "quay.io/olmtest/single-bundle-index:pdb-v1" ) - // create VPA CRD on cluster + By("create VPA CRD on cluster") Expect(vpaCRDRaw).ToNot(BeEmpty(), "could not read vpa bindata") data, err := yaml.YAMLToJSON(vpaCRDRaw) Expect(err).ToNot(HaveOccurred(), "could not convert vpa crd to json") @@ -80,7 +80,7 @@ var _ = Describe("Installing bundles with new object types", func() { return nil }).Should(Succeed()) - // ensure vpa crd is established and accepted on the cluster before continuing + By("ensure vpa crd is established and accepted on the cluster before continuing") Eventually(func() (bool, error) { crd, err := kubeClient.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.Background(), vpaCRD.GetName(), metav1.GetOptions{}) if err != nil { @@ -113,20 +113,20 @@ var _ = Describe("Installing bundles with new object types", func() { return err }).Should(Succeed()) - // Wait for the CatalogSource to be ready + By("Wait for the CatalogSource to be ready") _, err = fetchCatalogSourceOnStatus(operatorClient, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready") - // Create a Subscription for package + By("Create a Subscription for package") _ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic) - // Wait for the Subscription to succeed + By("Wait for the Subscription to succeed") sub, err := fetchSubscription(operatorClient, generatedNamespace.GetName(), subName, subscriptionStateAtLatestChecker()) Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status") installPlanRef := sub.Status.InstallPlanRef - // Wait for the installplan to complete (5 minute timeout) + By("Wait for the installplan to complete (5 minute timeout)") _, err = fetchInstallPlanWithNamespace(GinkgoT(), operatorClient, installPlanRef.Name, installPlanRef.Namespace, buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete)) Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase") @@ -149,7 +149,7 @@ var _ = Describe("Installing bundles with new object types", func() { Resource: vpaResource, } - // confirm extra bundle objects are installed + By("confirm extra bundle objects are installed") Eventually(func() error { _, err := kubeClient.KubernetesInterface().SchedulingV1().PriorityClasses().Get(context.Background(), priorityClassName, metav1.GetOptions{}) return err diff --git a/test/e2e/catalog_e2e_test.go b/test/e2e/catalog_e2e_test.go index c246641818..f252437885 100644 --- a/test/e2e/catalog_e2e_test.go +++ b/test/e2e/catalog_e2e_test.go @@ -78,7 +78,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { }) It("loading between restarts", func() { - // create a simple catalogsource + By("create a simple catalogsource") packageName := genName("nginx") stableChannel := "stable" packageStable := packageName + "-stable" @@ -108,22 +108,22 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { _, cleanupSource := createInternalCatalogSource(c, crc, catalogSourceName, generatedNamespace.GetName(), manifests, []apiextensionsv1.CustomResourceDefinition{crd}, []v1alpha1.ClusterServiceVersion{csv}) defer cleanupSource() - // ensure the mock catalog exists and has been synced by the catalog operator + By("ensure the mock catalog exists and has been synced by the catalog operator") catalogSource, err := fetchCatalogSourceOnStatus(crc, catalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ShouldNot(HaveOccurred()) - // get catalog operator deployment + By("get catalog operator deployment") deployment, err := getOperatorDeployment(c, operatorNamespace, labels.Set{"app": "catalog-operator"}) Expect(err).ShouldNot(HaveOccurred()) Expect(deployment).ToNot(BeNil(), "Could not find catalog operator deployment") - // rescale catalog operator + By("rescale catalog operator") By("Rescaling catalog operator...") err = rescaleDeployment(c, deployment) Expect(err).ShouldNot(HaveOccurred(), "Could not rescale catalog operator") By("Catalog operator rescaled") - // check for last synced update to catalogsource + By("check for last synced update to catalogsource") By("Checking for catalogsource lastSync updates") _, err = fetchCatalogSourceOnStatus(crc, catalogSourceName, generatedNamespace.GetName(), func(cs *v1alpha1.CatalogSource) bool { before := catalogSource.Status.GRPCConnectionState @@ -164,7 +164,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { mainCatalogName := genName("mock-ocs-main-") - // Create separate manifests for each CatalogSource + By("Create separate manifests for each CatalogSource") mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -175,11 +175,11 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { }, } - // Create the initial catalog source + By("Create the initial catalog source") cs, cleanup := createInternalCatalogSource(c, crc, mainCatalogName, globalCatalogNamespace, mainManifests, []apiextensionsv1.CustomResourceDefinition{mainCRD}, []v1alpha1.ClusterServiceVersion{mainCSV}) defer cleanup() - // Attempt to get the catalog source before creating install plan + By("Attempt to get the catalog source before creating install plan") _, err := fetchCatalogSourceOnStatus(crc, cs.GetName(), cs.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred()) @@ -192,7 +192,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { InstallPlanApproval: v1alpha1.ApprovalManual, } - // Create Subscription + By("Create Subscription") subscriptionName := genName("sub-") createSubscriptionForCatalogWithSpec(GinkgoT(), crc, generatedNamespace.GetName(), subscriptionName, subscriptionSpec) @@ -217,7 +217,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), mainCSV.GetName(), csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Update manifest + By("Update manifest") mainManifests = []registry.PackageManifest{ { PackageName: mainPackageName, @@ -228,10 +228,10 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { }, } - // Update catalog configmap + By("Update catalog configmap") updateInternalCatalog(GinkgoT(), c, crc, cs.GetName(), cs.GetNamespace(), []apiextensionsv1.CustomResourceDefinition{mainCRD}, []v1alpha1.ClusterServiceVersion{mainCSV, replacementCSV}, mainManifests) - // Get updated catalogsource + By("Get updated catalogsource") fetchedUpdatedCatalog, err := fetchCatalogSourceOnStatus(crc, cs.GetName(), cs.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ShouldNot(HaveOccurred()) @@ -239,7 +239,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { Expect(err).ShouldNot(HaveOccurred()) Expect(subscription).ShouldNot(BeNil()) - // Ensure the timing + By("Ensure the timing") catalogConnState := fetchedUpdatedCatalog.Status.GRPCConnectionState subUpdatedTime := subscription.Status.LastUpdated Expect(subUpdatedTime.Time).Should(BeTemporally("<", catalogConnState.LastConnectTime.Add(60*time.Second))) @@ -273,7 +273,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { mainCatalogName := genName("mock-ocs-main-") - // Create separate manifests for each CatalogSource + By("Create separate manifests for each CatalogSource") mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -294,23 +294,23 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { }, } - // Create the initial catalogsource + By("Create the initial catalogsource") createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, nil, []v1alpha1.ClusterServiceVersion{mainCSV}) - // Attempt to get the catalog source before creating install plan + By("Attempt to get the catalog source before creating install plan") fetchedInitialCatalog, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ShouldNot(HaveOccurred()) - // Get initial configmap + By("Get initial configmap") configMap, err := c.KubernetesInterface().CoreV1().ConfigMaps(generatedNamespace.GetName()).Get(context.Background(), fetchedInitialCatalog.Spec.ConfigMap, metav1.GetOptions{}) Expect(err).ShouldNot(HaveOccurred()) - // Check pod created + By("Check pod created") initialPods, err := c.KubernetesInterface().CoreV1().Pods(generatedNamespace.GetName()).List(context.Background(), metav1.ListOptions{LabelSelector: "olm.configMapResourceVersion=" + configMap.ResourceVersion}) Expect(err).ShouldNot(HaveOccurred()) Expect(initialPods.Items).To(HaveLen(1)) - // Update catalog configmap + By("Update catalog configmap") updateInternalCatalog(GinkgoT(), c, crc, mainCatalogName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{dependentCRD}, []v1alpha1.ClusterServiceVersion{mainCSV, dependentCSV}, append(mainManifests, dependentManifests...)) fetchedUpdatedCatalog, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), func(catalog *v1alpha1.CatalogSource) bool { @@ -329,7 +329,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { var updatedConfigMap *corev1.ConfigMap Eventually(func() (types.UID, error) { var err error - // Get updated configmap + By("Get updated configmap") updatedConfigMap, err = c.KubernetesInterface().CoreV1().ConfigMaps(generatedNamespace.GetName()).Get(context.Background(), fetchedInitialCatalog.Spec.ConfigMap, metav1.GetOptions{}) if err != nil { return "", err @@ -344,20 +344,20 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { Expect(fetchedInitialCatalog.Status.ConfigMapResource.ResourceVersion).ShouldNot(Equal(fetchedUpdatedCatalog.Status.ConfigMapResource.ResourceVersion)) Expect(fetchedUpdatedCatalog.Status.ConfigMapResource.ResourceVersion).Should(Equal(updatedConfigMap.GetResourceVersion())) - // Await 1 CatalogSource registry pod matching the updated labels + By("Await 1 CatalogSource registry pod matching the updated labels") singlePod := podCount(1) selector := labels.SelectorFromSet(map[string]string{"olm.catalogSource": mainCatalogName, "olm.configMapResourceVersion": updatedConfigMap.GetResourceVersion()}) podList, err := awaitPods(GinkgoT(), c, generatedNamespace.GetName(), selector.String(), singlePod) Expect(err).ShouldNot(HaveOccurred()) Expect(podList.Items).To(HaveLen(1), "expected pod list not of length 1") - // Await 1 CatalogSource registry pod matching the updated labels + By("Await 1 CatalogSource registry pod matching the updated labels") selector = labels.SelectorFromSet(map[string]string{"olm.catalogSource": mainCatalogName}) podList, err = awaitPods(GinkgoT(), c, generatedNamespace.GetName(), selector.String(), singlePod) Expect(err).ShouldNot(HaveOccurred()) Expect(podList.Items).To(HaveLen(1), "expected pod list not of length 1") - // Create Subscription + By("Create Subscription") subscriptionName := genName("sub-") createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subscriptionName, fetchedUpdatedCatalog.GetName(), mainPackageName, stableChannel, "", v1alpha1.ApprovalAutomatic) @@ -406,7 +406,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { mainCatalogName := genName("mock-ocs-main-") - // Create separate manifests for each CatalogSource + By("Create separate manifests for each CatalogSource") mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -427,28 +427,28 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { }, } - // Create the initial catalogsource + By("Create the initial catalogsource") _, cleanupSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, nil, []v1alpha1.ClusterServiceVersion{mainCSV}) - // Attempt to get the catalog source before creating install plan + By("Attempt to get the catalog source before creating install plan") fetchedInitialCatalog, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ShouldNot(HaveOccurred()) - // Get initial configmap + By("Get initial configmap") configMap, err := c.KubernetesInterface().CoreV1().ConfigMaps(generatedNamespace.GetName()).Get(context.Background(), fetchedInitialCatalog.Spec.ConfigMap, metav1.GetOptions{}) Expect(err).ShouldNot(HaveOccurred()) - // Check pod created + By("Check pod created") initialPods, err := c.KubernetesInterface().CoreV1().Pods(generatedNamespace.GetName()).List(context.Background(), metav1.ListOptions{LabelSelector: "olm.configMapResourceVersion=" + configMap.ResourceVersion}) Expect(err).ShouldNot(HaveOccurred()) Expect(initialPods.Items).To(HaveLen(1)) - // delete the first catalog + By("delete the first catalog") cleanupSource() - // create a catalog with the same name + By("create a catalog with the same name") createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), append(mainManifests, dependentManifests...), []apiextensionsv1.CustomResourceDefinition{dependentCRD}, []v1alpha1.ClusterServiceVersion{mainCSV, dependentCSV}) - // Create Subscription + By("Create Subscription") subscriptionName := genName("sub-") createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subscriptionName, mainCatalogName, mainPackageName, stableChannel, "", v1alpha1.ApprovalAutomatic) @@ -461,16 +461,16 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { It("gRPC address catalog source", func() { - // Create an internal (configmap) CatalogSource with stable and dependency csv - // Create an internal (configmap) replacement CatalogSource with a stable, stable-replacement, and dependency csv - // Copy both configmap-server pods to the test namespace - // Delete both CatalogSources - // Create an "address" CatalogSource with a Spec.Address field set to the stable copied pod's PodIP - // Create a Subscription to the stable package - // Wait for the stable Subscription to be Successful - // Wait for the stable CSV to be Successful - // Update the "address" CatalogSources's Spec.Address field with the PodIP of the replacement copied pod's PodIP - // Wait for the replacement CSV to be Successful + By("Create an internal (configmap) CatalogSource with stable and dependency csv") + By("Create an internal (configmap) replacement CatalogSource with a stable, stable-replacement, and dependency csv") + By("Copy both configmap-server pods to the test namespace") + By("Delete both CatalogSources") + By("Create an \"address\" CatalogSource with a Spec.Address field set to the stable copied pod's PodIP") + By("Create a Subscription to the stable package") + By("Wait for the stable Subscription to be Successful") + By("Wait for the stable CSV to be Successful") + By("Update the \"address\" CatalogSources's Spec.Address field with the PodIP of the replacement copied pod's PodIP") + By("Wait for the replacement CSV to be Successful") mainPackageName := genName("nginx-") dependentPackageName := genName("nginxdep-") @@ -504,7 +504,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { mainSourceName := genName("mock-ocs-main-") replacementSourceName := genName("mock-ocs-main-with-replacement-") - // Create separate manifests for each CatalogSource + By("Create separate manifests for each CatalogSource") mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -535,17 +535,17 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { }, } - // Create ConfigMap CatalogSources + By("Create ConfigMap CatalogSources") createInternalCatalogSource(c, crc, mainSourceName, generatedNamespace.GetName(), append(mainManifests, dependentManifests...), []apiextensionsv1.CustomResourceDefinition{dependentCRD}, []v1alpha1.ClusterServiceVersion{mainCSV, dependentCSV}) createInternalCatalogSource(c, crc, replacementSourceName, generatedNamespace.GetName(), append(replacementManifests, dependentManifests...), []apiextensionsv1.CustomResourceDefinition{dependentCRD}, []v1alpha1.ClusterServiceVersion{replacementCSV, mainCSV, dependentCSV}) - // Wait for ConfigMap CatalogSources to be ready + By("Wait for ConfigMap CatalogSources to be ready") mainSource, err := fetchCatalogSourceOnStatus(crc, mainSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ShouldNot(HaveOccurred()) replacementSource, err := fetchCatalogSourceOnStatus(crc, replacementSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ShouldNot(HaveOccurred()) - // Replicate catalog pods with no OwnerReferences + By("Replicate catalog pods with no OwnerReferences") mainCopy := replicateCatalogPod(c, mainSource) mainCopy = awaitPod(GinkgoT(), c, mainCopy.GetNamespace(), mainCopy.GetName(), hasPodIP) replacementCopy := replicateCatalogPod(c, replacementSource) @@ -553,7 +553,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { addressSourceName := genName("address-catalog-") - // Create a CatalogSource pointing to the grpc pod + By("Create a CatalogSource pointing to the grpc pod") addressSource := &v1alpha1.CatalogSource{ TypeMeta: metav1.TypeMeta{ Kind: v1alpha1.CatalogSourceKind, @@ -579,17 +579,17 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { Expect(err).ShouldNot(HaveOccurred()) }() - // Wait for the CatalogSource to be ready + By("Wait for the CatalogSource to be ready") _, err = fetchCatalogSourceOnStatus(crc, addressSource.GetName(), addressSource.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready") - // Delete CatalogSources + By("Delete CatalogSources") err = crc.OperatorsV1alpha1().CatalogSources(generatedNamespace.GetName()).Delete(context.Background(), mainSourceName, metav1.DeleteOptions{}) Expect(err).ShouldNot(HaveOccurred()) err = crc.OperatorsV1alpha1().CatalogSources(generatedNamespace.GetName()).Delete(context.Background(), replacementSourceName, metav1.DeleteOptions{}) Expect(err).ShouldNot(HaveOccurred()) - // Create Subscription + By("Create Subscription") subscriptionName := genName("sub-") cleanupSubscription := createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subscriptionName, addressSourceName, mainPackageName, stableChannel, "", v1alpha1.ApprovalAutomatic) defer cleanupSubscription() @@ -600,7 +600,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), subscription.Status.CurrentCSV, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Update the catalog's address to point at the other registry pod's cluster ip + By("Update the catalog's address to point at the other registry pod's cluster ip") Eventually(func() error { addressSource, err = crc.OperatorsV1alpha1().CatalogSources(generatedNamespace.GetName()).Get(context.Background(), addressSourceName, metav1.GetOptions{}) if err != nil { @@ -612,19 +612,19 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { return err }).Should(Succeed()) - // Wait for the replacement CSV to be installed + By("Wait for the replacement CSV to be installed") _, err = fetchCSV(crc, generatedNamespace.GetName(), replacementCSV.GetName(), csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) }) It("delete internal registry pod triggers recreation", func() { - // Create internal CatalogSource containing csv in package - // Wait for a registry pod to be created - // Delete the registry pod - // Wait for a new registry pod to be created + By("Create internal CatalogSource containing csv in package") + By("Wait for a registry pod to be created") + By("Delete the registry pod") + By("Wait for a new registry pod to be created") - // Create internal CatalogSource containing csv in package + By("Create internal CatalogSource containing csv in package") packageName := genName("nginx-") packageStable := fmt.Sprintf("%s-stable", packageName) stableChannel := "stable" @@ -653,7 +653,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { _, cleanupSource := createInternalCatalogSource(c, crc, sourceName, generatedNamespace.GetName(), manifests, []apiextensionsv1.CustomResourceDefinition{crd}, []v1alpha1.ClusterServiceVersion{csv}) defer cleanupSource() - // Wait for a new registry pod to be created + By("Wait for a new registry pod to be created") selector := labels.SelectorFromSet(map[string]string{"olm.catalogSource": sourceName}) singlePod := podCount(1) registryPods, err := awaitPods(GinkgoT(), c, generatedNamespace.GetName(), selector.String(), singlePod) @@ -661,16 +661,16 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { Expect(registryPods).ToNot(BeNil(), "nil registry pods") Expect(registryPods.Items).To(HaveLen(1), "unexpected number of registry pods found") - // Store the UID for later comparison + By("Store the UID for later comparison") uid := registryPods.Items[0].GetUID() - // Delete the registry pod + By("Delete the registry pod") Eventually(func() error { backgroundDeletion := metav1.DeletePropagationBackground return c.KubernetesInterface().CoreV1().Pods(generatedNamespace.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{PropagationPolicy: &backgroundDeletion}, metav1.ListOptions{LabelSelector: selector.String()}) }).Should(Succeed()) - // Wait for a new registry pod to be created + By("Wait for a new registry pod to be created") notUID := func(pods *corev1.PodList) bool { uids := make([]string, 0) for _, pod := range pods.Items { @@ -691,12 +691,12 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { It("delete gRPC registry pod triggers recreation", func() { - // Create gRPC CatalogSource using an external registry image (community-operators) - // Wait for a registry pod to be created - // Delete the registry pod - // Wait for a new registry pod to be created + By("Create gRPC CatalogSource using an external registry image (community-operators)") + By("Wait for a registry pod to be created") + By("Delete the registry pod") + By("Wait for a new registry pod to be created") - // Create gRPC CatalogSource using an external registry image (community-operators) + By("Create gRPC CatalogSource using an external registry image (community-operators)") source := &v1alpha1.CatalogSource{ TypeMeta: metav1.TypeMeta{ Kind: v1alpha1.CatalogSourceKind, @@ -718,7 +718,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { source, err := crc.OperatorsV1alpha1().CatalogSources(source.GetNamespace()).Create(context.Background(), source, metav1.CreateOptions{}) Expect(err).ShouldNot(HaveOccurred()) - // Wait for a new registry pod to be created + By("Wait for a new registry pod to be created") selector := labels.SelectorFromSet(map[string]string{"olm.catalogSource": source.GetName()}) singlePod := podCount(1) registryPods, err := awaitPods(GinkgoT(), c, source.GetNamespace(), selector.String(), singlePod) @@ -726,16 +726,16 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { Expect(registryPods).ToNot(BeNil(), "nil registry pods") Expect(registryPods.Items).To(HaveLen(1), "unexpected number of registry pods found") - // Store the UID for later comparison + By("Store the UID for later comparison") uid := registryPods.Items[0].GetUID() - // Delete the registry pod + By("Delete the registry pod") Eventually(func() error { backgroundDeletion := metav1.DeletePropagationBackground return c.KubernetesInterface().CoreV1().Pods(generatedNamespace.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{PropagationPolicy: &backgroundDeletion}, metav1.ListOptions{LabelSelector: selector.String()}) }).Should(Succeed()) - // Wait for a new registry pod to be created + By("Wait for a new registry pod to be created") notUID := func(pods *corev1.PodList) bool { uids := make([]string, 0) for _, pod := range pods.Items { @@ -786,9 +786,9 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { source, err = fetchCatalogSourceOnStatus(crc, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready") - // the gRPC endpoints are not exposed from the pod, and there's no simple way to get at them - - // the index images don't contain `grpcurl`, port-forwarding is a mess, etc. let's use the - // package-server as a proxy for a functional catalog + By("the gRPC endpoints are not exposed from the pod, and there's no simple way to get at them -") + By("the index images don't contain `grpcurl`, port-forwarding is a mess, etc. let's use the") + By("package-server as a proxy for a functional catalog") By("Waiting for packages from the catalog to show up in the Kubernetes API") Eventually(func() error { manifests, err := packageserverClient.OperatorsV1().PackageManifests("default").List(context.Background(), metav1.ListOptions{}) @@ -808,16 +808,16 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { } else if err != nil { Skip("Could not determine whether running in a kind cluster. Skipping.") } - // Create an image based catalog source from public Quay image - // Use a unique tag as identifier - // See https://quay.io/repository/olmtest/catsrc-update-test?namespace=olmtest for registry - // Push an updated version of the image with the same identifier - // Confirm catalog source polling feature is working as expected: a newer version of the catalog source pod comes up - // etcd operator updated from 0.9.0 to 0.9.2-clusterwide - // Subscription should detect the latest version of the operator in the new catalog source and pull it + By("Create an image based catalog source from public Quay image") + By("Use a unique tag as identifier") + By("See https://quay.io/repository/olmtest/catsrc-update-test?namespace=olmtest for registry") + By("Push an updated version of the image with the same identifier") + By("Confirm catalog source polling feature is working as expected: a newer version of the catalog source pod comes up") + By("etcd operator updated from 0.9.0 to 0.9.2-clusterwide") + By("Subscription should detect the latest version of the operator in the new catalog source and pull it") - // create internal registry for purposes of pushing/pulling IF running e2e test locally - // registry is insecure and for purposes of this test only + By("create internal registry for purposes of pushing/pulling IF running e2e test locally") + By("registry is insecure and for purposes of this test only") local, err := Local(c) Expect(err).NotTo(HaveOccurred(), "cannot determine if test running locally or on CI: %s", err) @@ -844,8 +844,8 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { Expect(err).NotTo(HaveOccurred(), "error getting openshift registry authentication: %s", err) } - // testImage is the name of the image used throughout the test - the image overwritten by skopeo - // the tag is generated randomly and appended to the end of the testImage + By("testImage is the name of the image used throughout the test - the image overwritten by skopeo") + By("the tag is generated randomly and appended to the end of the testImage") testImage := fmt.Sprint("docker://", registryURL, "/catsrc-update", ":") tag := genName("x") By("Generating a target test image name " + testImage + " with tag " + tag) @@ -914,7 +914,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { Expect(err).ShouldNot(HaveOccurred()) }() - // wait for new catalog source pod to be created + By("wait for new catalog source pod to be created") By("Wait for a new registry pod to be created") selector := labels.SelectorFromSet(map[string]string{"olm.catalogSource": source.GetName()}) singlePod := podCount(1) @@ -1053,13 +1053,13 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { }) It("Dependency has correct replaces field", func() { - // Create a CatalogSource that contains the busybox v1 and busybox-dependency v1 images - // Create a Subscription for busybox v1, which has a dependency on busybox-dependency v1. - // Wait for the busybox and busybox2 Subscriptions to succeed - // Wait for the CSVs to succeed - // Update the catalog to point to an image that contains the busybox v2 and busybox-dependency v2 images. - // Wait for the new Subscriptions to succeed and check if they include the new CSVs - // Wait for the CSVs to succeed and confirm that the have the correct Spec.Replaces fields. + By("Create a CatalogSource that contains the busybox v1 and busybox-dependency v1 images") + By("Create a Subscription for busybox v1, which has a dependency on busybox-dependency v1.") + By("Wait for the busybox and busybox2 Subscriptions to succeed") + By("Wait for the CSVs to succeed") + By("Update the catalog to point to an image that contains the busybox v2 and busybox-dependency v2 images.") + By("Wait for the new Subscriptions to succeed and check if they include the new CSVs") + By("Wait for the CSVs to succeed and confirm that the have the correct Spec.Replaces fields.") sourceName := genName("catalog-") packageName := "busybox" @@ -1199,7 +1199,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { source, err := crc.OperatorsV1alpha1().CatalogSources(source.GetNamespace()).Create(context.Background(), source, metav1.CreateOptions{}) Expect(err).ToNot(HaveOccurred()) - // wait for new catalog source pod to be created and report ready + By("wait for new catalog source pod to be created and report ready") selector := labels.SelectorFromSet(map[string]string{"olm.catalogSource": source.GetName()}) catalogPods, err := awaitPods(GinkgoT(), c, source.GetNamespace(), selector.String(), singlePod) @@ -1224,14 +1224,14 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { }) It("registry polls on the correct interval", func() { - // Wait roughly the polling interval for update pod to show up + By("Wait roughly the polling interval for update pod to show up") updateSelector := labels.SelectorFromSet(map[string]string{"catalogsource.operators.coreos.com/update": source.GetName()}) updatePods, err := awaitPodsWithInterval(GinkgoT(), c, source.GetNamespace(), updateSelector.String(), 5*time.Second, 2*time.Minute, singlePod) Expect(err).ToNot(HaveOccurred()) Expect(updatePods).ToNot(BeNil()) Expect(updatePods.Items).To(HaveLen(1)) - // No update to image: update pod should be deleted quickly + By("No update to image: update pod should be deleted quickly") noPod := podCount(0) updatePods, err = awaitPodsWithInterval(GinkgoT(), c, source.GetNamespace(), updateSelector.String(), 1*time.Second, 30*time.Second, noPod) Expect(err).ToNot(HaveOccurred()) @@ -1331,9 +1331,9 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { }) It("adding catalog template adjusts image used", func() { - // This test attempts to create a catalog source, and update it with a template annotation - // and ensure that the image gets changed according to what's in the template as well as - // check the status conditions are updated accordingly + By("This test attempts to create a catalog source, and update it with a template annotation") + By("and ensure that the image gets changed according to what's in the template as well as") + By("check the status conditions are updated accordingly") sourceName := genName("catalog-") source := &v1alpha1.CatalogSource{ TypeMeta: metav1.TypeMeta{ @@ -1369,23 +1369,23 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { if err != nil { return err } - // create an annotation using the kube templates + By("create an annotation using the kube templates") source.SetAnnotations(map[string]string{ catalogsource.CatalogImageTemplateAnnotation: fmt.Sprintf("quay.io/olmtest/catsrc-update-test:%s.%s.%s", catalogsource.TemplKubeMajorV, catalogsource.TemplKubeMinorV, catalogsource.TemplKubePatchV), }) - // Update the catalog image + By("Update the catalog image") _, err = crc.OperatorsV1alpha1().CatalogSources(source.GetNamespace()).Update(context.Background(), source, metav1.UpdateOptions{}) return err }).Should(Succeed()) - // wait for status condition to show up + By("wait for status condition to show up") Eventually(func() (bool, error) { source, err = crc.OperatorsV1alpha1().CatalogSources(source.GetNamespace()).Get(context.Background(), sourceName, metav1.GetOptions{}) if err != nil { return false, err } - // if the conditions array has the entry we know things got updated + By("if the conditions array has the entry we know things got updated") condition := meta.FindStatusCondition(source.Status.Conditions, catalogtemplate.StatusTypeTemplatesHaveResolved) if condition != nil { return true, nil @@ -1394,7 +1394,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { return false, nil }).Should(BeTrue()) - // source should be the latest we got from the eventually block + By("source should be the latest we got from the eventually block") Expect(source.Status.Conditions).ToNot(BeNil()) templatesResolvedCondition := meta.FindStatusCondition(source.Status.Conditions, catalogtemplate.StatusTypeTemplatesHaveResolved) @@ -1407,7 +1407,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { Expect(resolvedImageCondition.Reason).To(BeIdenticalTo(catalogtemplate.ReasonAllTemplatesResolved)) Expect(resolvedImageCondition.Status).To(BeIdenticalTo(metav1.ConditionTrue)) - // if we can, try to determine the server version so we can check the resulting image + By("if we can, try to determine the server version so we can check the resulting image") if serverVersion, err := crc.Discovery().ServerVersion(); err != nil { if serverGitVersion, err := semver.Parse(serverVersion.GitVersion); err != nil { expectedImage := fmt.Sprintf("quay.io/olmtest/catsrc-update-test:%s.%s.%s", serverVersion.Major, serverVersion.Minor, strconv.FormatUint(serverGitVersion.Patch, 10)) @@ -1464,7 +1464,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { fetchedSubscription, err := crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Get(context.Background(), subscription.GetName(), metav1.GetOptions{}) g.Expect(err).NotTo(HaveOccurred()) - // expect the message that API missing + By("expect the message that API missing") failingCondition := fetchedSubscription.Status.GetCondition(v1alpha1.SubscriptionBundleUnpackFailed) return failingCondition.Message }).Should(ContainSubstring("missing APIVersion")) diff --git a/test/e2e/catalog_exclusion_test.go b/test/e2e/catalog_exclusion_test.go index 1d06e4641d..6372aac0de 100644 --- a/test/e2e/catalog_exclusion_test.go +++ b/test/e2e/catalog_exclusion_test.go @@ -69,12 +69,12 @@ var _ = Describe("Global Catalog Exclusion", func() { localCatalog, err = NewMagicCatalogFromFile(determinedE2eClient, generatedNamespace.GetName(), localCatalogName, fbcPath) Expect(err).To(Succeed()) - // deploy catalog blocks until the catalog has reached a ready state or fails + By("deploy catalog blocks until the catalog has reached a ready state or fails") Expect(localCatalog.DeployCatalog(context.Background())).To(Succeed()) By("checking that the global catalog is broken") - // Adding this check here to speed up the test - // the global catalog can fail while we wait for the local catalog to get to a ready state + By("Adding this check here to speed up the test") + By("the global catalog can fail while we wait for the local catalog to get to a ready state") EventuallyResource(globalCatalog).Should(HaveGrpcConnectionWithLastConnectionState(connectivity.TransientFailure)) }) diff --git a/test/e2e/catsrc_pod_config_e2e_test.go b/test/e2e/catsrc_pod_config_e2e_test.go index 49371bc686..a37f8ca69e 100644 --- a/test/e2e/catsrc_pod_config_e2e_test.go +++ b/test/e2e/catsrc_pod_config_e2e_test.go @@ -47,7 +47,7 @@ var _ = Describe("CatalogSource Grpc Pod Config", func() { BeforeEach(func() { client = ctx.Ctx().Client() - // must be a grpc source type with spec.image defined + By("must be a grpc source type with spec.image defined") catalogSource = &v1alpha1.CatalogSource{ ObjectMeta: metav1.ObjectMeta{ Name: catalogSourceName, @@ -64,10 +64,10 @@ var _ = Describe("CatalogSource Grpc Pod Config", func() { }) AfterEach(func() { - // assume the catalog source was created and just delete it + By("assume the catalog source was created and just delete it") _ = client.Delete(context.TODO(), catalogSource) - // wait for it to go away + By("wait for it to go away") Expect(waitForDelete(func() error { return client.Get(context.TODO(), k8scontrollerclient.ObjectKey{ Name: catalogSource.GetName(), @@ -79,14 +79,14 @@ var _ = Describe("CatalogSource Grpc Pod Config", func() { It("should override the pod's spec.priorityClassName", func() { var overridenPriorityClassName = "system-node-critical" - // create catalog source + By("create catalog source") catalogSource.Spec.GrpcPodConfig = &v1alpha1.GrpcPodConfig{ PriorityClassName: &overridenPriorityClassName, SecurityContextConfig: v1alpha1.Restricted, } mustCreateCatalogSource(client, catalogSource) - // Check overrides are present in the spec + By("Check overrides are present in the spec") catalogSourcePod := mustGetCatalogSourcePod(client, catalogSource) Expect(catalogSourcePod).ToNot(BeNil()) Expect(catalogSourcePod.Spec.NodeSelector).To(BeEquivalentTo(defaultNodeSelector)) @@ -97,14 +97,14 @@ var _ = Describe("CatalogSource Grpc Pod Config", func() { It("should override the pod's spec.priorityClassName when it is empty", func() { var overridenPriorityClassName = "" - // create catalog source + By("create catalog source") catalogSource.Spec.GrpcPodConfig = &v1alpha1.GrpcPodConfig{ PriorityClassName: &overridenPriorityClassName, SecurityContextConfig: v1alpha1.Restricted, } mustCreateCatalogSource(client, catalogSource) - // Check overrides are present in the spec + By("Check overrides are present in the spec") catalogSourcePod := mustGetCatalogSourcePod(client, catalogSource) Expect(catalogSourcePod).ToNot(BeNil()) Expect(catalogSourcePod.Spec.NodeSelector).To(BeEquivalentTo(defaultNodeSelector)) @@ -118,14 +118,14 @@ var _ = Describe("CatalogSource Grpc Pod Config", func() { "some": "tag", } - // create catalog source + By("create catalog source") catalogSource.Spec.GrpcPodConfig = &v1alpha1.GrpcPodConfig{ NodeSelector: overridenNodeSelector, SecurityContextConfig: v1alpha1.Restricted, } mustCreateCatalogSource(client, catalogSource) - // Check overrides are present in the spec + By("Check overrides are present in the spec") catalogSourcePod := mustGetCatalogSourcePod(client, catalogSource) Expect(catalogSourcePod).ToNot(BeNil()) Expect(catalogSourcePod.Spec.NodeSelector).To(BeEquivalentTo(overridenNodeSelector)) @@ -149,14 +149,14 @@ var _ = Describe("CatalogSource Grpc Pod Config", func() { }, } - // create catalog source + By("create catalog source") catalogSource.Spec.GrpcPodConfig = &v1alpha1.GrpcPodConfig{ Tolerations: overriddenTolerations, SecurityContextConfig: v1alpha1.Restricted, } mustCreateCatalogSource(client, catalogSource) - // Check overrides are present in the spec + By("Check overrides are present in the spec") catalogSourcePod := mustGetCatalogSourcePod(client, catalogSource) Expect(catalogSourcePod).ToNot(BeNil()) Expect(catalogSourcePod.Spec.NodeSelector).To(BeEquivalentTo(defaultNodeSelector)) diff --git a/test/e2e/crd_e2e_test.go b/test/e2e/crd_e2e_test.go index bb0fa51366..2cbfb30be2 100644 --- a/test/e2e/crd_e2e_test.go +++ b/test/e2e/crd_e2e_test.go @@ -82,7 +82,7 @@ var _ = Describe("CRD Versions", func() { }, } - // Create the catalog sources + By("Create the catalog sources") _, cleanupMainCatalogSource := createV1CRDInternalCatalogSource(GinkgoT(), c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{v1crd}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV}) defer cleanupMainCatalogSource() defer func() { @@ -90,7 +90,7 @@ var _ = Describe("CRD Versions", func() { _ = c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.TODO(), v1crd.GetName(), metav1.DeleteOptions{}) }() - // Attempt to get the catalog source before creating install plan + By("Attempt to get the catalog source before creating install plan") _, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred()) @@ -107,7 +107,7 @@ var _ = Describe("CRD Versions", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By("Wait for InstallPlan to be status: Complete before checking resource presence") fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) Expect(err).ToNot(HaveOccurred()) GinkgoT().Logf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase) @@ -220,7 +220,7 @@ var _ = Describe("CRD Versions", func() { }, } - // Create the catalog sources + By("Create the catalog sources") _, cleanupMainCatalogSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{oldCRD, newCRD}, []operatorsv1alpha1.ClusterServiceVersion{oldCSV, newCSV}) defer cleanupMainCatalogSource() defer func() { @@ -230,7 +230,7 @@ var _ = Describe("CRD Versions", func() { _ = c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.TODO(), newCRD.GetName(), metav1.DeleteOptions{}) }() - // Attempt to get the catalog source before creating install plan + By("Attempt to get the catalog source before creating install plan") _, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred()) @@ -246,15 +246,15 @@ var _ = Describe("CRD Versions", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By("Wait for InstallPlan to be status: Complete before checking resource presence") fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) Expect(err).ToNot(HaveOccurred()) GinkgoT().Logf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase) Expect(fetchedInstallPlan.Status.Phase).To(Equal(operatorsv1alpha1.InstallPlanPhaseComplete)) - // old CRD has been installed onto the cluster - now upgrade the subscription to point to the channel with the new CRD - // installing the new CSV should fail with a warning about data loss, since a storage version is missing in the new CRD - // use server-side apply to apply the update to the subscription point to the alpha channel + By("old CRD has been installed onto the cluster - now upgrade the subscription to point to the channel with the new CRD") + By("installing the new CSV should fail with a warning about data loss, since a storage version is missing in the new CRD") + By("use server-side apply to apply the update to the subscription point to the alpha channel") Eventually(Apply(subscription, func(s *operatorsv1alpha1.Subscription) error { s.Spec.Channel = alphaChannel return nil @@ -266,13 +266,13 @@ var _ = Describe("CRD Versions", func() { return checker(v) && v.Status.InstallPlanRef != nil && v.Status.InstallPlanRef.Name != fetchedInstallPlan.Name } - // fetch new subscription + By("fetch new subscription") s, err := fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionAtLatestWithDifferentInstallPlan) Expect(err).ToNot(HaveOccurred()) Expect(s).ToNot(BeNil()) Expect(s.Status.InstallPlanRef).ToNot(Equal(nil)) - // Check the error on the installplan - should be related to data loss and the CRD upgrade missing a stored version + By("Check the error on the installplan - should be related to data loss and the CRD upgrade missing a stored version") Eventually(func() (*operatorsv1alpha1.InstallPlan, error) { return crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Get(context.TODO(), s.Status.InstallPlanRef.Name, metav1.GetOptions{}) }).Should(And( @@ -291,15 +291,15 @@ var _ = Describe("CRD Versions", func() { )) }) - // Create a CRD on cluster with v1alpha1 (storage) - // Update that CRD with v1alpha2 (storage), v1alpha1 (served) - // Now the CRD should have two versions in status.storedVersions - // Now make a catalog with a CRD with just v1alpha2 (storage) - // That should fail because v1alpha1 is still in status.storedVersions - risk of data loss - // Update the CRD status to remove the v1alpha1 - // Now the installplan should succeed - It("allows a CRD upgrade that doesn't cause data loss", func() { + By(`Create a CRD on cluster with v1alpha1 (storage)`) + By(`Update that CRD with v1alpha2 (storage), v1alpha1 (served)`) + By(`Now the CRD should have two versions in status.storedVersions`) + By(`Now make a catalog with a CRD with just v1alpha2 (storage)`) + By(`That should fail because v1alpha1 is still in status.storedVersions - risk of data loss`) + By(`Update the CRD status to remove the v1alpha1`) + By(`Now the installplan should succeed`) + By("manually editing the storage versions in the existing CRD status") crdPlural := genName("ins-v1-") @@ -337,7 +337,7 @@ var _ = Describe("CRD Versions", func() { _, err := c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Create(context.TODO(), oldCRD, metav1.CreateOptions{}) Expect(err).ToNot(HaveOccurred(), "error creating old CRD") - // wrap CRD update in a poll because of the object has been modified related errors + By("wrap CRD update in a poll because of the object has been modified related errors") Eventually(func() error { oldCRD, err = c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), oldCRD.GetName(), metav1.GetOptions{}) if err != nil { @@ -345,9 +345,9 @@ var _ = Describe("CRD Versions", func() { } GinkgoT().Logf("old crd status stored versions: %#v", oldCRD.Status.StoredVersions) - // set v1alpha1 to no longer stored + By("set v1alpha1 to no longer stored") oldCRD.Spec.Versions[0].Storage = false - // update CRD on-cluster with a new version + By("update CRD on-cluster with a new version") oldCRD.Spec.Versions = append(oldCRD.Spec.Versions, apiextensionsv1.CustomResourceDefinitionVersion{ Name: "v1alpha2", Served: true, @@ -367,7 +367,7 @@ var _ = Describe("CRD Versions", func() { return nil }).Should(BeNil()) - // create CSV and catalog with just the catalog CRD + By("create CSV and catalog with just the catalog CRD") catalogCRD := apiextensionsv1.CustomResourceDefinition{ ObjectMeta: metav1.ObjectMeta{ Name: crdName, @@ -417,11 +417,11 @@ var _ = Describe("CRD Versions", func() { }, } - // Create the catalog sources + By("Create the catalog sources") _, cleanupMainCatalogSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{catalogCRD}, []operatorsv1alpha1.ClusterServiceVersion{catalogCSV}) defer cleanupMainCatalogSource() - // Attempt to get the catalog source before creating install plan + By("Attempt to get the catalog source before creating install plan") _, err = fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred()) @@ -434,7 +434,7 @@ var _ = Describe("CRD Versions", func() { Expect(subscription.Status.InstallPlanRef).ToNot(Equal(nil)) Expect(catalogCSV.GetName()).To(Equal(subscription.Status.CurrentCSV)) - // Check the error on the installplan - should be related to data loss and the CRD upgrade missing a stored version (v1alpha1) + By("Check the error on the installplan - should be related to data loss and the CRD upgrade missing a stored version (v1alpha1)") Eventually( func() (*operatorsv1alpha1.InstallPlan, error) { return crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Get(context.TODO(), subscription.Status.InstallPlanRef.Name, metav1.GetOptions{}) @@ -445,7 +445,7 @@ var _ = Describe("CRD Versions", func() { Equal(operatorsv1alpha1.InstallPlanPhaseFailed), )) - // update CRD status to remove the v1alpha1 stored version + By("update CRD status to remove the v1alpha1 stored version") newCRD, err := c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), oldCRD.GetName(), metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred(), "error getting new CRD") newCRD.Status.StoredVersions = []string{"v1alpha2"} @@ -453,18 +453,18 @@ var _ = Describe("CRD Versions", func() { Expect(err).ToNot(HaveOccurred(), "error updating new CRD") GinkgoT().Logf("new crd status stored versions: %#v", newCRD.Status.StoredVersions) // only v1alpha2 should be in the status now - // install should now succeed + By("install should now succeed") oldInstallPlanRef := subscription.Status.InstallPlanRef.Name err = crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Delete(context.TODO(), subscription.Status.InstallPlanRef.Name, metav1.DeleteOptions{}) Expect(err).ToNot(HaveOccurred(), "error deleting failed install plan") - // remove old subscription + By("remove old subscription") err = crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Delete(context.TODO(), subscription.GetName(), metav1.DeleteOptions{}) Expect(err).ToNot(HaveOccurred(), "error deleting old subscription") - // remove old csv + By("remove old csv") crc.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Delete(context.TODO(), mainPackageStable, metav1.DeleteOptions{}) Expect(err).ToNot(HaveOccurred(), "error deleting old subscription") - // recreate subscription + By("recreate subscription") subscriptionNameNew := genName("sub-nginx-update2-new-") _ = createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subscriptionNameNew, mainCatalogName, mainPackageName, stableChannel, "", operatorsv1alpha1.ApprovalAutomatic) @@ -474,14 +474,14 @@ var _ = Describe("CRD Versions", func() { Expect(subscription.Status.InstallPlanRef).ToNot(Equal(nil)) Expect(catalogCSV.GetName()).To(Equal(subscription.Status.CurrentCSV)) - // eventually the subscription should create a new install plan + By("eventually the subscription should create a new install plan") Eventually(func() bool { sub, _ := crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Get(context.TODO(), subscription.GetName(), metav1.GetOptions{}) GinkgoT().Logf("waiting for subscription %s to generate a new install plan...", subscription.GetName()) return sub.Status.InstallPlanRef.Name != oldInstallPlanRef }, 5*time.Minute, 10*time.Second).Should(BeTrue()) - // eventually the new installplan should succeed + By("eventually the new installplan should succeed") Eventually(func() bool { sub, _ := crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Get(context.TODO(), subscription.GetName(), metav1.GetOptions{}) ip, err := crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Get(context.TODO(), sub.Status.InstallPlanRef.Name, metav1.GetOptions{}) diff --git a/test/e2e/csv_e2e_test.go b/test/e2e/csv_e2e_test.go index f58f44ff3e..0d8e3e2abc 100644 --- a/test/e2e/csv_e2e_test.go +++ b/test/e2e/csv_e2e_test.go @@ -748,7 +748,7 @@ var _ = Describe("ClusterServiceVersion", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvPendingChecker) Expect(err).ShouldNot(HaveOccurred()) - // Shouldn't create deployment + By("Shouldn't create deployment") Consistently(func() bool { _, err := c.GetDeployment(generatedNamespace.GetName(), depName) return apierrors.IsNotFound(err) @@ -809,7 +809,7 @@ var _ = Describe("ClusterServiceVersion", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvPendingChecker) Expect(err).ShouldNot(HaveOccurred()) - // Shouldn't create deployment + By("Shouldn't create deployment") Consistently(func() bool { _, err := c.GetDeployment(generatedNamespace.GetName(), depName) return apierrors.IsNotFound(err) @@ -889,7 +889,7 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // Create dependency first (CRD) + By("Create dependency first (CRD)") cleanupCRD, err := createCRD(c, apiextensionsv1.CustomResourceDefinition{ ObjectMeta: metav1.ObjectMeta{ Name: crdName, @@ -928,7 +928,7 @@ var _ = Describe("ClusterServiceVersion", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvPendingChecker) Expect(err).ShouldNot(HaveOccurred()) - // Shouldn't create deployment + By("Shouldn't create deployment") Consistently(func() bool { _, err := c.GetDeployment(generatedNamespace.GetName(), depName) return apierrors.IsNotFound(err) @@ -987,7 +987,7 @@ var _ = Describe("ClusterServiceVersion", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvPendingChecker) Expect(err).ShouldNot(HaveOccurred()) - // Shouldn't create deployment + By("Shouldn't create deployment") Consistently(func() bool { _, err := c.GetDeployment(generatedNamespace.GetName(), depName) return apierrors.IsNotFound(err) @@ -1052,7 +1052,7 @@ var _ = Describe("ClusterServiceVersion", func() { }, }, InstallStrategy: newNginxInstallStrategy(depName, permissions, clusterPermissions), - // Cheating a little; this is an APIservice that will exist for the e2e tests + // "Cheating a little; this is an APIservice that will exist for the e2e tests" APIServiceDefinitions: operatorsv1alpha1.APIServiceDefinitions{ Required: []operatorsv1alpha1.APIServiceDescription{ { @@ -1074,7 +1074,7 @@ var _ = Describe("ClusterServiceVersion", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvPendingChecker) Expect(err).ShouldNot(HaveOccurred()) - // Shouldn't create deployment + By("Shouldn't create deployment") Consistently(func() bool { _, err := c.GetDeployment(generatedNamespace.GetName(), depName) return apierrors.IsNotFound(err) @@ -1123,7 +1123,7 @@ var _ = Describe("ClusterServiceVersion", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvPendingChecker) Expect(err).ShouldNot(HaveOccurred()) - // Shouldn't create deployment + By("Shouldn't create deployment") Consistently(func() bool { _, err := c.GetDeployment(generatedNamespace.GetName(), depName) return apierrors.IsNotFound(err) @@ -1209,7 +1209,7 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // Create CSV first, knowing it will fail + By("Create CSV first, knowing it will fail") cleanupCSV, err := createCSV(c, crc, csv, generatedNamespace.GetName(), true, false) Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV() @@ -1267,7 +1267,7 @@ var _ = Describe("ClusterServiceVersion", func() { defer cleanupCRD() Expect(err).ShouldNot(HaveOccurred()) - // Create Role/Cluster Roles and RoleBindings + By("Create Role/Cluster Roles and RoleBindings") role := rbacv1.Role{ Rules: []rbacv1.PolicyRule{ { @@ -1366,7 +1366,7 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred(), "could not create ClusterRoleBinding") ctx.Ctx().Logf("checking for deployment") - // Poll for deployment to be ready + By("Poll for deployment to be ready") Eventually(func() (bool, error) { dep, err := c.GetDeployment(generatedNamespace.GetName(), depName) if apierrors.IsNotFound(err) { @@ -1389,19 +1389,19 @@ var _ = Describe("ClusterServiceVersion", func() { fetchedCSV, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Delete CRD + By("Delete CRD") cleanupCRD() - // Wait for CSV failure + By("Wait for CSV failure") fetchedCSV, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvPendingChecker) Expect(err).ShouldNot(HaveOccurred()) - // Recreate the CRD + By("Recreate the CRD") cleanupCRD, err = createCRD(c, crd) Expect(err).ShouldNot(HaveOccurred()) defer cleanupCRD() - // Wait for CSV success again + By("Wait for CSV success again") fetchedCSV, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) }) @@ -1469,7 +1469,7 @@ var _ = Describe("ClusterServiceVersion", func() { }, }, InstallStrategy: newNginxInstallStrategy(depName, permissions, clusterPermissions), - // Cheating a little; this is an APIservice that will exist for the e2e tests + // "Cheating a little; this is an APIservice that will exist for the e2e tests" APIServiceDefinitions: operatorsv1alpha1.APIServiceDefinitions{ Required: []operatorsv1alpha1.APIServiceDescription{ { @@ -1484,7 +1484,7 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // Create Role/Cluster Roles and RoleBindings + By("Create Role/Cluster Roles and RoleBindings") role := rbacv1.Role{ Rules: []rbacv1.PolicyRule{ { @@ -1558,7 +1558,7 @@ var _ = Describe("ClusterServiceVersion", func() { fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Fetch cluster service version again to check for unnecessary control loops + By("Fetch cluster service version again to check for unnecessary control loops") sameCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) Expect(equality.Semantic.DeepEqual(fetchedCSV, sameCSV)).Should(BeTrue(), diff.ObjectDiff(fetchedCSV, sameCSV)) @@ -1573,7 +1573,7 @@ var _ = Describe("ClusterServiceVersion", func() { depSpec := newMockExtServerDeployment(depName, []mockGroupVersionKind{{depName, mockGroupVersion, mockKinds, 5443}}) apiServiceName := strings.Join([]string{version, mockGroup}, ".") - // Create CSV for the package-server + By("Create CSV for the package-server") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -1629,7 +1629,7 @@ var _ = Describe("ClusterServiceVersion", func() { } csv.SetName(depName) - // Create the APIService CSV + By("Create the APIService CSV") cleanupCSV, err := createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) defer func() { @@ -1660,45 +1660,45 @@ var _ = Describe("ClusterServiceVersion", func() { fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should create Deployment + By("Should create Deployment") dep, err := c.GetDeployment(generatedNamespace.GetName(), depName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Deployment") - // Should create APIService + By("Should create APIService") apiService, err := c.GetAPIService(apiServiceName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected APIService") - // Should create Service + By("Should create Service") serviceName := fmt.Sprintf("%s-service", depName) _, err = c.GetService(generatedNamespace.GetName(), serviceName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Service") - // Should create certificate Secret + By("Should create certificate Secret") secretName := fmt.Sprintf("%s-cert", serviceName) _, err = c.GetSecret(generatedNamespace.GetName(), secretName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Secret") - // Should create a Role for the Secret + By("Should create a Role for the Secret") _, err = c.GetRole(generatedNamespace.GetName(), secretName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Secret Role") - // Should create a RoleBinding for the Secret + By("Should create a RoleBinding for the Secret") _, err = c.GetRoleBinding(generatedNamespace.GetName(), secretName) Expect(err).ShouldNot(HaveOccurred(), "error getting exptected Secret RoleBinding") - // Should create a system:auth-delegator Cluster RoleBinding + By("Should create a system:auth-delegator Cluster RoleBinding") _, err = c.GetClusterRoleBinding(fmt.Sprintf("%s-system:auth-delegator", serviceName)) Expect(err).ShouldNot(HaveOccurred(), "error getting expected system:auth-delegator ClusterRoleBinding") - // Should create an extension-apiserver-authentication-reader RoleBinding in kube-system + By("Should create an extension-apiserver-authentication-reader RoleBinding in kube-system") _, err = c.GetRoleBinding("kube-system", fmt.Sprintf("%s-auth-reader", serviceName)) Expect(err).ShouldNot(HaveOccurred(), "error getting expected extension-apiserver-authentication-reader RoleBinding") - // Store the ca sha annotation + By("Store the ca sha annotation") oldCAAnnotation, ok := dep.Spec.Template.GetAnnotations()[install.OLMCAHashAnnotationKey] Expect(ok).Should(BeTrue(), "expected olm sha annotation not present on existing pod template") - // Induce a cert rotation + By("Induce a cert rotation") Eventually(Apply(fetchedCSV, func(csv *operatorsv1alpha1.ClusterServiceVersion) error { now := metav1.Now() csv.Status.CertsLastUpdated = &now @@ -1707,13 +1707,13 @@ var _ = Describe("ClusterServiceVersion", func() { })).Should(Succeed()) _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, func(csv *operatorsv1alpha1.ClusterServiceVersion) bool { - // Should create deployment + By("Should create deployment") dep, err = c.GetDeployment(generatedNamespace.GetName(), depName) if err != nil { return false } - // Should have a new ca hash annotation + By("Should have a new ca hash annotation") newCAAnnotation, ok := dep.Spec.Template.GetAnnotations()[install.OLMCAHashAnnotationKey] if !ok { ctx.Ctx().Logf("expected olm sha annotation not present in new pod template") @@ -1721,7 +1721,7 @@ var _ = Describe("ClusterServiceVersion", func() { } if newCAAnnotation != oldCAAnnotation { - // Check for success + By("Check for success") return csvSucceededChecker(csv) } @@ -1729,16 +1729,16 @@ var _ = Describe("ClusterServiceVersion", func() { }) Expect(err).ShouldNot(HaveOccurred(), "failed to rotate cert") - // Get the APIService UID + By("Get the APIService UID") oldAPIServiceUID := apiService.GetUID() - // Delete the APIService + By("Delete the APIService") err = c.DeleteAPIService(apiServiceName, &metav1.DeleteOptions{}) Expect(err).ShouldNot(HaveOccurred()) - // Wait for CSV success + By("Wait for CSV success") fetchedCSV, err = fetchCSV(crc, generatedNamespace.GetName(), csv.GetName(), func(csv *operatorsv1alpha1.ClusterServiceVersion) bool { - // Should create an APIService + By("Should create an APIService") apiService, err := c.GetAPIService(apiServiceName) if err != nil { return false @@ -1761,7 +1761,7 @@ var _ = Describe("ClusterServiceVersion", func() { depSpec := newMockExtServerDeployment(depName, []mockGroupVersionKind{{depName, mockGroupVersion, mockKinds, 5443}}) apiServiceName := strings.Join([]string{version, mockGroup}, ".") - // Create CSVs for the hat-server + By("Create CSVs for the hat-server") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -1817,48 +1817,48 @@ var _ = Describe("ClusterServiceVersion", func() { } csv.SetName("csv-hat-1") - // Create the APIService CSV + By("Create the APIService CSV") _, err := createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should create Deployment + By("Should create Deployment") _, err = c.GetDeployment(generatedNamespace.GetName(), depName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Deployment") - // Should create APIService + By("Should create APIService") _, err = c.GetAPIService(apiServiceName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected APIService") - // Should create Service + By("Should create Service") serviceName := fmt.Sprintf("%s-service", depName) _, err = c.GetService(generatedNamespace.GetName(), serviceName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Service") - // Should create certificate Secret + By("Should create certificate Secret") secretName := fmt.Sprintf("%s-cert", serviceName) _, err = c.GetSecret(generatedNamespace.GetName(), secretName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Secret") - // Should create a Role for the Secret + By("Should create a Role for the Secret") _, err = c.GetRole(generatedNamespace.GetName(), secretName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Secret Role") - // Should create a RoleBinding for the Secret + By("Should create a RoleBinding for the Secret") _, err = c.GetRoleBinding(generatedNamespace.GetName(), secretName) Expect(err).ShouldNot(HaveOccurred(), "error getting exptected Secret RoleBinding") - // Should create a system:auth-delegator Cluster RoleBinding + By("Should create a system:auth-delegator Cluster RoleBinding") _, err = c.GetClusterRoleBinding(fmt.Sprintf("%s-system:auth-delegator", serviceName)) Expect(err).ShouldNot(HaveOccurred(), "error getting expected system:auth-delegator ClusterRoleBinding") - // Should create an extension-apiserver-authentication-reader RoleBinding in kube-system + By("Should create an extension-apiserver-authentication-reader RoleBinding in kube-system") _, err = c.GetRoleBinding("kube-system", fmt.Sprintf("%s-auth-reader", serviceName)) Expect(err).ShouldNot(HaveOccurred(), "error getting expected extension-apiserver-authentication-reader RoleBinding") - // Create a new CSV that owns the same API Service and replace the old CSV + By("Create a new CSV that owns the same API Service and replace the old CSV") csv2 := operatorsv1alpha1.ClusterServiceVersion{ Spec: operatorsv1alpha1.ClusterServiceVersionSpec{ Replaces: csv.Name, @@ -1892,7 +1892,7 @@ var _ = Describe("ClusterServiceVersion", func() { } csv2.SetName("csv-hat-2") - // Create CSV2 to replace CSV + By("Create CSV2 to replace CSV") cleanupCSV2, err := createCSV(c, crc, csv2, generatedNamespace.GetName(), false, true) Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV2() @@ -1900,61 +1900,61 @@ var _ = Describe("ClusterServiceVersion", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv2.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should create Deployment + By("Should create Deployment") _, err = c.GetDeployment(generatedNamespace.GetName(), depName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Deployment") - // Should create APIService + By("Should create APIService") _, err = c.GetAPIService(apiServiceName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected APIService") - // Should create Service + By("Should create Service") Eventually(func() error { _, err := c.GetService(generatedNamespace.GetName(), serviceName) return err }, timeout, interval).ShouldNot(HaveOccurred()) - // Should create certificate Secret + By("Should create certificate Secret") secretName = fmt.Sprintf("%s-cert", serviceName) Eventually(func() error { _, err = c.GetSecret(generatedNamespace.GetName(), secretName) return err }, timeout, interval).ShouldNot(HaveOccurred()) - // Should create a Role for the Secret + By("Should create a Role for the Secret") _, err = c.GetRole(generatedNamespace.GetName(), secretName) Eventually(func() error { _, err = c.GetRole(generatedNamespace.GetName(), secretName) return err }, timeout, interval).ShouldNot(HaveOccurred()) - // Should create a RoleBinding for the Secret + By("Should create a RoleBinding for the Secret") Eventually(func() error { _, err = c.GetRoleBinding(generatedNamespace.GetName(), secretName) return err }, timeout, interval).ShouldNot(HaveOccurred()) - // Should create a system:auth-delegator Cluster RoleBinding + By("Should create a system:auth-delegator Cluster RoleBinding") Eventually(func() error { _, err = c.GetClusterRoleBinding(fmt.Sprintf("%s-system:auth-delegator", serviceName)) return err }, timeout, interval).ShouldNot(HaveOccurred()) - // Should create an extension-apiserver-authentication-reader RoleBinding in kube-system + By("Should create an extension-apiserver-authentication-reader RoleBinding in kube-system") Eventually(func() error { _, err = c.GetRoleBinding("kube-system", fmt.Sprintf("%s-auth-reader", serviceName)) return err }, timeout, interval).ShouldNot(HaveOccurred()) Expect(err).ShouldNot(HaveOccurred(), "error getting expected extension-apiserver-authentication-reader RoleBinding") - // Should eventually GC the CSV + By("Should eventually GC the CSV") err = waitForCsvToDelete(generatedNamespace.GetName(), csv.Name, crc) Expect(err).ShouldNot(HaveOccurred()) - // Rename the initial CSV + By("Rename the initial CSV") csv.SetName("csv-hat-3") - // Recreate the old CSV + By("Recreate the old CSV") cleanupCSV, err := createCSV(c, crc, csv, generatedNamespace.GetName(), false, true) Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV() @@ -1965,7 +1965,7 @@ var _ = Describe("ClusterServiceVersion", func() { }) It("create same CSV with owned API service multi namespace", func() { - // Create new namespace in a new operator group + By("Create new namespace in a new operator group") secondNamespaceName := genName(generatedNamespace.GetName() + "-") matchingLabel := map[string]string{"inGroup": secondNamespaceName} @@ -1981,7 +1981,7 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) }() - // Create a new operator group for the new namespace + By("Create a new operator group for the new namespace") operatorGroup := operatorsv1.OperatorGroup{ ObjectMeta: metav1.ObjectMeta{ Name: genName("e2e-operator-group-"), @@ -2017,7 +2017,7 @@ var _ = Describe("ClusterServiceVersion", func() { depSpec := newMockExtServerDeployment(depName, []mockGroupVersionKind{{depName, mockGroupVersion, mockKinds, 5443}}) apiServiceName := strings.Join([]string{version, mockGroup}, ".") - // Create CSVs for the hat-server + By("Create CSVs for the hat-server") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -2073,7 +2073,7 @@ var _ = Describe("ClusterServiceVersion", func() { } csv.SetName("csv-hat-1") - // Create the initial CSV + By("Create the initial CSV") cleanupCSV, err := createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV() @@ -2081,41 +2081,41 @@ var _ = Describe("ClusterServiceVersion", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should create Deployment + By("Should create Deployment") _, err = c.GetDeployment(generatedNamespace.GetName(), depName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Deployment") - // Should create APIService + By("Should create APIService") _, err = c.GetAPIService(apiServiceName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected APIService") - // Should create Service + By("Should create Service") serviceName := fmt.Sprintf("%s-service", depName) _, err = c.GetService(generatedNamespace.GetName(), serviceName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Service") - // Should create certificate Secret + By("Should create certificate Secret") secretName := fmt.Sprintf("%s-cert", serviceName) _, err = c.GetSecret(generatedNamespace.GetName(), secretName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Secret") - // Should create a Role for the Secret + By("Should create a Role for the Secret") _, err = c.GetRole(generatedNamespace.GetName(), secretName) Expect(err).ShouldNot(HaveOccurred(), "error getting expected Secret Role") - // Should create a RoleBinding for the Secret + By("Should create a RoleBinding for the Secret") _, err = c.GetRoleBinding(generatedNamespace.GetName(), secretName) Expect(err).ShouldNot(HaveOccurred(), "error getting exptected Secret RoleBinding") - // Should create a system:auth-delegator Cluster RoleBinding + By("Should create a system:auth-delegator Cluster RoleBinding") _, err = c.GetClusterRoleBinding(fmt.Sprintf("%s-system:auth-delegator", serviceName)) Expect(err).ShouldNot(HaveOccurred(), "error getting expected system:auth-delegator ClusterRoleBinding") - // Should create an extension-apiserver-authentication-reader RoleBinding in kube-system + By("Should create an extension-apiserver-authentication-reader RoleBinding in kube-system") _, err = c.GetRoleBinding("kube-system", fmt.Sprintf("%s-auth-reader", serviceName)) Expect(err).ShouldNot(HaveOccurred(), "error getting expected extension-apiserver-authentication-reader RoleBinding") - // Create a new CSV that owns the same API Service but in a different namespace + By("Create a new CSV that owns the same API Service but in a different namespace") csv2 := operatorsv1alpha1.ClusterServiceVersion{ Spec: operatorsv1alpha1.ClusterServiceVersionSpec{ MinKubeVersion: "0.0.0", @@ -2148,7 +2148,7 @@ var _ = Describe("ClusterServiceVersion", func() { } csv2.SetName("csv-hat-2") - // Create CSV2 to replace CSV + By("Create CSV2 to replace CSV") _, err = createCSV(c, crc, csv2, secondNamespaceName, false, true) Expect(err).ShouldNot(HaveOccurred()) @@ -2219,7 +2219,7 @@ var _ = Describe("ClusterServiceVersion", func() { <-deleted }) It("CSV annotations overwrite pod template annotations defined in a StrategyDetailsDeployment", func() { - // Create a StrategyDetailsDeployment that defines the `foo1` and `foo2` annotations on a pod template + By("Create a StrategyDetailsDeployment that defines the `foo1` and `foo2` annotations on a pod template") nginxName := genName("nginx-") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ @@ -2234,7 +2234,7 @@ var _ = Describe("ClusterServiceVersion", func() { "foo2": "bar2", } - // Create a CSV that defines the `foo1` and `foo3` annotations + By("Create a CSV that defines the `foo1` and `foo3` annotations") csv := operatorsv1alpha1.ClusterServiceVersion{ TypeMeta: metav1.TypeMeta{ Kind: operatorsv1alpha1.ClusterServiceVersionKind, @@ -2274,28 +2274,28 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // Create the CSV and make sure to clean it up + By("Create the CSV and make sure to clean it up") cleanupCSV, err := createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV() - // Wait for current CSV to succeed + By("Wait for current CSV to succeed") _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should have created deployment + By("Should have created deployment") dep, err := c.GetDeployment(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(dep).ShouldNot(BeNil()) - // Make sure that the pods annotations are correct + By("Make sure that the pods annotations are correct") annotations := dep.Spec.Template.Annotations Expect(annotations["foo1"]).Should(Equal("bar1")) Expect(annotations["foo2"]).Should(Equal("bar2")) Expect(annotations["foo3"]).Should(Equal("bar3")) }) It("Set labels for the Deployment created via the ClusterServiceVersion", func() { - // Create a StrategyDetailsDeployment that defines labels for Deployment inside + By("Create a StrategyDetailsDeployment that defines labels for Deployment inside") nginxName := genName("nginx-") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ @@ -2345,21 +2345,21 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // Create the CSV and make sure to clean it up + By("Create the CSV and make sure to clean it up") cleanupCSV, err := createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV() - // Wait for current CSV to succeed + By("Wait for current CSV to succeed") _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should have created deployment + By("Should have created deployment") dep, err := c.GetDeployment(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(dep).ShouldNot(BeNil()) - // Make sure that the deployment labels are correct + By("Make sure that the deployment labels are correct") labels := dep.GetLabels() Expect(labels["olm.owner"]).Should(Equal(csv.GetName())) Expect(labels["olm.owner.namespace"]).Should(Equal(generatedNamespace.GetName())) @@ -2368,7 +2368,7 @@ var _ = Describe("ClusterServiceVersion", func() { }) It("update same deployment name", func() { - // Create dependency first (CRD) + By("Create dependency first (CRD)") crdPlural := genName("ins") crdName := crdPlural + ".cluster.com" cleanupCRD, err := createCRD(c, apiextensionsv1.CustomResourceDefinition{ @@ -2400,7 +2400,7 @@ var _ = Describe("ClusterServiceVersion", func() { }, }) - // Create "current" CSV + By("Create current CSV") nginxName := genName("nginx-") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ @@ -2461,26 +2461,24 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // Don't need to cleanup this CSV, it will be deleted by the upgrade process + By("Don't need to cleanup this CSV, it will be deleted by the upgrade process") _, err = createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) - // Wait for current CSV to succeed + By("Wait for current CSV to succeed") _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should have created deployment + By("Should have created deployment") dep, err := c.GetDeployment(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(dep).ShouldNot(BeNil()) - // Create "updated" CSV + By("Create updated CSV with the same name but a different spec") strategyNew := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { - // Same name Name: strategy.DeploymentSpecs[0].Name, - // Different spec Spec: newNginxDeployment(nginxName), }, }, @@ -2538,28 +2536,28 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) defer cleanupNewCSV() - // Wait for updated CSV to succeed + By("Wait for updated CSV to succeed") fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csvNew.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should have updated existing deployment + By("Should have updated existing deployment") depUpdated, err := c.GetDeployment(generatedNamespace.GetName(), strategyNew.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(depUpdated).ShouldNot(BeNil()) Expect(strategyNew.DeploymentSpecs[0].Spec.Template.Spec.Containers[0].Name).Should(Equal(depUpdated.Spec.Template.Spec.Containers[0].Name)) - // Should eventually GC the CSV + By("Should eventually GC the CSV") err = waitForCsvToDelete(generatedNamespace.GetName(), csv.Name, crc) Expect(err).ShouldNot(HaveOccurred()) - // Fetch cluster service version again to check for unnecessary control loops + By("Fetch cluster service version again to check for unnecessary control loops") sameCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csvNew.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) Expect(equality.Semantic.DeepEqual(fetchedCSV, sameCSV)).Should(BeTrue(), diff.ObjectDiff(fetchedCSV, sameCSV)) }) It("update different deployment name", func() { - // Create dependency first (CRD) + By("Create dependency first (CRD)") crdPlural := genName("ins2") crdName := crdPlural + ".cluster.com" cleanupCRD, err := createCRD(c, apiextensionsv1.CustomResourceDefinition{ @@ -2593,7 +2591,7 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) defer cleanupCRD() - // create "current" CSV + By("create current CSV") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -2651,20 +2649,20 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // don't need to clean up this CSV, it will be deleted by the upgrade process + By("don't need to clean up this CSV, it will be deleted by the upgrade process") _, err = createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) - // Wait for current CSV to succeed + By("Wait for current CSV to succeed") _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should have created deployment + By("Should have created deployment") dep, err := c.GetDeployment(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(dep).ShouldNot(BeNil()) - // Create "updated" CSV + By("Create updated CSV") strategyNew := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -2726,29 +2724,29 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) defer cleanupNewCSV() - // Wait for updated CSV to succeed + By("Wait for updated CSV to succeed") fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csvNew.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Fetch cluster service version again to check for unnecessary control loops + By("Fetch cluster service version again to check for unnecessary control loops") sameCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csvNew.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) Expect(equality.Semantic.DeepEqual(fetchedCSV, sameCSV)).Should(BeTrue(), diff.ObjectDiff(fetchedCSV, sameCSV)) - // Should have created new deployment and deleted old + By("Should have created new deployment and deleted old") depNew, err := c.GetDeployment(generatedNamespace.GetName(), strategyNew.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(depNew).ShouldNot(BeNil()) err = waitForDeploymentToDelete(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name, c) Expect(err).ShouldNot(HaveOccurred()) - // Should eventually GC the CSV + By("Should eventually GC the CSV") err = waitForCsvToDelete(generatedNamespace.GetName(), csv.Name, crc) Expect(err).ShouldNot(HaveOccurred()) }) It("update multiple intermediates", func() { - // Create dependency first (CRD) + By("Create dependency first (CRD)") crdPlural := genName("ins3") crdName := crdPlural + ".cluster.com" cleanupCRD, err := createCRD(c, apiextensionsv1.CustomResourceDefinition{ @@ -2782,7 +2780,7 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) defer cleanupCRD() - // create "current" CSV + By("create current CSV") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -2840,20 +2838,20 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // don't need to clean up this CSV, it will be deleted by the upgrade process + By("don't need to clean up this CSV, it will be deleted by the upgrade process") _, err = createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) - // Wait for current CSV to succeed + By("Wait for current CSV to succeed") _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should have created deployment + By("Should have created deployment") dep, err := c.GetDeployment(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(dep).ShouldNot(BeNil()) - // Create "updated" CSV + By("Create updated CSV") strategyNew := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -2915,29 +2913,29 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) defer cleanupNewCSV() - // Wait for updated CSV to succeed + By("Wait for updated CSV to succeed") fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csvNew.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Fetch cluster service version again to check for unnecessary control loops + By("Fetch cluster service version again to check for unnecessary control loops") sameCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csvNew.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) Expect(equality.Semantic.DeepEqual(fetchedCSV, sameCSV)).Should(BeTrue(), diff.ObjectDiff(fetchedCSV, sameCSV)) - // Should have created new deployment and deleted old + By("Should have created new deployment and deleted old") depNew, err := c.GetDeployment(generatedNamespace.GetName(), strategyNew.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(depNew).ShouldNot(BeNil()) err = waitForDeploymentToDelete(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name, c) Expect(err).ShouldNot(HaveOccurred()) - // Should eventually GC the CSV + By("Should eventually GC the CSV") err = waitForCsvToDelete(generatedNamespace.GetName(), csv.Name, crc) Expect(err).ShouldNot(HaveOccurred()) }) It("update in place", func() { - // Create dependency first (CRD) + By("Create dependency first (CRD)") crdPlural := genName("ins") crdName := crdPlural + ".cluster.com" cleanupCRD, err := createCRD(c, apiextensionsv1.CustomResourceDefinition{ @@ -2969,7 +2967,7 @@ var _ = Describe("ClusterServiceVersion", func() { }, }) - // Create "current" CSV + By("Create current CSV") nginxName := genName("nginx-") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ @@ -3034,16 +3032,16 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV() - // Wait for current CSV to succeed + By("Wait for current CSV to succeed") fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should have created deployment + By("Should have created deployment") dep, err := c.GetDeployment(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(dep).ShouldNot(BeNil()) - // Create "updated" CSV + By("Create updated CSV") strategyNew := strategy strategyNew.DeploymentSpecs[0].Spec.Template.Spec.Containers = []corev1.Container{ { @@ -3058,7 +3056,7 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // Also set something outside the spec template - this should be ignored + By("Also set something outside the spec template - this should be ignored") var five int32 = 5 strategyNew.DeploymentSpecs[0].Spec.Replicas = &five @@ -3066,11 +3064,11 @@ var _ = Describe("ClusterServiceVersion", func() { fetchedCSV.Spec.InstallStrategy.StrategySpec = strategyNew - // Update CSV directly + By("Update CSV directly") _, err = crc.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Update(context.TODO(), fetchedCSV, metav1.UpdateOptions{}) Expect(err).ShouldNot(HaveOccurred()) - // wait for deployment spec to be updated + By("wait for deployment spec to be updated") Eventually(func() (string, error) { fetched, err := c.GetDeployment(generatedNamespace.GetName(), strategyNew.DeploymentSpecs[0].Name) if err != nil { @@ -3080,7 +3078,7 @@ var _ = Describe("ClusterServiceVersion", func() { return fetched.Spec.Template.Spec.Containers[0].Name, nil }).Should(Equal(strategyNew.DeploymentSpecs[0].Spec.Template.Spec.Containers[0].Name)) - // Wait for updated CSV to succeed + By("Wait for updated CSV to succeed") _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) @@ -3088,16 +3086,16 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) Expect(depUpdated).ShouldNot(BeNil()) - // Deployment should have changed even though the CSV is otherwise the same + By("Deployment should have changed even though the CSV is otherwise the same") Expect(strategyNew.DeploymentSpecs[0].Spec.Template.Spec.Containers[0].Name).Should(Equal(depUpdated.Spec.Template.Spec.Containers[0].Name)) Expect(strategyNew.DeploymentSpecs[0].Spec.Template.Spec.Containers[0].Image).Should(Equal(depUpdated.Spec.Template.Spec.Containers[0].Image)) - // Field updated even though template spec didn't change, because it was part of a template spec change as well + By("Field updated even though template spec didn't change, because it was part of a template spec change as well") Expect(*strategyNew.DeploymentSpecs[0].Spec.Replicas).Should(Equal(*depUpdated.Spec.Replicas)) }) It("update multiple version CRD", func() { - // Create initial CRD which has 2 versions: v1alpha1 & v1alpha2 + By("Create initial CRD which has 2 versions: v1alpha1 & v1alpha2") crdPlural := genName("ins4") crdName := crdPlural + ".cluster.com" cleanupCRD, err := createCRD(c, apiextensionsv1.CustomResourceDefinition{ @@ -3142,7 +3140,7 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) defer cleanupCRD() - // create initial deployment strategy + By("create initial deployment strategy") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -3154,7 +3152,7 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) - // First CSV with owning CRD v1alpha1 + By("First CSV with owning CRD v1alpha1") csv := operatorsv1alpha1.ClusterServiceVersion{ TypeMeta: metav1.TypeMeta{ Kind: operatorsv1alpha1.ClusterServiceVersionKind, @@ -3201,20 +3199,20 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // CSV will be deleted by the upgrade process later + By("CSV will be deleted by the upgrade process later") _, err = createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) - // Wait for current CSV to succeed + By("Wait for current CSV to succeed") _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should have created deployment + By("Should have created deployment") dep, err := c.GetDeployment(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(dep).ShouldNot(BeNil()) - // Create updated deployment strategy + By("Create updated deployment strategy") strategyNew := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -3226,7 +3224,7 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) - // Second CSV with owning CRD v1alpha1 and v1alpha2 + By("Second CSV with owning CRD v1alpha1 and v1alpha2") csvNew := operatorsv1alpha1.ClusterServiceVersion{ TypeMeta: metav1.TypeMeta{ Kind: operatorsv1alpha1.ClusterServiceVersionKind, @@ -3280,27 +3278,27 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // Create newly updated CSV + By("Create newly updated CSV") _, err = createCSV(c, crc, csvNew, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) - // Wait for updated CSV to succeed + By("Wait for updated CSV to succeed") fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csvNew.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Fetch cluster service version again to check for unnecessary control loops + By("Fetch cluster service version again to check for unnecessary control loops") sameCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csvNew.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) Expect(equality.Semantic.DeepEqual(fetchedCSV, sameCSV)).Should(BeTrue(), diff.ObjectDiff(fetchedCSV, sameCSV)) - // Should have created new deployment and deleted old one + By("Should have created new deployment and deleted old one") depNew, err := c.GetDeployment(generatedNamespace.GetName(), strategyNew.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(depNew).ShouldNot(BeNil()) err = waitForDeploymentToDelete(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name, c) Expect(err).ShouldNot(HaveOccurred()) - // Create updated deployment strategy + By("Create updated deployment strategy") strategyNew2 := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -3311,7 +3309,7 @@ var _ = Describe("ClusterServiceVersion", func() { } Expect(err).ShouldNot(HaveOccurred()) - // Third CSV with owning CRD v1alpha2 + By("Third CSV with owning CRD v1alpha2") csvNew2 := operatorsv1alpha1.ClusterServiceVersion{ TypeMeta: metav1.TypeMeta{ Kind: operatorsv1alpha1.ClusterServiceVersionKind, @@ -3358,35 +3356,35 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // Create newly updated CSV + By("Create newly updated CSV") cleanupNewCSV, err := createCSV(c, crc, csvNew2, generatedNamespace.GetName(), true, false) Expect(err).ShouldNot(HaveOccurred()) defer cleanupNewCSV() - // Wait for updated CSV to succeed + By("Wait for updated CSV to succeed") fetchedCSV, err = fetchCSV(crc, generatedNamespace.GetName(), csvNew2.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Fetch cluster service version again to check for unnecessary control loops + By("Fetch cluster service version again to check for unnecessary control loops") sameCSV, err = fetchCSV(crc, generatedNamespace.GetName(), csvNew2.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) Expect(equality.Semantic.DeepEqual(fetchedCSV, sameCSV)).Should(BeTrue(), diff.ObjectDiff(fetchedCSV, sameCSV)) - // Should have created new deployment and deleted old one + By("Should have created new deployment and deleted old one") depNew, err = c.GetDeployment(generatedNamespace.GetName(), strategyNew2.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(depNew).ShouldNot(BeNil()) err = waitForDeploymentToDelete(generatedNamespace.GetName(), strategyNew.DeploymentSpecs[0].Name, c) Expect(err).ShouldNot(HaveOccurred()) - // Should clean up the CSV + By("Should clean up the CSV") err = waitForCsvToDelete(generatedNamespace.GetName(), csvNew.Name, crc) Expect(err).ShouldNot(HaveOccurred()) }) It("update modify deployment name", func() { - // Create dependency first (CRD) + By("Create dependency first (CRD)") crdPlural := genName("ins2") crdName := crdPlural + ".cluster.com" cleanupCRD, err := createCRD(c, apiextensionsv1.CustomResourceDefinition{ @@ -3420,7 +3418,7 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) defer cleanupCRD() - // create "current" CSV + By("create current CSV") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -3485,11 +3483,11 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV() - // Wait for current CSV to succeed + By("Wait for current CSV to succeed") _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should have created deployments + By("Should have created deployments") dep, err := c.GetDeployment(generatedNamespace.GetName(), strategy.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(dep).ShouldNot(BeNil()) @@ -3497,7 +3495,7 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) Expect(dep2).ShouldNot(BeNil()) - // Create "updated" CSV + By("Create updated CSV") strategyNew := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -3513,31 +3511,31 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) - // Fetch the current csv + By("Fetch the current csv") fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Update csv with same strategy with different deployment's name + By("Update csv with same strategy with different deployment's name") fetchedCSV.Spec.InstallStrategy.StrategySpec = strategyNew - // Update the current csv with the new csv + By("Update the current csv with the new csv") _, err = crc.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Update(context.TODO(), fetchedCSV, metav1.UpdateOptions{}) Expect(err).ShouldNot(HaveOccurred()) - // Wait for new deployment to exist + By("Wait for new deployment to exist") _, err = waitForDeployment(generatedNamespace.GetName(), strategyNew.DeploymentSpecs[0].Name, c) Expect(err).ShouldNot(HaveOccurred()) - // Wait for updated CSV to succeed + By("Wait for updated CSV to succeed") _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Should have created new deployment and deleted old + By("Should have created new deployment and deleted old") depNew, err := c.GetDeployment(generatedNamespace.GetName(), strategyNew.DeploymentSpecs[0].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(depNew).ShouldNot(BeNil()) - // Make sure the unchanged deployment still exists + By("Make sure the unchanged deployment still exists") depNew2, err := c.GetDeployment(generatedNamespace.GetName(), strategyNew.DeploymentSpecs[1].Name) Expect(err).ShouldNot(HaveOccurred()) Expect(depNew2).ShouldNot(BeNil()) @@ -3656,13 +3654,11 @@ var _ = Describe("ClusterServiceVersion", func() { GinkgoT().Logf("Deployment container name: %v", dep.Spec.Template.Spec.Containers[0].Name) - By("Creating 'updated' CSV") + By("Creating 'updated' CSV with the same name but a different spec") strategyNew := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { - // Same name Name: strategy.DeploymentSpecs[0].Name, - // Different spec Spec: newNginxDeployment(nginxName), }, }, @@ -3684,7 +3680,7 @@ var _ = Describe("ClusterServiceVersion", func() { Eventually(func() error { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, func(csv *operatorsv1alpha1.ClusterServiceVersion) bool { - // Should have updated existing deployment + By("Should have updated existing deployment") depUpdated, err := c.GetDeployment(generatedNamespace.GetName(), strategyNew.DeploymentSpecs[0].Name) if err != nil { GinkgoT().Logf("error getting deployment %s/%s: %v", generatedNamespace.GetName(), strategyNew.DeploymentSpecs[0].Name, err) @@ -3694,7 +3690,7 @@ var _ = Describe("ClusterServiceVersion", func() { return false } - // container name has been updated and differs from initial CSV spec and updated CSV spec + By("container name has been updated and differs from initial CSV spec and updated CSV spec") if depUpdated.Spec.Template.Spec.Containers[0].Name != strategyNew.DeploymentSpecs[0].Spec.Template.Spec.Containers[0].Name { return false } @@ -3703,7 +3699,7 @@ var _ = Describe("ClusterServiceVersion", func() { nameMatchesPrinted = true } - // Check for success + By("Check for success") return csvSucceededChecker(csv) }) return err @@ -3711,6 +3707,7 @@ var _ = Describe("ClusterServiceVersion", func() { }) It("emits CSV requirement events", func() { + By("Require an API that we know won't exist under our domain") csv := &operatorsv1alpha1.ClusterServiceVersion{ Spec: operatorsv1alpha1.ClusterServiceVersionSpec{ MinKubeVersion: "0.0.0", @@ -3734,7 +3731,6 @@ var _ = Describe("ClusterServiceVersion", func() { }, InstallStrategy: newNginxInstallStrategy(genName("dep-"), nil, nil), APIServiceDefinitions: operatorsv1alpha1.APIServiceDefinitions{ - // Require an API that we know won't exist under our domain Required: []operatorsv1alpha1.APIServiceDescription{ { Group: "bad.packages.operators.coreos.com", @@ -3755,7 +3751,7 @@ var _ = Describe("ClusterServiceVersion", func() { events, err := c.KubernetesInterface().CoreV1().Events(csv.GetNamespace()).List(clientCtx, listOpts) Expect(err).ToNot(HaveOccurred()) - // Watch latest events from test namespace for CSV + By("Watch latest events from test namespace for CSV") listOpts.ResourceVersion = events.ResourceVersion w, err := c.KubernetesInterface().CoreV1().Events(generatedNamespace.GetName()).Watch(context.Background(), listOpts) Expect(err).ToNot(HaveOccurred()) @@ -3774,7 +3770,7 @@ var _ = Describe("ClusterServiceVersion", func() { } Eventually(nextReason).Should(Equal("RequirementsNotMet")) - // Patch the CSV to require an API that we know exists + By("Patch the CSV to require an API that we know exists") Eventually(ctx.Ctx().SSAClient().Apply(clientCtx, csv, func(c *operatorsv1alpha1.ClusterServiceVersion) error { c.Spec.APIServiceDefinitions.Required[0].Group = "packages.operators.coreos.com" return nil @@ -3787,7 +3783,7 @@ var _ = Describe("ClusterServiceVersion", func() { // TODO: test behavior when replaces field doesn't point to existing CSV It("status invalid CSV", func() { - // Create CRD + By("Create CRD") crdPlural := genName("ins") crdName := crdPlural + ".cluster.com" cleanupCRD, err := createCRD(c, apiextensionsv1.CustomResourceDefinition{ @@ -3821,7 +3817,7 @@ var _ = Describe("ClusterServiceVersion", func() { Expect(err).ShouldNot(HaveOccurred()) defer cleanupCRD() - // create CSV + By("create CSV") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -3916,7 +3912,7 @@ var _ = Describe("ClusterServiceVersion", func() { depSpec := newMockExtServerDeployment(depName, []mockGroupVersionKind{{depName, mockGroupVersion, mockKinds, 5443}}) apiServiceName := strings.Join([]string{version, mockGroup}, ".") - // Create CSVs for the hat-server + By("Create CSVs for the hat-server") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -3975,7 +3971,7 @@ var _ = Describe("ClusterServiceVersion", func() { createLegacyAPIResources(generatedNamespace.GetName(), &csv, owned[0], c) - // Create the APIService CSV + By("Create the APIService CSV") cleanupCSV, err := createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV() @@ -3996,7 +3992,7 @@ var _ = Describe("ClusterServiceVersion", func() { depSpec := newMockExtServerDeployment(depName, []mockGroupVersionKind{{depName, mockGroupVersion, mockKinds, 5443}}) apiServiceName := strings.Join([]string{version, mockGroup}, ".") - // Create CSVs for the hat-server + By("Create CSVs for the hat-server") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -4055,7 +4051,7 @@ var _ = Describe("ClusterServiceVersion", func() { createLegacyAPIResources(generatedNamespace.GetName(), nil, owned[0], c) - // Create the APIService CSV + By("Create the APIService CSV") cleanupCSV, err := createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV() @@ -4065,16 +4061,16 @@ var _ = Describe("ClusterServiceVersion", func() { checkLegacyAPIResources(generatedNamespace.GetName(), owned[0], false, c) - // Cleanup the resources created for this test that were not cleaned up. + By("Cleanup the resources created for this test that were not cleaned up.") deleteLegacyAPIResources(generatedNamespace.GetName(), owned[0], c) }) It("multiple API services on a single pod", func() { - // Create the deployment that both APIServices will be deployed to. + By("Create the deployment that both APIServices will be deployed to.") depName := genName("hat-server") - // Define the expected mock APIService settings. + By("Define the expected mock APIService settings.") version := "v1alpha1" apiService1Group := fmt.Sprintf("hats.%s.redhat.com", genName("")) apiService1GroupVersion := strings.Join([]string{apiService1Group, version}, "/") @@ -4086,7 +4082,7 @@ var _ = Describe("ClusterServiceVersion", func() { apiService2Kinds := []string{"fez"} apiService2Name := strings.Join([]string{version, apiService2Group}, ".") - // Create the deployment spec with the two APIServices. + By("Create the deployment spec with the two APIServices.") mockGroupVersionKinds := []mockGroupVersionKind{ { depName, @@ -4103,7 +4099,7 @@ var _ = Describe("ClusterServiceVersion", func() { } depSpec := newMockExtServerDeployment(depName, mockGroupVersionKinds) - // Create the CSV. + By("Create the CSV.") strategy := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -4113,7 +4109,7 @@ var _ = Describe("ClusterServiceVersion", func() { }, } - // Update the owned APIServices two include the two APIServices. + By("Update the owned APIServices two include the two APIServices.") owned := []operatorsv1alpha1.APIServiceDescription{ { Name: apiService1Name, @@ -4170,7 +4166,7 @@ var _ = Describe("ClusterServiceVersion", func() { csv.SetName("csv-hat-1") csv.SetNamespace(generatedNamespace.GetName()) - // Create the APIService CSV + By("Create the APIService CSV") cleanupCSV, err := createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).ShouldNot(HaveOccurred()) defer cleanupCSV() @@ -4178,7 +4174,7 @@ var _ = Describe("ClusterServiceVersion", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).ShouldNot(HaveOccurred()) - // Check that the APIService caBundles are equal + By("Check that the APIService caBundles are equal") apiService1, err := c.GetAPIService(apiService1Name) Expect(err).ShouldNot(HaveOccurred()) diff --git a/test/e2e/deprecated_e2e_test.go b/test/e2e/deprecated_e2e_test.go index 1ae0658e09..49c618e2cb 100644 --- a/test/e2e/deprecated_e2e_test.go +++ b/test/e2e/deprecated_e2e_test.go @@ -77,12 +77,12 @@ var _ = Describe("Not found APIs", func() { errMessage := "api-server resource not found installing VerticalPodAutoscaler my.thing: GroupVersionKind " + "verticalpodautoscalers.autoscaling.k8s.io/v1, Kind=VerticalPodAutoscaler not found on the cluster" - // The IP sits in the Installing phase with the GVK missing error + By("The IP sits in the Installing phase with the GVK missing error") Eventually(func() (*operatorsv1alpha1.InstallPlan, error) { return ip, ctx.Ctx().Client().Get(context.Background(), client.ObjectKeyFromObject(ip), ip) }).Should(And(HavePhase(operatorsv1alpha1.InstallPlanPhaseInstalling), HaveMessage(errMessage))) - // Eventually the IP fails with the GVK missing error, after installplan retries, which is by default 1 minute. + By("Eventually the IP fails with the GVK missing error, after installplan retries, which is by default 1 minute.") Eventually(func() (*operatorsv1alpha1.InstallPlan, error) { return ip, ctx.Ctx().Client().Get(context.Background(), client.ObjectKeyFromObject(ip), ip) }, 2*time.Minute).Should(And(HavePhase(operatorsv1alpha1.InstallPlanPhaseFailed), HaveMessage(errMessage))) diff --git a/test/e2e/disabling_copied_csv_e2e_test.go b/test/e2e/disabling_copied_csv_e2e_test.go index f47678dd8c..ddb0a62aa9 100644 --- a/test/e2e/disabling_copied_csv_e2e_test.go +++ b/test/e2e/disabling_copied_csv_e2e_test.go @@ -111,7 +111,7 @@ var _ = Describe("Disabling copied CSVs", func() { return err } - // Exit early if copied CSVs are disabled. + By(`Exit early if copied CSVs are disabled.`) if !olmConfig.CopiedCSVsAreEnabled() { return nil } @@ -201,7 +201,7 @@ var _ = Describe("Disabling copied CSVs", func() { return err } - // Exit early if copied CSVs are enabled. + By(`Exit early if copied CSVs are enabled.`) if olmConfig.CopiedCSVsAreEnabled() { return nil } @@ -222,7 +222,7 @@ var _ = Describe("Disabling copied CSVs", func() { It("should have copied CSVs in all other Namespaces", func() { Eventually(func() error { - // find copied csvs... + By(`find copied csvs...`) requirement, err := k8slabels.NewRequirement(operatorsv1alpha1.CopiedLabelKey, selection.Equals, []string{csv.GetNamespace()}) if err != nil { return err diff --git a/test/e2e/dynamic_resource_e2e_test.go b/test/e2e/dynamic_resource_e2e_test.go index 72a258dadd..d315890587 100644 --- a/test/e2e/dynamic_resource_e2e_test.go +++ b/test/e2e/dynamic_resource_e2e_test.go @@ -48,7 +48,7 @@ var _ = Describe("Subscriptions create required objects from Catalogs", func() { BeforeEach(func() { - // Create CatalogSource + By("Create CatalogSource") catsrc = &v1alpha1.CatalogSource{ ObjectMeta: metav1.ObjectMeta{ Name: genName("dynamic-catalog-"), @@ -66,11 +66,11 @@ var _ = Describe("Subscriptions create required objects from Catalogs", func() { catsrc, err := crc.OperatorsV1alpha1().CatalogSources(catsrc.GetNamespace()).Create(context.TODO(), catsrc, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) - // Wait for the CatalogSource to be ready + By("Wait for the CatalogSource to be ready") _, err = fetchCatalogSourceOnStatus(crc, catsrc.GetName(), catsrc.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).NotTo(HaveOccurred()) - // Generate a Subscription + By("Generate a Subscription") subName = genName("dynamic-resources") cleanupSub = createSubscriptionForCatalog(crc, catsrc.GetNamespace(), subName, catsrc.GetName(), "etcd", "singlenamespace-alpha", "", v1alpha1.ApprovalAutomatic) @@ -78,12 +78,12 @@ var _ = Describe("Subscriptions create required objects from Catalogs", func() { AfterEach(func() { - // clean up subscription + By("clean up subscription") if cleanupSub != nil { cleanupSub() } - // Delete CatalogSource + By("Delete CatalogSource") if catsrc != nil { err := crc.OperatorsV1alpha1().CatalogSources(catsrc.GetNamespace()).Delete(context.TODO(), catsrc.GetName(), *deleteOpts) Expect(err).NotTo(HaveOccurred()) @@ -106,13 +106,13 @@ var _ = Describe("Subscriptions create required objects from Catalogs", func() { ip, err := waitForInstallPlan(crc, ipName, sub.GetNamespace(), buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseFailed, v1alpha1.InstallPlanPhaseComplete)) Expect(err).NotTo(HaveOccurred()) - // Ensure the InstallPlan contains the steps resolved from the bundle image + By("Ensure the InstallPlan contains the steps resolved from the bundle image") expectedSteps := map[registry.ResourceKey]struct{}{ {Name: "my-prometheusrule", Kind: "PrometheusRule"}: {}, {Name: "my-servicemonitor", Kind: "ServiceMonitor"}: {}, } - // Verify Resource steps match expected steps + By("Verify Resource steps match expected steps") for _, step := range ip.Status.Plan { key := registry.ResourceKey{ Name: step.Resource.Name, @@ -126,7 +126,7 @@ var _ = Describe("Subscriptions create required objects from Catalogs", func() { } Expect(len(expectedSteps)).To(BeZero(), "Resource steps do not match expected: %#v", expectedSteps) - // Confirm that the expected types exist + By("Confirm that the expected types exist") gvr := schema.GroupVersionResource{ Group: "monitoring.coreos.com", Version: "v1", diff --git a/test/e2e/gc_e2e_test.go b/test/e2e/gc_e2e_test.go index 1421b0d9e7..927844f095 100644 --- a/test/e2e/gc_e2e_test.go +++ b/test/e2e/gc_e2e_test.go @@ -77,7 +77,7 @@ var _ = Describe("Garbage collection for dependent resources", func() { }, } - // Create a CustomResourceDefinition + By(`Create a CustomResourceDefinition`) var err error Eventually(func() error { crd, err = kubeClient.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Create(context.Background(), crd, metav1.CreateOptions{}) @@ -91,7 +91,7 @@ var _ = Describe("Garbage collection for dependent resources", func() { }, } - // Create a ClusterRole for the crd + By(`Create a ClusterRole for the crd`) Eventually(func() error { cr, err = kubeClient.CreateClusterRole(cr) return err @@ -100,17 +100,17 @@ var _ = Describe("Garbage collection for dependent resources", func() { AfterEach(func() { - // Clean up cluster role + By(`Clean up cluster role`) IgnoreError(kubeClient.DeleteClusterRole(cr.GetName(), &metav1.DeleteOptions{})) - // Clean up CRD + By(`Clean up CRD`) IgnoreError(kubeClient.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), crd.GetName(), metav1.DeleteOptions{})) }) When("CustomResourceDefinition is deleted", func() { BeforeEach(func() { - // Delete CRD + By(`Delete CRD`) Eventually(func() bool { err := kubeClient.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), crd.GetName(), metav1.DeleteOptions{}) return apierrors.IsNotFound(err) @@ -147,7 +147,7 @@ var _ = Describe("Garbage collection for dependent resources", func() { VersionPriority: 1, }, } - // Create an API Service + By(`Create an API Service`) var err error Eventually(func() error { apiService, err = kubeClient.CreateAPIService(apiService) @@ -162,7 +162,7 @@ var _ = Describe("Garbage collection for dependent resources", func() { } Eventually(func() error { - // Create a ClusterRole + By(`Create a ClusterRole`) cr, err = kubeClient.CreateClusterRole(cr) return err }).Should(Succeed()) @@ -179,7 +179,7 @@ var _ = Describe("Garbage collection for dependent resources", func() { When("APIService is deleted", func() { BeforeEach(func() { - // Delete API service + By(`Delete API service`) Eventually(func() bool { err := kubeClient.DeleteAPIService(apiService.GetName(), &metav1.DeleteOptions{}) return apierrors.IsNotFound(err) @@ -221,7 +221,7 @@ var _ = Describe("Garbage collection for dependent resources", func() { ownerA = newCSV("ownera", generatedNamespace.GetName(), "", semver.MustParse("0.0.0"), nil, nil, nil) ownerB = newCSV("ownerb", generatedNamespace.GetName(), "", semver.MustParse("0.0.0"), nil, nil, nil) - // create all owners + By(`create all owners`) var err error Eventually(func() error { fetchedA, err = operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Create(context.Background(), &ownerA, metav1.CreateOptions{}) @@ -240,11 +240,11 @@ var _ = Describe("Garbage collection for dependent resources", func() { Data: map[string]string{}, } - // add owners + By(`add owners`) ownerutil.AddOwner(dependent, fetchedA, true, false) ownerutil.AddOwner(dependent, fetchedB, true, false) - // create ConfigMap dependent + By(`create ConfigMap dependent`) Eventually(func() error { _, err = kubeClient.KubernetesInterface().CoreV1().ConfigMaps(generatedNamespace.GetName()).Create(context.Background(), dependent, metav1.CreateOptions{}) return err @@ -257,13 +257,13 @@ var _ = Describe("Garbage collection for dependent resources", func() { When("removing one of the owner using 'Foreground' deletion policy", func() { BeforeEach(func() { - // delete ownerA in the foreground (to ensure any "blocking" dependents are deleted before ownerA) + By(`delete ownerA in the foreground (to ensure any "blocking" dependents are deleted before ownerA)`) Eventually(func() bool { err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Delete(context.Background(), fetchedA.GetName(), options) return apierrors.IsNotFound(err) }).Should(BeTrue()) - // wait for deletion of ownerA + By(`wait for deletion of ownerA`) Eventually(func() bool { _, err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Get(context.Background(), ownerA.GetName(), metav1.GetOptions{}) return apierrors.IsNotFound(err) @@ -282,25 +282,25 @@ var _ = Describe("Garbage collection for dependent resources", func() { When("removing both the owners using 'Foreground' deletion policy", func() { BeforeEach(func() { - // delete ownerA in the foreground (to ensure any "blocking" dependents are deleted before ownerA) + By(`delete ownerA in the foreground (to ensure any "blocking" dependents are deleted before ownerA)`) Eventually(func() bool { err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Delete(context.Background(), fetchedA.GetName(), options) return apierrors.IsNotFound(err) }).Should(BeTrue()) - // wait for deletion of ownerA + By(`wait for deletion of ownerA`) Eventually(func() bool { _, err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Get(context.Background(), ownerA.GetName(), metav1.GetOptions{}) return apierrors.IsNotFound(err) }).Should(BeTrue()) - // delete ownerB in the foreground (to ensure any "blocking" dependents are deleted before ownerB) + By(`delete ownerB in the foreground (to ensure any "blocking" dependents are deleted before ownerB)`) Eventually(func() bool { err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Delete(context.Background(), fetchedB.GetName(), options) return apierrors.IsNotFound(err) }).Should(BeTrue()) - // wait for deletion of ownerB + By(`wait for deletion of ownerB`) Eventually(func() bool { _, err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Get(context.Background(), ownerB.GetName(), metav1.GetOptions{}) return apierrors.IsNotFound(err) @@ -336,7 +336,7 @@ var _ = Describe("Garbage collection for dependent resources", func() { ) var installPlanRef string - // create catalog source + By(`create catalog source`) source := &v1alpha1.CatalogSource{ TypeMeta: metav1.TypeMeta{ Kind: v1alpha1.CatalogSourceKind, @@ -366,26 +366,26 @@ var _ = Describe("Garbage collection for dependent resources", func() { return nil }).Should(Succeed(), "could not create catalog source") - // Wait for the CatalogSource to be ready + By(`Wait for the CatalogSource to be ready`) _, err := fetchCatalogSourceOnStatus(operatorClient, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready") - // Create a Subscription for package + By(`Create a Subscription for package`) _ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic) - // Wait for the Subscription to succeed + By(`Wait for the Subscription to succeed`) sub, err := fetchSubscription(operatorClient, generatedNamespace.GetName(), subName, subscriptionStateAtLatestChecker()) Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status") installPlanRef = sub.Status.InstallPlanRef.Name - // Wait for the installplan to complete (5 minute timeout) + By(`Wait for the installplan to complete (5 minute timeout)`) _, err = fetchInstallPlan(GinkgoT(), operatorClient, installPlanRef, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete)) Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase") ctx.Ctx().Logf("install plan %s completed", installPlanRef) - // confirm extra bundle objects (secret and configmap) are installed + By(`confirm extra bundle objects (secret and configmap) are installed`) Eventually(func() error { _, err := kubeClient.GetSecret(generatedNamespace.GetName(), secretName) return err @@ -402,25 +402,25 @@ var _ = Describe("Garbage collection for dependent resources", func() { const csvName = "busybox.v2.0.0" BeforeEach(func() { - // Delete subscription first + By(`Delete subscription first`) Eventually(func() bool { err := operatorClient.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Delete(context.Background(), subName, metav1.DeleteOptions{}) return apierrors.IsNotFound(err) }).Should(BeTrue()) - // wait for deletion + By(`wait for deletion`) Eventually(func() bool { _, err := operatorClient.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Get(context.Background(), subName, metav1.GetOptions{}) return apierrors.IsNotFound(err) }).Should(BeTrue()) - // Delete CSV + By(`Delete CSV`) Eventually(func() bool { err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Delete(context.Background(), csvName, metav1.DeleteOptions{}) return apierrors.IsNotFound(err) }).Should(BeTrue()) - // wait for deletion + By(`wait for deletion`) Eventually(func() bool { _, err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Get(context.Background(), csvName, metav1.GetOptions{}) return apierrors.IsNotFound(err) @@ -428,7 +428,7 @@ var _ = Describe("Garbage collection for dependent resources", func() { }) It("OLM should delete the associated configmap and secret", func() { - // confirm extra bundle objects (secret and configmap) are no longer installed on the cluster + By(`confirm extra bundle objects (secret and configmap) are no longer installed on the cluster`) Eventually(func() bool { _, err := kubeClient.GetSecret(generatedNamespace.GetName(), secretName) return apierrors.IsNotFound(err) @@ -459,7 +459,7 @@ var _ = Describe("Garbage collection for dependent resources", func() { ) var installPlanRef string - // create catalog source + By(`create catalog source`) source := &v1alpha1.CatalogSource{ TypeMeta: metav1.TypeMeta{ Kind: v1alpha1.CatalogSourceKind, @@ -485,20 +485,20 @@ var _ = Describe("Garbage collection for dependent resources", func() { return err }).Should(Succeed(), "could not create catalog source") - // Wait for the CatalogSource to be ready + By(`Wait for the CatalogSource to be ready`) _, err = fetchCatalogSourceOnStatus(operatorClient, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready") - // Create a Subscription for package + By(`Create a Subscription for package`) _ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic) - // Wait for the Subscription to succeed + By(`Wait for the Subscription to succeed`) sub, err := fetchSubscription(operatorClient, generatedNamespace.GetName(), subName, subscriptionStateAtLatestChecker()) Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status") installPlanRef = sub.Status.InstallPlanRef.Name - // Wait for the installplan to complete (5 minute timeout) + By(`Wait for the installplan to complete (5 minute timeout)`) _, err = fetchInstallPlan(GinkgoT(), operatorClient, installPlanRef, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete)) Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase") @@ -518,28 +518,28 @@ var _ = Describe("Garbage collection for dependent resources", func() { BeforeEach(func() { Eventually(func() error { - // update subscription first + By(`update subscription first`) sub, err := operatorClient.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Get(context.Background(), subName, metav1.GetOptions{}) if err != nil { return fmt.Errorf("could not get subscription") } - // update channel on sub + By(`update channel on sub`) sub.Spec.Channel = upgradeChannelName _, err = operatorClient.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Update(context.Background(), sub, metav1.UpdateOptions{}) return err }).Should(Succeed(), "could not update subscription") - // Wait for the Subscription to succeed + By(`Wait for the Subscription to succeed`) sub, err := fetchSubscription(operatorClient, generatedNamespace.GetName(), subName, subscriptionStateAtLatestChecker()) Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status") installPlanRef = sub.Status.InstallPlanRef.Name - // Wait for the installplan to complete (5 minute timeout) + By(`Wait for the installplan to complete (5 minute timeout)`) _, err = fetchInstallPlan(GinkgoT(), operatorClient, installPlanRef, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete)) Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase") - // Ensure the new csv is installed + By(`Ensure the new csv is installed`) Eventually(func() error { _, err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Get(context.Background(), newCSVname, metav1.GetOptions{}) return err @@ -552,8 +552,8 @@ var _ = Describe("Garbage collection for dependent resources", func() { if err != nil { return "", err } - // check data in configmap to ensure it is the new data (configmap was updated in the newer bundle) - // new value in the configmap is "updated-very-much" + By(`check data in configmap to ensure it is the new data (configmap was updated in the newer bundle)`) + By(`new value in the configmap is "updated-very-much"`) return cfg.Data["special.how"], nil }).Should(Equal("updated-very-much")) ctx.Ctx().Logf("dependent successfully updated after csv owner was updated") @@ -577,7 +577,7 @@ var _ = Describe("Garbage collection for dependent resources", func() { ) var installPlanRef string - // create catalog source + By(`create catalog source`) source := &v1alpha1.CatalogSource{ TypeMeta: metav1.TypeMeta{ Kind: v1alpha1.CatalogSourceKind, @@ -603,20 +603,20 @@ var _ = Describe("Garbage collection for dependent resources", func() { return err }).Should(Succeed()) - // Wait for the CatalogSource to be ready + By(`Wait for the CatalogSource to be ready`) _, err = fetchCatalogSourceOnStatus(operatorClient, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready") - // Create a Subscription for package + By(`Create a Subscription for package`) _ = createSubscriptionForCatalog(operatorClient, source.GetNamespace(), subName, source.GetName(), packageName, channelName, "", v1alpha1.ApprovalAutomatic) - // Wait for the Subscription to succeed + By(`Wait for the Subscription to succeed`) sub, err := fetchSubscription(operatorClient, generatedNamespace.GetName(), subName, subscriptionStateAtLatestChecker()) Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status") installPlanRef = sub.Status.InstallPlanRef.Name - // Wait for the installplan to complete (5 minute timeout) + By(`Wait for the installplan to complete (5 minute timeout)`) _, err = fetchInstallPlan(GinkgoT(), operatorClient, installPlanRef, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete)) Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase") @@ -637,36 +637,36 @@ var _ = Describe("Garbage collection for dependent resources", func() { BeforeEach(func() { Eventually(func() error { - // update subscription first + By(`update subscription first`) sub, err := operatorClient.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Get(context.Background(), subName, metav1.GetOptions{}) if err != nil { return fmt.Errorf("could not get subscription") } - // update channel on sub + By(`update channel on sub`) sub.Spec.Channel = upgradeChannelName _, err = operatorClient.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Update(context.Background(), sub, metav1.UpdateOptions{}) return err }).Should(Succeed(), "could not update subscription") - // Wait for the Subscription to succeed + By(`Wait for the Subscription to succeed`) sub, err := fetchSubscription(operatorClient, generatedNamespace.GetName(), subName, subscriptionStateAtLatestChecker()) Expect(err).ToNot(HaveOccurred(), "could not get subscription at latest status") installPlanRef = sub.Status.InstallPlanRef.Name - // Wait for the installplan to complete (5 minute timeout) + By(`Wait for the installplan to complete (5 minute timeout)`) _, err = fetchInstallPlan(GinkgoT(), operatorClient, installPlanRef, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(v1alpha1.InstallPlanPhaseComplete)) Expect(err).ToNot(HaveOccurred(), "could not get installplan at complete phase") - // Ensure the new csv is installed + By(`Ensure the new csv is installed`) Eventually(func() error { _, err := operatorClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Get(context.Background(), newCSVname, metav1.GetOptions{}) return err }).Should(BeNil()) }) - // flake issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2626 It("[FLAKE] should have removed the old configmap and put the new configmap in place", func() { + By(`flake issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2626`) Eventually(func() bool { _, err := kubeClient.GetConfigMap(generatedNamespace.GetName(), configmapName) return apierrors.IsNotFound(err) diff --git a/test/e2e/installplan_e2e_test.go b/test/e2e/installplan_e2e_test.go index d4ffb1f765..ad52f2a542 100644 --- a/test/e2e/installplan_e2e_test.go +++ b/test/e2e/installplan_e2e_test.go @@ -397,11 +397,11 @@ var _ = Describe("Install Plan", func() { ) BeforeEach(func() { - // It's hard to reliably generate transient - // errors in an uninstrumented end-to-end - // test, so simulate it by constructing an - // error state that can be easily corrected - // during a test. + By(`It's hard to reliably generate transient`) + By(`errors in an uninstrumented end-to-end`) + By(`test, so simulate it by constructing an`) + By(`error state that can be easily corrected`) + By(`during a test.`) owned = &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Namespace: generatedNamespace.GetName(), @@ -699,7 +699,7 @@ var _ = Describe("Install Plan", func() { dependentCatalogName := genName("mock-ocs-dependent-") mainCatalogName := genName("mock-ocs-main-") - // Create separate manifests for each CatalogSource + By(`Create separate manifests for each CatalogSource`) mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -720,30 +720,30 @@ var _ = Describe("Install Plan", func() { }, } - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), dependentCRD.GetName(), metav1.DeleteOptions{})) }).Should(Succeed()) }() - // Create the catalog sources + By(`Create the catalog sources`) require.NotEqual(GinkgoT(), "", generatedNamespace.GetName()) _, cleanupDependentCatalogSource := createInternalCatalogSource(c, crc, dependentCatalogName, generatedNamespace.GetName(), dependentManifests, []apiextensionsv1.CustomResourceDefinition{dependentCRD}, []operatorsv1alpha1.ClusterServiceVersion{dependentCSV}) defer cleanupDependentCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err := fetchCatalogSourceOnStatus(crc, dependentCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) _, cleanupMainCatalogSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, nil, []operatorsv1alpha1.ClusterServiceVersion{mainCSV}) defer cleanupMainCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err = fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // Create expected install plan step sources + By(`Create expected install plan step sources`) expectedStepSources := map[registry.ResourceKey]registry.ResourceKey{ {Name: dependentCRD.Name, Kind: "CustomResourceDefinition"}: {Name: dependentCatalogName, Namespace: generatedNamespace.GetName()}, {Name: dependentPackageStable, Kind: operatorsv1alpha1.ClusterServiceVersionKind}: {Name: dependentCatalogName, Namespace: generatedNamespace.GetName()}, @@ -761,16 +761,16 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) log(fmt.Sprintf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase)) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) - // Fetch installplan again to check for unnecessary control loops + By(`Fetch installplan again to check for unnecessary control loops`) fetchedInstallPlan, err = fetchInstallPlan(GinkgoT(), crc, fetchedInstallPlan.GetName(), generatedNamespace.GetName(), func(fip *operatorsv1alpha1.InstallPlan) bool { - // Don't compare object meta as labels can be applied by the operator controller. + By(`Don't compare object meta as labels can be applied by the operator controller.`) Expect(equality.Semantic.DeepEqual(fetchedInstallPlan.Spec, fip.Spec)).Should(BeTrue(), diff.ObjectDiff(fetchedInstallPlan, fip)) Expect(equality.Semantic.DeepEqual(fetchedInstallPlan.Status, fip.Status)).Should(BeTrue(), diff.ObjectDiff(fetchedInstallPlan, fip)) return true @@ -778,7 +778,7 @@ var _ = Describe("Install Plan", func() { require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), len(expectedStepSources), len(fetchedInstallPlan.Status.Plan), "Number of resolved steps matches the number of expected steps") - // Ensure resolved step resources originate from the correct catalog sources + By(`Ensure resolved step resources originate from the correct catalog sources`) log(fmt.Sprintf("%#v", expectedStepSources)) for _, step := range fetchedInstallPlan.Status.Plan { log(fmt.Sprintf("checking %s", step.Resource)) @@ -788,7 +788,7 @@ var _ = Describe("Install Plan", func() { require.Equal(GinkgoT(), expectedSource.Name, step.Resource.CatalogSource) require.Equal(GinkgoT(), expectedSource.Namespace, step.Resource.CatalogSourceNamespace) - // delete + By(`delete`) } EXPECTED: for key := range expectedStepSources { @@ -802,18 +802,18 @@ var _ = Describe("Install Plan", func() { log("All expected resources resolved") - // Verify that the dependent subscription is in a good state + By(`Verify that the dependent subscription is in a good state`) dependentSubscription, err := fetchSubscription(crc, generatedNamespace.GetName(), strings.Join([]string{dependentPackageStable, dependentCatalogName, generatedNamespace.GetName()}, "-"), subscriptionStateAtLatestChecker()) require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), dependentSubscription) require.NotNil(GinkgoT(), dependentSubscription.Status.InstallPlanRef) require.Equal(GinkgoT(), dependentCSV.GetName(), dependentSubscription.Status.CurrentCSV) - // Verify CSV is created + By(`Verify CSV is created`) _, err = fetchCSV(crc, generatedNamespace.GetName(), dependentCSV.GetName(), csvAnyChecker) require.NoError(GinkgoT(), err) - // Update dependent subscription in catalog and wait for csv to update + By(`Update dependent subscription in catalog and wait for csv to update`) updatedDependentCSV := newCSV(dependentPackageStable+"-v2", generatedNamespace.GetName(), dependentPackageStable, semver.MustParse("0.1.1"), []apiextensionsv1.CustomResourceDefinition{dependentCRD}, nil, nil) dependentManifests = []registry.PackageManifest{ { @@ -827,17 +827,17 @@ var _ = Describe("Install Plan", func() { updateInternalCatalog(GinkgoT(), c, crc, dependentCatalogName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{dependentCRD}, []operatorsv1alpha1.ClusterServiceVersion{dependentCSV, updatedDependentCSV}, dependentManifests) - // Wait for subscription to update + By(`Wait for subscription to update`) updatedDepSubscription, err := fetchSubscription(crc, generatedNamespace.GetName(), strings.Join([]string{dependentPackageStable, dependentCatalogName, generatedNamespace.GetName()}, "-"), subscriptionHasCurrentCSV(updatedDependentCSV.GetName())) require.NoError(GinkgoT(), err) - // Verify installplan created and installed + By(`Verify installplan created and installed`) fetchedUpdatedDepInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, updatedDepSubscription.Status.InstallPlanRef.Name, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) log(fmt.Sprintf("Install plan %s fetched with status %s", fetchedUpdatedDepInstallPlan.GetName(), fetchedUpdatedDepInstallPlan.Status.Phase)) require.NotEqual(GinkgoT(), fetchedInstallPlan.GetName(), fetchedUpdatedDepInstallPlan.GetName()) - // Wait for csv to update + By(`Wait for csv to update`) _, err = fetchCSV(crc, generatedNamespace.GetName(), updatedDependentCSV.GetName(), csvAnyChecker) require.NoError(GinkgoT(), err) }) @@ -857,7 +857,7 @@ var _ = Describe("Install Plan", func() { stableChannel := "stable" betaChannel := "beta" - // Create manifests + By(`Create manifests`) mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -876,17 +876,17 @@ var _ = Describe("Install Plan", func() { }, } - // Create new CRDs + By(`Create new CRDs`) mainCRD := newCRD(genName("ins-")) dependentCRD := newCRD(genName("ins-")) - // Create new CSVs + By(`Create new CSVs`) mainStableCSV := newCSV(mainPackageStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{mainCRD}, []apiextensionsv1.CustomResourceDefinition{dependentCRD}, nil) mainBetaCSV := newCSV(mainPackageBeta, generatedNamespace.GetName(), mainPackageStable, semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{mainCRD}, []apiextensionsv1.CustomResourceDefinition{dependentCRD}, nil) dependentStableCSV := newCSV(dependentPackageStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{dependentCRD}, nil, nil) dependentBetaCSV := newCSV(dependentPackageBeta, generatedNamespace.GetName(), dependentPackageStable, semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{dependentCRD}, nil, nil) - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), mainCRD.GetName(), metav1.DeleteOptions{})) @@ -900,12 +900,12 @@ var _ = Describe("Install Plan", func() { require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{})) }() - // Create the catalog source + By(`Create the catalog source`) mainCatalogSourceName := genName("mock-ocs-main-" + strings.ToLower(K8sSafeCurrentTestDescription()) + "-") _, cleanupCatalogSource := createInternalCatalogSource(c, crc, mainCatalogSourceName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{dependentCRD, mainCRD}, []operatorsv1alpha1.ClusterServiceVersion{dependentBetaCSV, dependentStableCSV, mainStableCSV, mainBetaCSV}) defer cleanupCatalogSource() - // Attempt to get the catalog source before creating install plan(s) + By(`Attempt to get the catalog source before creating install plan(s)`) _, err := fetchCatalogSourceOnStatus(crc, mainCatalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -914,7 +914,7 @@ var _ = Describe("Install Plan", func() { {Name: mainPackageStable, Kind: operatorsv1alpha1.ClusterServiceVersionKind}: {}, } - // Create the preexisting CRD and CSV + By(`Create the preexisting CRD and CSV`) cleanupCRD, err := createCRD(c, dependentCRD) require.NoError(GinkgoT(), err) defer cleanupCRD() @@ -933,14 +933,14 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete or Failed before checking resource presence + By(`Wait for InstallPlan to be status: Complete or Failed before checking resource presence`) fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete, operatorsv1alpha1.InstallPlanPhaseFailed)) require.NoError(GinkgoT(), err) GinkgoT().Logf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) - // Fetch installplan again to check for unnecessary control loops + By(`Fetch installplan again to check for unnecessary control loops`) fetchedInstallPlan, err = fetchInstallPlan(GinkgoT(), crc, fetchedInstallPlan.GetName(), generatedNamespace.GetName(), func(fip *operatorsv1alpha1.InstallPlan) bool { Expect(equality.Semantic.DeepEqual(fetchedInstallPlan, fip)).Should(BeTrue(), diff.ObjectDiff(fetchedInstallPlan, fip)) return true @@ -961,14 +961,14 @@ var _ = Describe("Install Plan", func() { _, ok := expectedSteps[key] require.True(GinkgoT(), ok) - // Remove the entry from the expected steps set (to ensure no duplicates in resolved plan) + By(`Remove the entry from the expected steps set (to ensure no duplicates in resolved plan)`) delete(expectedSteps, key) } - // Should have removed every matching step + By(`Should have removed every matching step`) require.Equal(GinkgoT(), 0, len(expectedSteps), "Actual resource steps do not match expected") - // Delete CRDs + By(`Delete CRDs`) Expect(client.IgnoreNotFound(ctx.Ctx().Client().Delete(context.Background(), &mainCRD))).To(Succeed()) Expect(client.IgnoreNotFound(ctx.Ctx().Client().Delete(context.Background(), &dependentCRD))).To(Succeed()) }) @@ -1279,7 +1279,7 @@ var _ = Describe("Install Plan", func() { stableChannel := "stable" betaChannel := "beta" - // Create manifests + By(`Create manifests`) mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -1291,11 +1291,11 @@ var _ = Describe("Install Plan", func() { }, } - // Create new CSVs + By(`Create new CSVs`) mainStableCSV := newCSV(mainPackageStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{*tt.oldCRD}, nil, nil) mainBetaCSV := newCSV(mainPackageBeta, generatedNamespace.GetName(), mainPackageStable, semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{*tt.oldCRD}, nil, nil) - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), tt.oldCRD.GetName(), metav1.DeleteOptions{})) @@ -1310,7 +1310,7 @@ var _ = Describe("Install Plan", func() { } }() - // Existing custom resource + By(`Existing custom resource`) existingCR := &unstructured.Unstructured{ Object: map[string]interface{}{ "apiVersion": "cluster.com/v1alpha1", @@ -1325,12 +1325,12 @@ var _ = Describe("Install Plan", func() { }, } - // Create the catalog source + By(`Create the catalog source`) mainCatalogSourceName := genName("mock-ocs-main-") _, cleanupCatalogSource := createInternalCatalogSource(c, crc, mainCatalogSourceName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{*tt.oldCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainStableCSV, mainBetaCSV}) defer cleanupCatalogSource() - // Attempt to get the catalog source before creating install plan(s) + By(`Attempt to get the catalog source before creating install plan(s)`) _, err := fetchCatalogSourceOnStatus(crc, mainCatalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -1344,14 +1344,14 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete or failed before checking resource presence + By(`Wait for InstallPlan to be status: Complete or failed before checking resource presence`) completeOrFailedFunc := buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete, operatorsv1alpha1.InstallPlanPhaseFailed) fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), completeOrFailedFunc) require.NoError(GinkgoT(), err) GinkgoT().Logf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) - // Ensure that the desired resources have been created + By(`Ensure that the desired resources have been created`) expectedSteps := map[registry.ResourceKey]struct{}{ {Name: tt.oldCRD.Name, Kind: "CustomResourceDefinition"}: {}, {Name: mainPackageStable, Kind: operatorsv1alpha1.ClusterServiceVersionKind}: {}, @@ -1367,25 +1367,25 @@ var _ = Describe("Install Plan", func() { _, ok := expectedSteps[key] require.True(GinkgoT(), ok, "couldn't find %v in expected steps: %#v", key, expectedSteps) - // Remove the entry from the expected steps set (to ensure no duplicates in resolved plan) + By(`Remove the entry from the expected steps set (to ensure no duplicates in resolved plan)`) delete(expectedSteps, key) } - // Should have removed every matching step + By(`Should have removed every matching step`) require.Equal(GinkgoT(), 0, len(expectedSteps), "Actual resource steps do not match expected") - // Create initial CR + By(`Create initial CR`) cleanupCR, err := createCR(c, existingCR, "cluster.com", "v1alpha1", generatedNamespace.GetName(), tt.oldCRD.Spec.Names.Plural, "my-cr-1") require.NoError(GinkgoT(), err) defer cleanupCR() updateInternalCatalog(GinkgoT(), c, crc, mainCatalogSourceName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{*tt.newCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainStableCSV, mainBetaCSV}, mainManifests) - // Attempt to get the catalog source before creating install plan(s) + By(`Attempt to get the catalog source before creating install plan(s)`) _, err = fetchCatalogSourceOnStatus(crc, mainCatalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // Update the subscription resource to point to the beta CSV + By(`Update the subscription resource to point to the beta CSV`) err = retry.RetryOnConflict(retry.DefaultBackoff, func() error { subscription, err = fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanChecker()) require.NoError(GinkgoT(), err) @@ -1397,21 +1397,21 @@ var _ = Describe("Install Plan", func() { return err }) - // Wait for subscription to have a new installplan + By(`Wait for subscription to have a new installplan`) subscription, err = fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanDifferentChecker(fetchedInstallPlan.GetName())) require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subscription) installPlanName = subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete or Failed before checking resource presence + By(`Wait for InstallPlan to be status: Complete or Failed before checking resource presence`) fetchedInstallPlan, err = fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(tt.expectedPhase)) require.NoError(GinkgoT(), err) GinkgoT().Logf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase) require.Equal(GinkgoT(), tt.expectedPhase, fetchedInstallPlan.Status.Phase) - // Ensure correct in-cluster resource(s) + By(`Ensure correct in-cluster resource(s)`) fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), mainBetaCSV.GetName(), csvAnyChecker) require.NoError(GinkgoT(), err) @@ -1535,7 +1535,7 @@ var _ = Describe("Install Plan", func() { stableChannel := "stable" - // Create manifests + By(`Create manifests`) mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -1546,12 +1546,12 @@ var _ = Describe("Install Plan", func() { }, } - // Create new CSVs + By(`Create new CSVs`) mainStableCSV := newCSV(mainPackageStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{*tt.oldCRD}, nil, nil) mainBetaCSV := newCSV(mainPackageBeta, generatedNamespace.GetName(), mainPackageStable, semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{*tt.intermediateCRD}, nil, nil) mainDeltaCSV := newCSV(mainPackageDelta, generatedNamespace.GetName(), mainPackageBeta, semver.MustParse("0.3.0"), []apiextensionsv1.CustomResourceDefinition{*tt.newCRD}, nil, nil) - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), tt.oldCRD.GetName(), metav1.DeleteOptions{})) @@ -1566,25 +1566,25 @@ var _ = Describe("Install Plan", func() { } }() - // Defer crd clean up + By(`Defer crd clean up`) defer func() { Expect(client.IgnoreNotFound(ctx.Ctx().Client().Delete(context.Background(), tt.newCRD))).To(Succeed()) Expect(client.IgnoreNotFound(ctx.Ctx().Client().Delete(context.Background(), tt.oldCRD))).To(Succeed()) Expect(client.IgnoreNotFound(ctx.Ctx().Client().Delete(context.Background(), tt.intermediateCRD))).To(Succeed()) }() - // Create the catalog source + By(`Create the catalog source`) mainCatalogSourceName := genName("mock-ocs-main-") _, cleanupCatalogSource := createInternalCatalogSource(c, crc, mainCatalogSourceName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{*tt.oldCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainStableCSV}) defer cleanupCatalogSource() - // Attempt to get the catalog source before creating install plan(s) + By(`Attempt to get the catalog source before creating install plan(s)`) _, err := fetchCatalogSourceOnStatus(crc, mainCatalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) subscriptionName := genName("sub-nginx-") - // this subscription will be cleaned up below without the clean up function + By(`this subscription will be cleaned up below without the clean up function`) createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subscriptionName, mainCatalogSourceName, mainPackageName, stableChannel, "", operatorsv1alpha1.ApprovalAutomatic) subscription, err := fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanChecker()) @@ -1593,21 +1593,21 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete or failed before checking resource presence + By(`Wait for InstallPlan to be status: Complete or failed before checking resource presence`) completeOrFailedFunc := buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete, operatorsv1alpha1.InstallPlanPhaseFailed) fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), completeOrFailedFunc) require.NoError(GinkgoT(), err) GinkgoT().Logf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) - // Ensure CRD versions are accurate + By(`Ensure CRD versions are accurate`) expectedVersions := map[string]struct{}{ "v1alpha1": {}, } validateCRDVersions(GinkgoT(), c, tt.oldCRD.GetName(), expectedVersions) - // Update the manifest + By(`Update the manifest`) mainManifests = []registry.PackageManifest{ { PackageName: mainPackageName, @@ -1619,7 +1619,7 @@ var _ = Describe("Install Plan", func() { } updateInternalCatalog(GinkgoT(), c, crc, mainCatalogSourceName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{*tt.intermediateCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainStableCSV, mainBetaCSV}, mainManifests) - // Attempt to get the catalog source before creating install plan(s) + By(`Attempt to get the catalog source before creating install plan(s)`) _, err = fetchCatalogSourceOnStatus(crc, mainCatalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) subscription, err = fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanDifferentChecker(installPlanName)) @@ -1628,18 +1628,18 @@ var _ = Describe("Install Plan", func() { installPlanName = subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete or Failed before checking resource presence + By(`Wait for InstallPlan to be status: Complete or Failed before checking resource presence`) fetchedInstallPlan, err = fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete, operatorsv1alpha1.InstallPlanPhaseFailed)) require.NoError(GinkgoT(), err) GinkgoT().Logf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase) require.Equal(GinkgoT(), tt.expectedPhase, fetchedInstallPlan.Status.Phase) - // Ensure correct in-cluster resource(s) + By(`Ensure correct in-cluster resource(s)`) fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), mainBetaCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Ensure CRD versions are accurate + By(`Ensure CRD versions are accurate`) expectedVersions = map[string]struct{}{ "v1alpha1": {}, "v1alpha2": {}, @@ -1647,7 +1647,7 @@ var _ = Describe("Install Plan", func() { validateCRDVersions(GinkgoT(), c, tt.oldCRD.GetName(), expectedVersions) - // Update the manifest + By(`Update the manifest`) mainManifests = []registry.PackageManifest{ { PackageName: mainPackageName, @@ -1659,7 +1659,7 @@ var _ = Describe("Install Plan", func() { } updateInternalCatalog(GinkgoT(), c, crc, mainCatalogSourceName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{*tt.newCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainStableCSV, mainBetaCSV, mainDeltaCSV}, mainManifests) - // Attempt to get the catalog source before creating install plan(s) + By(`Attempt to get the catalog source before creating install plan(s)`) _, err = fetchCatalogSourceOnStatus(crc, mainCatalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) subscription, err = fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanDifferentChecker(installPlanName)) @@ -1668,18 +1668,18 @@ var _ = Describe("Install Plan", func() { installPlanName = subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete or Failed before checking resource presence + By(`Wait for InstallPlan to be status: Complete or Failed before checking resource presence`) fetchedInstallPlan, err = fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete, operatorsv1alpha1.InstallPlanPhaseFailed)) require.NoError(GinkgoT(), err) GinkgoT().Logf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase) require.Equal(GinkgoT(), tt.expectedPhase, fetchedInstallPlan.Status.Phase) - // Ensure correct in-cluster resource(s) + By(`Ensure correct in-cluster resource(s)`) fetchedCSV, err = fetchCSV(crc, generatedNamespace.GetName(), mainDeltaCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Ensure CRD versions are accurate + By(`Ensure CRD versions are accurate`) expectedVersions = map[string]struct{}{ "v1alpha2": {}, "v1beta1": {}, @@ -1694,7 +1694,7 @@ var _ = Describe("Install Plan", func() { Describe("update catalog for subscription", func() { - // crdVersionKey uniquely identifies a version within a CRD. + // crdVersionKey uniquely identifies a version within a CRD type crdVersionKey struct { name string served bool @@ -1706,7 +1706,7 @@ var _ = Describe("Install Plan", func() { require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{})) }() - // Build initial catalog + By(`Build initial catalog`) mainPackageName := genName("nginx-amplify-") mainPackageStable := fmt.Sprintf("%s-stable", mainPackageName) stableChannel := "stable" @@ -1741,7 +1741,7 @@ var _ = Describe("Install Plan", func() { }, } - // Generate permissions + By(`Generate permissions`) serviceAccountName := genName("nginx-sa") permissions := []operatorsv1alpha1.StrategyDeploymentPermissions{ { @@ -1755,7 +1755,7 @@ var _ = Describe("Install Plan", func() { }, }, } - // Generate permissions + By(`Generate permissions`) clusterPermissions := []operatorsv1alpha1.StrategyDeploymentPermissions{ { ServiceAccountName: serviceAccountName, @@ -1769,7 +1769,7 @@ var _ = Describe("Install Plan", func() { }, } - // Create the catalog sources + By(`Create the catalog sources`) mainNamedStrategy := newNginxInstallStrategy(genName("dep-"), permissions, clusterPermissions) mainCSV := newCSV(mainPackageStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), nil, nil, &mainNamedStrategy) mainCatalogName := genName("mock-ocs-amplify-") @@ -1783,7 +1783,7 @@ var _ = Describe("Install Plan", func() { }, } - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), mainCRD.GetName(), metav1.DeleteOptions{})) @@ -1793,7 +1793,7 @@ var _ = Describe("Install Plan", func() { _, cleanupMainCatalogSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{mainCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV}) defer cleanupMainCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -1809,17 +1809,17 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) - // Verify CSV is created + By(`Verify CSV is created`) _, err = fetchCSV(crc, generatedNamespace.GetName(), mainCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Update CatalogSource with a new CSV with more permissions + By(`Update CatalogSource with a new CSV with more permissions`) updatedPermissions := []operatorsv1alpha1.StrategyDeploymentPermissions{ { ServiceAccountName: serviceAccountName, @@ -1855,7 +1855,7 @@ var _ = Describe("Install Plan", func() { }, } - // Create the catalog sources + By(`Create the catalog sources`) updatedNamedStrategy := newNginxInstallStrategy(genName("dep-"), updatedPermissions, updatedClusterPermissions) updatedCSV := newCSV(mainPackageStable+"-next", generatedNamespace.GetName(), mainCSV.GetName(), semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{mainCRD}, nil, &updatedNamedStrategy) updatedManifests := []registry.PackageManifest{ @@ -1868,7 +1868,7 @@ var _ = Describe("Install Plan", func() { }, } - // Update catalog with updated CSV with more permissions + By(`Update catalog with updated CSV with more permissions`) updateInternalCatalog(GinkgoT(), c, crc, mainCatalogName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{mainCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV, updatedCSV}, updatedManifests) _, err = fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanDifferentChecker(fetchedInstallPlan.GetName())) @@ -1876,16 +1876,16 @@ var _ = Describe("Install Plan", func() { updatedInstallPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedUpdatedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, updatedInstallPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedUpdatedInstallPlan.Status.Phase) - // Wait for csv to update + By(`Wait for csv to update`) _, err = fetchCSV(crc, generatedNamespace.GetName(), updatedCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // If the CSV is succeeded, we successfully rolled out the RBAC changes + By(`If the CSV is succeeded, we successfully rolled out the RBAC changes`) }) It("AttenuatePermissions", func() { @@ -1893,7 +1893,7 @@ var _ = Describe("Install Plan", func() { require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{})) }() - // Build initial catalog + By(`Build initial catalog`) mainPackageName := genName("nginx-attenuate-") mainPackageStable := fmt.Sprintf("%s-stable", mainPackageName) stableChannel := "stable" @@ -1928,7 +1928,7 @@ var _ = Describe("Install Plan", func() { }, } - // Generate permissions + By(`Generate permissions`) serviceAccountName := genName("nginx-sa") permissions := []operatorsv1alpha1.StrategyDeploymentPermissions{ { @@ -1948,7 +1948,7 @@ var _ = Describe("Install Plan", func() { }, } - // Generate permissions + By(`Generate permissions`) clusterPermissions := []operatorsv1alpha1.StrategyDeploymentPermissions{ { ServiceAccountName: serviceAccountName, @@ -1967,7 +1967,7 @@ var _ = Describe("Install Plan", func() { }, } - // Create the catalog sources + By(`Create the catalog sources`) mainNamedStrategy := newNginxInstallStrategy(genName("dep-"), permissions, clusterPermissions) mainCSV := newCSV(mainPackageStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), nil, nil, &mainNamedStrategy) mainCatalogName := genName("mock-ocs-main-update-perms1-") @@ -1981,7 +1981,7 @@ var _ = Describe("Install Plan", func() { }, } - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), mainCRD.GetName(), metav1.DeleteOptions{})) @@ -1991,7 +1991,7 @@ var _ = Describe("Install Plan", func() { _, cleanupMainCatalogSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{mainCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV}) defer cleanupMainCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -2007,17 +2007,17 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) - // Verify CSV is created + By(`Verify CSV is created`) _, err = fetchCSV(crc, generatedNamespace.GetName(), mainCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Update CatalogSource with a new CSV with more permissions + By(`Update CatalogSource with a new CSV with more permissions`) updatedPermissions := []operatorsv1alpha1.StrategyDeploymentPermissions{ { ServiceAccountName: serviceAccountName, @@ -2046,7 +2046,7 @@ var _ = Describe("Install Plan", func() { oldSecrets, err := c.KubernetesInterface().CoreV1().Secrets(generatedNamespace.GetName()).List(context.Background(), metav1.ListOptions{}) require.NoError(GinkgoT(), err, "error listing secrets") - // Create the catalog sources + By(`Create the catalog sources`) updatedNamedStrategy := newNginxInstallStrategy(genName("dep-"), updatedPermissions, updatedClusterPermissions) updatedCSV := newCSV(mainPackageStable+"-next", generatedNamespace.GetName(), mainCSV.GetName(), semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{mainCRD}, nil, &updatedNamedStrategy) updatedManifests := []registry.PackageManifest{ @@ -2059,34 +2059,34 @@ var _ = Describe("Install Plan", func() { }, } - // Update catalog with updated CSV with more permissions + By(`Update catalog with updated CSV with more permissions`) updateInternalCatalog(GinkgoT(), c, crc, mainCatalogName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{mainCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV, updatedCSV}, updatedManifests) - // Wait for subscription to update its status + By(`Wait for subscription to update its status`) _, err = fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanDifferentChecker(fetchedInstallPlan.GetName())) require.NoError(GinkgoT(), err) updatedInstallPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedUpdatedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, updatedInstallPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedUpdatedInstallPlan.Status.Phase) - // Wait for csv to update + By(`Wait for csv to update`) _, err = fetchCSV(crc, generatedNamespace.GetName(), updatedCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) newSecrets, err := c.KubernetesInterface().CoreV1().Secrets(generatedNamespace.GetName()).List(context.Background(), metav1.ListOptions{}) require.NoError(GinkgoT(), err, "error listing secrets") - // Assert that the number of secrets is not increased from updating service account as part of the install plan, + By(`Assert that the number of secrets is not increased from updating service account as part of the install plan,`) assert.EqualValues(GinkgoT(), len(oldSecrets.Items), len(newSecrets.Items)) - // And that the secret list is indeed updated. + By(`And that the secret list is indeed updated.`) assert.Equal(GinkgoT(), oldSecrets.Items, newSecrets.Items) - // Wait for ServiceAccount to not have access anymore + By(`Wait for ServiceAccount to not have access anymore`) err = wait.Poll(pollInterval, pollDuration, func() (bool, error) { res, err := c.KubernetesInterface().AuthorizationV1().SubjectAccessReviews().Create(context.Background(), &authorizationv1.SubjectAccessReview{ Spec: authorizationv1.SubjectAccessReviewSpec{ @@ -2107,7 +2107,7 @@ var _ = Describe("Install Plan", func() { } GinkgoT().Log("checking serviceaccount for permission") - // should not be allowed + By(`should not be allowed`) return !res.Status.Allowed, nil }) }) @@ -2118,7 +2118,7 @@ var _ = Describe("Install Plan", func() { require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{})) }() - // Build initial catalog + By(`Build initial catalog`) mainPackageName := genName("nginx-amplify-") mainPackageStable := fmt.Sprintf("%s-stable", mainPackageName) stableChannel := "stable" @@ -2153,7 +2153,7 @@ var _ = Describe("Install Plan", func() { }, } - // Generate permissions + By(`Generate permissions`) serviceAccountName := genName("nginx-sa") permissions := []operatorsv1alpha1.StrategyDeploymentPermissions{ { @@ -2168,7 +2168,7 @@ var _ = Describe("Install Plan", func() { }, } - // Generate permissions + By(`Generate permissions`) clusterPermissions := []operatorsv1alpha1.StrategyDeploymentPermissions{ { ServiceAccountName: serviceAccountName, @@ -2182,7 +2182,7 @@ var _ = Describe("Install Plan", func() { }, } - // Create the catalog sources + By(`Create the catalog sources`) deploymentName := genName("dep-") mainNamedStrategy := newNginxInstallStrategy(deploymentName, permissions, clusterPermissions) mainCSV := newCSV(mainPackageStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), nil, nil, &mainNamedStrategy) @@ -2197,7 +2197,7 @@ var _ = Describe("Install Plan", func() { }, } - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), mainCRD.GetName(), metav1.DeleteOptions{})) @@ -2207,7 +2207,7 @@ var _ = Describe("Install Plan", func() { _, cleanupMainCatalogSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{mainCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV}) defer cleanupMainCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -2223,13 +2223,13 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) - // Verify CSV is created + By(`Verify CSV is created`) csv, err := fetchCSV(crc, generatedNamespace.GetName(), mainCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) @@ -2270,11 +2270,11 @@ var _ = Describe("Install Plan", func() { _, err = crc.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Update(context.Background(), csv, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Wait for csv to update + By(`Wait for csv to update`) _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Should have the updated env var + By(`Should have the updated env var`) err = wait.Poll(pollInterval, pollDuration, func() (bool, error) { dep, err := c.GetDeployment(generatedNamespace.GetName(), deploymentName) if err != nil { @@ -2292,8 +2292,8 @@ var _ = Describe("Install Plan", func() { }) require.NoError(GinkgoT(), err) - // Create the catalog sources - // Updated csv has the same deployment strategy as main + By(`Create the catalog sources`) + By(`Updated csv has the same deployment strategy as main`) updatedCSV := newCSV(mainPackageStable+"-next", generatedNamespace.GetName(), mainCSV.GetName(), semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{mainCRD}, nil, &mainNamedStrategy) updatedManifests := []registry.PackageManifest{ { @@ -2305,7 +2305,7 @@ var _ = Describe("Install Plan", func() { }, } - // Update catalog with updated CSV with more permissions + By(`Update catalog with updated CSV with more permissions`) updateInternalCatalog(GinkgoT(), c, crc, mainCatalogName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{mainCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV, updatedCSV}, updatedManifests) _, err = fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanDifferentChecker(fetchedInstallPlan.GetName())) @@ -2313,21 +2313,21 @@ var _ = Describe("Install Plan", func() { updatedInstallPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedUpdatedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, updatedInstallPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedUpdatedInstallPlan.Status.Phase) - // Wait for csv to update + By(`Wait for csv to update`) _, err = fetchCSV(crc, generatedNamespace.GetName(), updatedCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Should have created deployment and stomped on the env changes + By(`Should have created deployment and stomped on the env changes`) updatedDep, err := c.GetDeployment(generatedNamespace.GetName(), deploymentName) require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), updatedDep) - // Should have the updated env var + By(`Should have the updated env var`) for _, envVar := range updatedDep.Spec.Template.Spec.Containers[0].Env { require.False(GinkgoT(), envVar == addedEnvVar) } @@ -2416,7 +2416,7 @@ var _ = Describe("Install Plan", func() { mainCSV := newCSV(mainPackageStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{mainCRD}, nil, nil) betaCSV := newCSV(mainPackageBeta, generatedNamespace.GetName(), mainPackageStable, semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{updatedCRD}, nil, nil) - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), mainCRD.GetName(), metav1.DeleteOptions{})) @@ -2432,7 +2432,7 @@ var _ = Describe("Install Plan", func() { mainCatalogName := genName("mock-ocs-main-update-") - // Create separate manifests for each CatalogSource + By(`Create separate manifests for each CatalogSource`) mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -2443,11 +2443,11 @@ var _ = Describe("Install Plan", func() { }, } - // Create the catalog sources + By(`Create the catalog sources`) _, cleanupMainCatalogSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{mainCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV}) defer cleanupMainCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -2462,20 +2462,20 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) - // Fetch installplan again to check for unnecessary control loops + By(`Fetch installplan again to check for unnecessary control loops`) fetchedInstallPlan, err = fetchInstallPlan(GinkgoT(), crc, fetchedInstallPlan.GetName(), generatedNamespace.GetName(), func(fip *operatorsv1alpha1.InstallPlan) bool { Expect(equality.Semantic.DeepEqual(fetchedInstallPlan, fip)).Should(BeTrue(), diff.ObjectDiff(fetchedInstallPlan, fip)) return true }) require.NoError(GinkgoT(), err) - // Verify CSV is created + By(`Verify CSV is created`) _, err = fetchCSV(crc, generatedNamespace.GetName(), mainCSV.GetName(), csvAnyChecker) require.NoError(GinkgoT(), err) @@ -2490,20 +2490,20 @@ var _ = Describe("Install Plan", func() { } updateInternalCatalog(GinkgoT(), c, crc, mainCatalogName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{updatedCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV, betaCSV}, mainManifests) - // Wait for subscription to update + By(`Wait for subscription to update`) updatedSubscription, err := fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanDifferentChecker(fetchedInstallPlan.GetName())) require.NoError(GinkgoT(), err) - // Verify installplan created and installed + By(`Verify installplan created and installed`) fetchedUpdatedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, updatedSubscription.Status.InstallPlanRef.Name, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) require.NotEqual(GinkgoT(), fetchedInstallPlan.GetName(), fetchedUpdatedInstallPlan.GetName()) - // Wait for csv to update + By(`Wait for csv to update`) _, err = fetchCSV(crc, generatedNamespace.GetName(), betaCSV.GetName(), csvAnyChecker) require.NoError(GinkgoT(), err) - // Get the CRD to see if it is updated + By(`Get the CRD to see if it is updated`) fetchedCRD, err := c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.Background(), crdName, metav1.GetOptions{}) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), len(fetchedCRD.Spec.Versions), len(updatedCRD.Spec.Versions), "The CRD versions counts don't match") @@ -2622,7 +2622,7 @@ var _ = Describe("Install Plan", func() { expectedCRDVersions[key] = struct{}{} } - // Create the initial CSV + By(`Create the initial CSV`) cleanupCRD, err := createCRD(c, mainCRD) require.NoError(GinkgoT(), err) defer cleanupCRD() @@ -2631,7 +2631,7 @@ var _ = Describe("Install Plan", func() { mainCatalogName := genName("mock-ocs-main-update2-") - // Create separate manifests for each CatalogSource + By(`Create separate manifests for each CatalogSource`) mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -2642,11 +2642,11 @@ var _ = Describe("Install Plan", func() { }, } - // Create the catalog sources + By(`Create the catalog sources`) _, cleanupMainCatalogSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{updatedCRD}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV}) defer cleanupMainCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err = fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -2662,24 +2662,24 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) - // Fetch installplan again to check for unnecessary control loops + By(`Fetch installplan again to check for unnecessary control loops`) fetchedInstallPlan, err = fetchInstallPlan(GinkgoT(), crc, fetchedInstallPlan.GetName(), generatedNamespace.GetName(), func(fip *operatorsv1alpha1.InstallPlan) bool { Expect(equality.Semantic.DeepEqual(fetchedInstallPlan, fip)).Should(BeTrue(), diff.ObjectDiff(fetchedInstallPlan, fip)) return true }) require.NoError(GinkgoT(), err) - // Verify CSV is created + By(`Verify CSV is created`) _, err = fetchCSV(crc, generatedNamespace.GetName(), mainCSV.GetName(), csvAnyChecker) require.NoError(GinkgoT(), err) - // Get the CRD to see if it is updated + By(`Get the CRD to see if it is updated`) fetchedCRD, err := c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.Background(), crdName, metav1.GetOptions{}) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), len(fetchedCRD.Spec.Versions), len(mainCRD.Spec.Versions), "The CRD versions counts don't match") @@ -2706,8 +2706,8 @@ var _ = Describe("Install Plan", func() { }) }) - // This It spec creates an InstallPlan with a CSV containing a set of permissions to be resolved. It("creation with permissions", func() { + By(`This It spec creates an InstallPlan with a CSV containing a set of permissions to be resolved.`) packageName := genName("nginx") stableChannel := "stable" @@ -2739,6 +2739,7 @@ var _ = Describe("Install Plan", func() { }() By("Generate permissions") + By(`Permissions must be different than ClusterPermissions defined below if OLM is going to lift role/rolebindings to cluster level.`) serviceAccountName := genName("nginx-sa") permissions := []operatorsv1alpha1.StrategyDeploymentPermissions{ { @@ -2749,7 +2750,6 @@ var _ = Describe("Install Plan", func() { APIGroups: []string{"cluster.com"}, Resources: []string{crdPlural}, }, - // Permissions must be different than ClusterPermissions defined below if OLM is going to lift role/rolebindings to cluster level. { Verbs: []string{rbac.VerbAll}, APIGroups: []string{corev1.GroupName}, @@ -2906,15 +2906,15 @@ var _ = Describe("Install Plan", func() { }) It("CRD validation", func() { - // Tests if CRD validation works with the "minimum" property after being - // pulled from a CatalogSource's operator-registry. + By(`Tests if CRD validation works with the "minimum" property after being`) + By(`pulled from a CatalogSource's operator-registry.`) crdPlural := genName("ins") crdName := crdPlural + ".cluster.com" var min float64 = 2 var max float64 = 256 - // Create CRD with offending property + By(`Create CRD with offending property`) crd := apiextensionsv1.CustomResourceDefinition{ ObjectMeta: metav1.ObjectMeta{ Name: crdName, @@ -2957,20 +2957,20 @@ var _ = Describe("Install Plan", func() { }, } - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), crd.GetName(), metav1.DeleteOptions{})) }).Should(Succeed()) }() - // Create CSV + By(`Create CSV`) packageName := genName("nginx-") stableChannel := "stable" packageNameStable := packageName + "-" + stableChannel csv := newCSV(packageNameStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crd}, nil, nil) - // Create PackageManifests + By(`Create PackageManifests`) manifests := []registry.PackageManifest{ { PackageName: packageName, @@ -2981,12 +2981,12 @@ var _ = Describe("Install Plan", func() { }, } - // Create the CatalogSource + By(`Create the CatalogSource`) catalogSourceName := genName("mock-nginx-") _, cleanupCatalogSource := createInternalCatalogSource(c, crc, catalogSourceName, generatedNamespace.GetName(), manifests, []apiextensionsv1.CustomResourceDefinition{crd}, []operatorsv1alpha1.ClusterServiceVersion{csv}) defer cleanupCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err := fetchCatalogSourceOnStatus(crc, catalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -3000,7 +3000,7 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedInstallPlan, err := fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete, operatorsv1alpha1.InstallPlanPhaseFailed)) require.NoError(GinkgoT(), err) GinkgoT().Logf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase) @@ -3008,17 +3008,17 @@ var _ = Describe("Install Plan", func() { require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) }) - // This It spec verifies that, in cases where there are multiple options to fulfil a dependency - // across multiple catalogs, we only generate one installplan with one set of resolved resources. - //issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2633 It("[FLAKE] consistent generation", func() { + By(`This It spec verifies that, in cases where there are multiple options to fulfil a dependency`) + By(`across multiple catalogs, we only generate one installplan with one set of resolved resources.`) + //issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2633 - // Configure catalogs: - // - one catalog with a package that has a dependency - // - several duplicate catalog with a package that satisfies the dependency - // Install the package from the main catalog - // Should see only 1 installplan created - // Should see the main CSV installed + By(`Configure catalogs:`) + By(`) - one catalog with a package that has a dependency`) + By(`) - several duplicate catalog with a package that satisfies the dependency`) + By(`Install the package from the main catalog`) + By(`Should see only 1 installplan created`) + By(`Should see the main CSV installed`) log := func(s string) { GinkgoT().Logf("%s: %s", time.Now().Format("15:04:05.9999"), s) @@ -3043,7 +3043,7 @@ var _ = Describe("Install Plan", func() { dependentCatalogName := genName("mock-ocs-dependent-") mainCatalogName := genName("mock-ocs-main-") - // Create separate manifests for each CatalogSource + By(`Create separate manifests for each CatalogSource`) mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -3064,28 +3064,28 @@ var _ = Describe("Install Plan", func() { }, } - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), dependentCRD.GetName(), metav1.DeleteOptions{})) }).Should(Succeed()) }() - // Create the dependent catalog source + By(`Create the dependent catalog source`) _, cleanupDependentCatalogSource := createInternalCatalogSource(c, crc, dependentCatalogName, generatedNamespace.GetName(), dependentManifests, []apiextensionsv1.CustomResourceDefinition{dependentCRD}, []operatorsv1alpha1.ClusterServiceVersion{dependentCSV}) defer cleanupDependentCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) dependentCatalogSource, err := fetchCatalogSourceOnStatus(crc, dependentCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // Create the alt dependent catalog sources + By(`Create the alt dependent catalog sources`) var wg sync.WaitGroup for i := 0; i < 4; i++ { // Creating more increases the odds that the race condition will be triggered wg.Add(1) go func(i int) { defer GinkgoRecover() - // Create a CatalogSource pointing to the grpc pod + By(`Create a CatalogSource pointing to the grpc pod`) addressSource := &operatorsv1alpha1.CatalogSource{ TypeMeta: metav1.TypeMeta{ Kind: operatorsv1alpha1.CatalogSourceKind, @@ -3104,7 +3104,7 @@ var _ = Describe("Install Plan", func() { _, err := crc.OperatorsV1alpha1().CatalogSources(generatedNamespace.GetName()).Create(context.Background(), addressSource, metav1.CreateOptions{}) require.NoError(GinkgoT(), err) - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err = fetchCatalogSourceOnStatus(crc, addressSource.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) wg.Done() @@ -3112,11 +3112,11 @@ var _ = Describe("Install Plan", func() { } wg.Wait() - // Create the main catalog source + By(`Create the main catalog source`) _, cleanupMainCatalogSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, nil, []operatorsv1alpha1.ClusterServiceVersion{mainCSV}) defer cleanupMainCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err = fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -3130,24 +3130,24 @@ var _ = Describe("Install Plan", func() { installPlanName := subscription.Status.InstallPlanRef.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) fetchedInstallPlan, err := fetchInstallPlanWithNamespace(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) log(fmt.Sprintf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase)) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseComplete, fetchedInstallPlan.Status.Phase) - // Verify CSV is created + By(`Verify CSV is created`) _, err = fetchCSV(crc, generatedNamespace.GetName(), mainCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Make sure to clean up the installed CRD + By(`Make sure to clean up the installed CRD`) deleteOpts := &metav1.DeleteOptions{} defer func() { require.NoError(GinkgoT(), c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), dependentCRD.GetName(), *deleteOpts)) }() - // ensure there is only one installplan + By(`ensure there is only one installplan`) ips, err := crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).List(context.Background(), metav1.ListOptions{}) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), 1, len(ips.Items), "If this test fails it should be taken seriously and not treated as a flake. \n%v", ips.Items) @@ -3159,18 +3159,18 @@ var _ = Describe("Install Plan", func() { ) BeforeEach(func() { - // Make sure there are no OGs in the namespace already + By(`Make sure there are no OGs in the namespace already`) require.NoError(GinkgoT(), crc.OperatorsV1().OperatorGroups(generatedNamespace.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{})) - // Create InstallPlan + By(`Create InstallPlan`) installPlanName = "ip" ip := newInstallPlanWithDummySteps(installPlanName, generatedNamespace.GetName(), operatorsv1alpha1.InstallPlanPhaseInstalling) outIP, err := crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Create(context.Background(), ip, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) Expect(outIP).NotTo(BeNil()) - // The status gets ignored on create so we need to update it else the InstallPlan sync ignores - // InstallPlans without any steps or bundle lookups + By(`The status gets ignored on create so we need to update it else the InstallPlan sync ignores`) + By(`InstallPlans without any steps or bundle lookups`) outIP.Status = ip.Status _, err = crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).UpdateStatus(context.Background(), outIP, metav1.UpdateOptions{}) Expect(err).NotTo(HaveOccurred()) @@ -3181,10 +3181,10 @@ var _ = Describe("Install Plan", func() { Expect(err).NotTo(HaveOccurred()) }) - // issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2636 It("[FLAKE] should clear up the condition in the InstallPlan status that contains an error message when a valid OperatorGroup is created", func() { + By(`issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2636`) - // first wait for a condition with a message exists + By(`first wait for a condition with a message exists`) cond := operatorsv1alpha1.InstallPlanCondition{Type: operatorsv1alpha1.InstallPlanInstalled, Status: corev1.ConditionFalse, Reason: operatorsv1alpha1.InstallPlanReasonInstallCheckFailed, Message: "no operator group found that is managing this namespace"} @@ -3199,7 +3199,7 @@ var _ = Describe("Install Plan", func() { return hasCondition(fetchedInstallPlan, cond) }, 5*time.Minute, interval).Should(BeTrue()) - // Create an operatorgroup for the same namespace + By(`Create an operatorgroup for the same namespace`) og := &operatorsv1.OperatorGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "og", @@ -3213,7 +3213,7 @@ var _ = Describe("Install Plan", func() { return ctx.Ctx().Client().Create(context.Background(), og) }, timeout, interval).Should(Succeed(), "could not create OperatorGroup") - // Wait for the OperatorGroup to be synced + By(`Wait for the OperatorGroup to be synced`) Eventually( func() ([]string, error) { err := ctx.Ctx().Client().Get(context.Background(), client.ObjectKeyFromObject(og), og) @@ -3224,7 +3224,7 @@ var _ = Describe("Install Plan", func() { interval, ).Should(ContainElement(generatedNamespace.GetName())) - // check that the condition has been cleared up + By(`check that the condition has been cleared up`) Eventually(func() (bool, error) { fetchedInstallPlan, err := fetchInstallPlanWithNamespace(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseInstalling)) if err != nil { @@ -3242,8 +3242,8 @@ var _ = Describe("Install Plan", func() { }) It("compresses installplan step resource manifests to configmap references", func() { - // Test ensures that all steps for index-based catalogs are references to configmaps. This avoids the problem - // of installplans growing beyond the etcd size limit when manifests are written to the ip status. + By(`Test ensures that all steps for index-based catalogs are references to configmaps. This avoids the problem`) + By(`of installplans growing beyond the etcd size limit when manifests are written to the ip status.`) catsrc := &operatorsv1alpha1.CatalogSource{ ObjectMeta: metav1.ObjectMeta{ Name: genName("kiali-"), @@ -3261,11 +3261,11 @@ var _ = Describe("Install Plan", func() { catsrc, err := crc.OperatorsV1alpha1().CatalogSources(catsrc.GetNamespace()).Create(context.Background(), catsrc, metav1.CreateOptions{}) Expect(err).ToNot(HaveOccurred()) - // Wait for the CatalogSource to be ready + By(`Wait for the CatalogSource to be ready`) catsrc, err = fetchCatalogSourceOnStatus(crc, catsrc.GetName(), catsrc.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred()) - // Generate a Subscription + By(`Generate a Subscription`) subName := genName("kiali-") cleanUpSubscriptionFn := createSubscriptionForCatalog(crc, catsrc.GetNamespace(), subName, catsrc.GetName(), "kiali", stableChannel, "", operatorsv1alpha1.ApprovalAutomatic) defer cleanUpSubscriptionFn() @@ -3273,13 +3273,13 @@ var _ = Describe("Install Plan", func() { sub, err := fetchSubscription(crc, catsrc.GetNamespace(), subName, subscriptionHasInstallPlanChecker()) Expect(err).ToNot(HaveOccurred()) - // Wait for the expected InstallPlan's execution to either fail or succeed + By(`Wait for the expected InstallPlan's execution to either fail or succeed`) ipName := sub.Status.InstallPlanRef.Name ip, err := waitForInstallPlan(crc, ipName, sub.GetNamespace(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseFailed, operatorsv1alpha1.InstallPlanPhaseComplete)) Expect(err).ToNot(HaveOccurred()) Expect(operatorsv1alpha1.InstallPlanPhaseComplete).To(Equal(ip.Status.Phase), "InstallPlan not complete") - // Ensure the InstallPlan contains the steps resolved from the bundle image + By(`Ensure the InstallPlan contains the steps resolved from the bundle image`) operatorName := "kiali-operator" expectedSteps := map[registry.ResourceKey]struct{}{ {Name: operatorName, Kind: "ClusterServiceVersion"}: {}, @@ -3304,7 +3304,7 @@ var _ = Describe("Install Plan", func() { } Expect(expectedSteps).To(HaveLen(0), "Actual resource steps do not match expected: %#v", expectedSteps) - // Ensure that all the steps have a configmap based reference + By(`Ensure that all the steps have a configmap based reference`) for _, step := range ip.Status.Plan { manifest := step.Resource.Manifest var ref catalog.UnpackedBundleReference @@ -3316,7 +3316,7 @@ var _ = Describe("Install Plan", func() { It("limits installed resources if the scoped serviceaccount has no permissions", func() { By("creating a scoped serviceaccount specified in the operatorgroup") - // create SA + By(`create SA`) sa := &corev1.ServiceAccount{ ObjectMeta: metav1.ObjectMeta{ Name: genName("sa-"), @@ -3325,11 +3325,11 @@ var _ = Describe("Install Plan", func() { } _, err := c.KubernetesInterface().CoreV1().ServiceAccounts(generatedNamespace.GetName()).Create(context.Background(), sa, metav1.CreateOptions{}) Expect(err).ToNot(HaveOccurred()) - // Create token secret for the serviceaccount + By(`Create token secret for the serviceaccount`) _, cleanupSE := newTokenSecret(c, generatedNamespace.GetName(), sa.GetName()) defer cleanupSE() - // role has no explicit permissions + By(`role has no explicit permissions`) role := &rbacv1.ClusterRole{ ObjectMeta: metav1.ObjectMeta{ Name: genName("role-"), @@ -3337,7 +3337,7 @@ var _ = Describe("Install Plan", func() { Rules: []rbacv1.PolicyRule{}, } - // bind role to SA + By(`bind role to SA`) rb := &rbacv1.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{ Name: genName("rb-"), @@ -3361,7 +3361,7 @@ var _ = Describe("Install Plan", func() { Expect(err).ToNot(HaveOccurred()) defer c.KubernetesInterface().RbacV1().ClusterRoles().Delete(context.Background(), role.GetName(), metav1.DeleteOptions{}) - // Update the existing OG to use the ServiceAccount + By(`Update the existing OG to use the ServiceAccount`) Eventually(func() error { existingOG, err := crc.OperatorsV1().OperatorGroups(generatedNamespace.GetName()).Get(context.Background(), fmt.Sprintf("%s-operatorgroup", generatedNamespace.GetName()), metav1.GetOptions{}) if err != nil { @@ -3372,9 +3372,9 @@ var _ = Describe("Install Plan", func() { return err }).Should(Succeed()) - // Wait for the OperatorGroup to be synced and have a status.ServiceAccountRef - // before moving on. Otherwise the catalog operator treats it as an invalid OperatorGroup - // and the InstallPlan is resynced + By(`Wait for the OperatorGroup to be synced and have a status.ServiceAccountRef`) + By(`before moving on. Otherwise the catalog operator treats it as an invalid OperatorGroup`) + By(`and the InstallPlan is resynced`) Eventually(func() (*corev1.ObjectReference, error) { outOG, err := crc.OperatorsV1().OperatorGroups(generatedNamespace.GetName()).Get(context.Background(), fmt.Sprintf("%s-operatorgroup", generatedNamespace.GetName()), metav1.GetOptions{}) if err != nil { @@ -3417,7 +3417,7 @@ var _ = Describe("Install Plan", func() { }, } - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), crd.GetName(), metav1.DeleteOptions{})) @@ -3470,8 +3470,8 @@ var _ = Describe("Install Plan", func() { return plan, ctx.Ctx().Client().Get(context.Background(), key, plan) }).Should(HavePhase(operatorsv1alpha1.InstallPlanPhaseComplete)) - // delete installplan, then create one with an additional resource that the SA does not have permissions to create - // expect installplan to fail + By(`delete installplan, then create one with an additional resource that the SA does not have permissions to create`) + By(`expect installplan to fail`) By("failing to install resources that are not explicitly allowed in the SA") err = crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Delete(context.Background(), plan.GetName(), metav1.DeleteOptions{}) Expect(err).ToNot(HaveOccurred()) @@ -3544,7 +3544,7 @@ var _ = Describe("Install Plan", func() { It("uses the correct client when installing resources from an installplan", func() { By("creating a scoped serviceaccount specifified in the operatorgroup") - // create SA + By(`create SA`) sa := &corev1.ServiceAccount{ ObjectMeta: metav1.ObjectMeta{ Name: genName("sa-"), @@ -3553,11 +3553,12 @@ var _ = Describe("Install Plan", func() { } _, err := c.KubernetesInterface().CoreV1().ServiceAccounts(generatedNamespace.GetName()).Create(context.Background(), sa, metav1.CreateOptions{}) Expect(err).ToNot(HaveOccurred()) - // Create token secret for the serviceaccount + By(`Create token secret for the serviceaccount`) _, cleanupSE := newTokenSecret(c, generatedNamespace.GetName(), sa.GetName()) defer cleanupSE() - // see https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/design/scoped-operator-install.md + By(`see https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/design/scoped-operator-install.md`) + By(`create permissions with the ability to get and list CRDs, but not create CRDs`) role := &rbacv1.ClusterRole{ ObjectMeta: metav1.ObjectMeta{ Name: genName("role-"), @@ -3579,7 +3580,6 @@ var _ = Describe("Install Plan", func() { Verbs: []string{"list", "watch", "get", "create", "update", "patch", "delete"}, }, { - // ability to get and list CRDs, but not create CRDs APIGroups: []string{"apiextensions.k8s.io"}, Resources: []string{"customresourcedefinitions"}, Verbs: []string{"get", "list", "watch"}, @@ -3590,7 +3590,7 @@ var _ = Describe("Install Plan", func() { _, err = c.KubernetesInterface().RbacV1().ClusterRoles().Create(context.Background(), role, metav1.CreateOptions{}) Expect(err).ToNot(HaveOccurred()) - // bind role to SA + By(`bind role to SA`) rb := &rbacv1.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{ Name: genName("rb-"), @@ -3614,7 +3614,7 @@ var _ = Describe("Install Plan", func() { Expect(err).ToNot(HaveOccurred()) defer c.KubernetesInterface().RbacV1().ClusterRoles().Delete(context.Background(), role.GetName(), metav1.DeleteOptions{}) - // Update the existing OG to use the ServiceAccount + By(`Update the existing OG to use the ServiceAccount`) Eventually(func() error { existingOG, err := crc.OperatorsV1().OperatorGroups(generatedNamespace.GetName()).Get(context.Background(), fmt.Sprintf("%s-operatorgroup", generatedNamespace.GetName()), metav1.GetOptions{}) if err != nil { @@ -3625,9 +3625,9 @@ var _ = Describe("Install Plan", func() { return err }).Should(Succeed()) - // Wait for the OperatorGroup to be synced and have a status.ServiceAccountRef - // before moving on. Otherwise the catalog operator treats it as an invalid OperatorGroup - // and the InstallPlan is resynced + By(`Wait for the OperatorGroup to be synced and have a status.ServiceAccountRef`) + By(`before moving on. Otherwise the catalog operator treats it as an invalid OperatorGroup`) + By(`and the InstallPlan is resynced`) Eventually(func() (*corev1.ObjectReference, error) { outOG, err := crc.OperatorsV1().OperatorGroups(generatedNamespace.GetName()).Get(context.Background(), fmt.Sprintf("%s-operatorgroup", generatedNamespace.GetName()), metav1.GetOptions{}) if err != nil { @@ -3673,7 +3673,7 @@ var _ = Describe("Install Plan", func() { } csv := newCSV("stable", generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), nil, nil, nil) - // Defer CRD clean up + By(`Defer CRD clean up`) defer func() { Eventually(func() error { return client.IgnoreNotFound(ctx.Ctx().KubeClient().ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Delete(context.Background(), crd.GetName(), metav1.DeleteOptions{})) @@ -3740,7 +3740,7 @@ var _ = Describe("Install Plan", func() { return plan, ctx.Ctx().Client().Get(context.Background(), key, plan) }).Should(HavePhase(operatorsv1alpha1.InstallPlanPhaseComplete)) - // delete installplan, and create one with just a CSV resource which should succeed + By(`delete installplan, and create one with just a CSV resource which should succeed`) By("installing additional resources that are allowed in the SA") err = crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Delete(context.Background(), plan.GetName(), metav1.DeleteOptions{}) Expect(err).ToNot(HaveOccurred()) @@ -3791,7 +3791,7 @@ var _ = Describe("Install Plan", func() { type checkInstallPlanFunc func(fip *operatorsv1alpha1.InstallPlan) bool func validateCRDVersions(t GinkgoTInterface, c operatorclient.ClientInterface, name string, expectedVersions map[string]struct{}) { - // Retrieve CRD information + By(`Retrieve CRD information`) crd, err := c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.Background(), name, metav1.GetOptions{}) require.NoError(t, err) @@ -3801,11 +3801,11 @@ func validateCRDVersions(t GinkgoTInterface, c operatorclient.ClientInterface, n _, ok := expectedVersions[version.Name] require.True(t, ok, "couldn't find %v in expected versions: %#v", version.Name, expectedVersions) - // Remove the entry from the expected steps set (to ensure no duplicates in resolved plan) + By(`Remove the entry from the expected steps set (to ensure no duplicates in resolved plan)`) delete(expectedVersions, version.Name) } - // Should have removed every matching version + By(`Should have removed every matching version`) require.Equal(t, 0, len(expectedVersions), "Actual CRD versions do not match expected") } @@ -3901,7 +3901,7 @@ func waitForInstallPlan(c versioned.Interface, name string, namespace string, ch } func newNginxInstallStrategy(name string, permissions []operatorsv1alpha1.StrategyDeploymentPermissions, clusterPermissions []operatorsv1alpha1.StrategyDeploymentPermissions) operatorsv1alpha1.NamedInstallStrategy { - // Create an nginx details deployment + By(`Create an nginx details deployment`) details := operatorsv1alpha1.StrategyDetailsDeployment{ DeploymentSpecs: []operatorsv1alpha1.StrategyDeploymentSpec{ { @@ -3977,7 +3977,7 @@ func newCSV(name, namespace, replaces string, version semver.Version, owned []ap APIVersion: operatorsv1alpha1.SchemeGroupVersion.String(), } - // set a simple default strategy if none given + By(`set a simple default strategy if none given`) var strategy operatorsv1alpha1.NamedInstallStrategy if namedStrategy == nil { strategy = newNginxInstallStrategy(genName("dep"), nil, nil) @@ -4021,7 +4021,7 @@ func newCSV(name, namespace, replaces string, version semver.Version, owned []ap }, } - // Populate owned and required + By(`Populate owned and required`) for _, crd := range owned { crdVersion := "v1alpha1" for _, v := range crd.Spec.Versions { diff --git a/test/e2e/metrics_e2e_test.go b/test/e2e/metrics_e2e_test.go index 29fa6db87f..4f45f0a123 100644 --- a/test/e2e/metrics_e2e_test.go +++ b/test/e2e/metrics_e2e_test.go @@ -113,7 +113,7 @@ var _ = Describe("Metrics are generated for OLM managed resources", func() { }) It("deletes its associated CSV metrics", func() { - // Verify that when the csv has been deleted, it deletes the corresponding CSV metrics + By(`Verify that when the csv has been deleted, it deletes the corresponding CSV metrics`) Expect(getMetricsFromPod(c, getPodWithLabel(c, "app=olm-operator"))).ToNot(And( ContainElement(LikeMetric(WithFamily("csv_abnormal"), WithName(failingCSV.Name))), ContainElement(LikeMetric(WithFamily("csv_succeeded"), WithName(failingCSV.Name))), @@ -191,7 +191,7 @@ var _ = Describe("Metrics are generated for OLM managed resources", func() { It("generates subscription_sync_total metric", func() { - // Verify metrics have been emitted for subscription + By(`Verify metrics have been emitted for subscription`) Eventually(func() []Metric { return getMetricsFromPod(c, getPodWithLabel(c, "app=catalog-operator")) }).Should(ContainElement(LikeMetric( @@ -205,7 +205,7 @@ var _ = Describe("Metrics are generated for OLM managed resources", func() { It("generates dependency_resolution metric", func() { - // Verify metrics have been emitted for dependency resolution + By(`Verify metrics have been emitted for dependency resolution`) Eventually(func() bool { return Eventually(func() []Metric { return getMetricsFromPod(c, getPodWithLabel(c, "app=catalog-operator")) @@ -357,11 +357,11 @@ var _ = Describe("Metrics are generated for OLM managed resources", func() { }, } cs, cleanupAll := createInternalCatalogSource(c, crc, name, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{mainCRD}, []v1alpha1.ClusterServiceVersion{mainCSV}) - // Note(tflannag): Dependending on how ginkgo orders these test specs, and how bloated the cluster we're running - // this test case against, we risk creating and then immediately deleting the catalogsource before the catalog - // operator can generate all the requisite resources (e.g. the ServiceAccount), which can leave the underlying - // registry Pod in a terminating state until kubelet times out waiting for the generated ServiceAccount - // resource to be present so it can mount it in the registry container. + By(`Note(tflannag): Dependending on how ginkgo orders these test specs, and how bloated the cluster we're running`) + By(`this test case against, we risk creating and then immediately deleting the catalogsource before the catalog`) + By(`operator can generate all the requisite resources (e.g. the ServiceAccount), which can leave the underlying`) + By(`registry Pod in a terminating state until kubelet times out waiting for the generated ServiceAccount`) + By(`resource to be present so it can mount it in the registry container.`) _, err := fetchCatalogSourceOnStatus(crc, cs.GetName(), cs.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ShouldNot(HaveOccurred()) @@ -524,7 +524,7 @@ func extractMetricPortFromPod(pod *corev1.Pod) string { func getMetricsFromPod(client operatorclient.ClientInterface, pod *corev1.Pod) []Metric { ctx.Ctx().Logf("querying pod %s/%s\n", pod.GetNamespace(), pod.GetName()) - // assuming -tls-cert and -tls-key aren't used anywhere else as a parameter value + By(`assuming -tls-cert and -tls-key aren't used anywhere else as a parameter value`) var foundCert, foundKey bool for _, arg := range pod.Spec.Containers[0].Args { matched, err := regexp.MatchString(`^-?-tls-cert`, arg) diff --git a/test/e2e/operator_condition_e2e_test.go b/test/e2e/operator_condition_e2e_test.go index 2f5c8446c1..adeee170e5 100644 --- a/test/e2e/operator_condition_e2e_test.go +++ b/test/e2e/operator_condition_e2e_test.go @@ -42,7 +42,7 @@ var _ = Describe("Operator Condition", func() { c := ctx.Ctx().KubeClient() crc := ctx.Ctx().OperatorClient() - // Create a catalog for csvA, csvB, and csvD + By(`Create a catalog for csvA, csvB, and csvD`) pkgA := genName("a-") pkgB := genName("b-") pkgD := genName("d-") @@ -58,7 +58,7 @@ var _ = Describe("Operator Condition", func() { csvB := newCSV(pkgBStable, generatedNamespace.GetName(), pkgAStable, semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{crd}, nil, &strategyB) csvD := newCSV(pkgDStable, generatedNamespace.GetName(), pkgBStable, semver.MustParse("0.3.0"), []apiextensionsv1.CustomResourceDefinition{crd}, nil, &strategyD) - // Create the initial catalogsources + By(`Create the initial catalogsources`) manifests := []registry.PackageManifest{ { PackageName: pkgA, @@ -77,11 +77,11 @@ var _ = Describe("Operator Condition", func() { cleanupSub := createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subName, catalog, pkgA, stableChannel, pkgAStable, operatorsv1alpha1.ApprovalAutomatic) defer cleanupSub() - // Await csvA's success + By(`Await csvA's success`) _, err = fetchCSV(crc, generatedNamespace.GetName(), csvA.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Get the OperatorCondition for csvA and report that it is not upgradeable + By(`Get the OperatorCondition for csvA and report that it is not upgradeable`) var cond *operatorsv2.OperatorCondition upgradeableFalseCondition := metav1.Condition{ Type: operatorsv2.Upgradeable, @@ -104,7 +104,7 @@ var _ = Describe("Operator Condition", func() { return err }, pollInterval, pollDuration).Should(Succeed()) - // Update the catalogsources + By(`Update the catalogsources`) manifests = []registry.PackageManifest{ { PackageName: pkgA, @@ -116,16 +116,16 @@ var _ = Describe("Operator Condition", func() { } updateInternalCatalog(GinkgoT(), c, crc, catalog, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{crd}, []operatorsv1alpha1.ClusterServiceVersion{csvA, csvB}, manifests) - // Attempt to get the catalog source before creating install plan(s) + By(`Attempt to get the catalog source before creating install plan(s)`) _, err = fetchCatalogSourceOnStatus(crc, catalog, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // csvB will be in Pending phase due to csvA reports Upgradeable=False condition + By(`csvB will be in Pending phase due to csvA reports Upgradeable=False condition`) fetchedCSV, err := fetchCSV(crc, generatedNamespace.GetName(), csvB.GetName(), buildCSVReasonChecker(operatorsv1alpha1.CSVReasonOperatorConditionNotUpgradeable)) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), fetchedCSV.Status.Phase, operatorsv1alpha1.CSVPhasePending) - // Get the OperatorCondition for csvA and report that it is upgradeable, unblocking csvB + By(`Get the OperatorCondition for csvA and report that it is upgradeable, unblocking csvB`) upgradeableTrueCondition := metav1.Condition{ Type: operatorsv2.Upgradeable, Status: metav1.ConditionTrue, @@ -145,12 +145,12 @@ var _ = Describe("Operator Condition", func() { return err }, pollInterval, pollDuration).Should(Succeed()) - // Await csvB's success + By(`Await csvB's success`) _, err = fetchCSV(crc, generatedNamespace.GetName(), csvB.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Get the OperatorCondition for csvB and purposedly change ObservedGeneration - // to cause mismatch generation situation + By(`Get the OperatorCondition for csvB and purposedly change ObservedGeneration`) + By(`to cause mismatch generation situation`) Eventually(func() error { cond, err = crc.OperatorsV2().OperatorConditions(generatedNamespace.GetName()).Get(context.TODO(), csvB.GetName(), metav1.GetOptions{}) if err != nil || currentGen == cond.ObjectMeta.GetGeneration() { @@ -163,7 +163,7 @@ var _ = Describe("Operator Condition", func() { return err }, pollInterval, pollDuration).Should(Succeed()) - // Update the catalogsources + By(`Update the catalogsources`) manifests = []registry.PackageManifest{ { PackageName: pkgA, @@ -175,23 +175,23 @@ var _ = Describe("Operator Condition", func() { } updateInternalCatalog(GinkgoT(), c, crc, catalog, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{crd}, []operatorsv1alpha1.ClusterServiceVersion{csvA, csvB, csvD}, manifests) - // Attempt to get the catalog source before creating install plan(s) + By(`Attempt to get the catalog source before creating install plan(s)`) _, err = fetchCatalogSourceOnStatus(crc, catalog, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // CSVD will be in Pending status due to overrides in csvB's condition + By(`CSVD will be in Pending status due to overrides in csvB's condition`) fetchedCSV, err = fetchCSV(crc, generatedNamespace.GetName(), csvD.GetName(), buildCSVReasonChecker(operatorsv1alpha1.CSVReasonOperatorConditionNotUpgradeable)) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), fetchedCSV.Status.Phase, operatorsv1alpha1.CSVPhasePending) - // Get the OperatorCondition for csvB and override the upgradeable false condition + By(`Get the OperatorCondition for csvB and override the upgradeable false condition`) Eventually(func() error { cond, err = crc.OperatorsV2().OperatorConditions(generatedNamespace.GetName()).Get(context.TODO(), csvB.GetName(), metav1.GetOptions{}) if err != nil { return err } meta.SetStatusCondition(&cond.Spec.Overrides, upgradeableTrueCondition) - // Update the condition + By(`Update the condition`) _, err = crc.OperatorsV2().OperatorConditions(generatedNamespace.GetName()).Update(context.TODO(), cond, metav1.UpdateOptions{}) return err }, pollInterval, pollDuration).Should(Succeed()) diff --git a/test/e2e/operator_groups_e2e_test.go b/test/e2e/operator_groups_e2e_test.go index cd1be8589b..8b184360aa 100644 --- a/test/e2e/operator_groups_e2e_test.go +++ b/test/e2e/operator_groups_e2e_test.go @@ -56,19 +56,19 @@ var _ = Describe("Operator Group", func() { It("e2e functionality", func() { - // Create namespace with specific label - // Create CRD - // Create CSV in operator namespace - // Create operator group that watches namespace and uses specific label - // Verify operator group status contains correct status - // Verify csv in target namespace exists, has copied status, has annotations - // Verify deployments have correct namespace annotation - // (Verify that the operator can operate in the target namespace) - // Update CSV to support no InstallModes - // Verify the CSV transitions to FAILED - // Verify the copied CSV transitions to FAILED - // Delete CSV - // Verify copied CVS is deleted + By(`Create namespace with specific label`) + By(`Create CRD`) + By(`Create CSV in operator namespace`) + By(`Create operator group that watches namespace and uses specific label`) + By(`Verify operator group status contains correct status`) + By(`Verify csv in target namespace exists, has copied status, has annotations`) + By(`Verify deployments have correct namespace annotation`) + By(`(Verify that the operator can operate in the target namespace)`) + By(`Update CSV to support no InstallModes`) + By(`Verify the CSV transitions to FAILED`) + By(`Verify the copied CSV transitions to FAILED`) + By(`Delete CSV`) + By(`Verify copied CVS is deleted`) log := func(s string) { GinkgoT().Logf("%s: %s", time.Now().Format("15:04:05.9999"), s) @@ -128,7 +128,7 @@ var _ = Describe("Operator Group", func() { _, err = crc.OperatorsV1().OperatorGroups(opGroupNamespace).Create(context.TODO(), &operatorGroup, metav1.CreateOptions{}) require.NoError(GinkgoT(), err) - // fetched namespaces might be in any order + By(`fetched namespaces might be in any order`) namespaces := map[string]bool{} namespaces[opGroupNamespace] = true namespaces[createdOtherNamespace.GetName()] = true @@ -156,7 +156,7 @@ var _ = Describe("Operator Group", func() { log("Creating CSV") - // Generate permissions + By(`Generate permissions`) serviceAccountName := genName("nginx-sa") permissions := []v1alpha1.StrategyDeploymentPermissions{ { @@ -171,7 +171,7 @@ var _ = Describe("Operator Group", func() { }, } - // Create a new NamedInstallStrategy + By(`Create a new NamedInstallStrategy`) deploymentName := genName("operator-deployment") namedStrategy := newNginxInstallStrategy(deploymentName, permissions, nil) @@ -306,14 +306,14 @@ var _ = Describe("Operator Group", func() { }) require.NoError(GinkgoT(), err) - // check rbac in target namespace + By(`check rbac in target namespace`) informerFactory := informers.NewSharedInformerFactory(c.KubernetesInterface(), 1*time.Second) roleInformer := informerFactory.Rbac().V1().Roles() roleBindingInformer := informerFactory.Rbac().V1().RoleBindings() clusterRoleInformer := informerFactory.Rbac().V1().ClusterRoles() clusterRoleBindingInformer := informerFactory.Rbac().V1().ClusterRoleBindings() - // kick off informers + By(`kick off informers`) stopCh := make(chan struct{}) defer func() { stopCh <- struct{}{} @@ -329,7 +329,7 @@ var _ = Describe("Operator Group", func() { return informer.HasSynced(), nil } - // wait until the informer has synced to continue + By(`wait until the informer has synced to continue`) err := wait.PollUntil(500*time.Millisecond, synced, stopCh) require.NoError(GinkgoT(), err) } @@ -355,7 +355,7 @@ var _ = Describe("Operator Group", func() { return true, nil }) - // validate provided API clusterroles for the operatorgroup + By(`validate provided API clusterroles for the operatorgroup`) existingClusterRoleList, err := c.KubernetesInterface().RbacV1().ClusterRoles().List(context.TODO(), metav1.ListOptions{ LabelSelector: labels.SelectorFromSet(ownerutil.OwnerLabel(&operatorGroup, "OperatorGroup")).String(), }) @@ -392,7 +392,7 @@ var _ = Describe("Operator Group", func() { } } - // Unsupport all InstallModes + By(`Unsupport all InstallModes`) log("unsupporting all csv installmodes") fetchedCSV, err := crc.OperatorsV1alpha1().ClusterServiceVersions(opGroupNamespace).Get(context.TODO(), csvName, metav1.GetOptions{}) require.NoError(GinkgoT(), err, "could not fetch csv") @@ -400,11 +400,11 @@ var _ = Describe("Operator Group", func() { _, err = crc.OperatorsV1alpha1().ClusterServiceVersions(fetchedCSV.GetNamespace()).Update(context.TODO(), fetchedCSV, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err, "could not update csv installmodes") - // Ensure CSV fails + By(`Ensure CSV fails`) _, err = fetchCSV(crc, opGroupNamespace, csvName, csvFailedChecker) require.NoError(GinkgoT(), err, "csv did not transition to failed as expected") - // ensure deletion cleans up copied CSV + By(`ensure deletion cleans up copied CSV`) log("deleting parent csv") err = crc.OperatorsV1alpha1().ClusterServiceVersions(opGroupNamespace).Delete(context.TODO(), csvName, metav1.DeleteOptions{}) require.NoError(GinkgoT(), err) @@ -448,13 +448,13 @@ var _ = Describe("Operator Group", func() { }) It("role aggregation", func() { - // kubectl -n a8v4sw auth can-i create alp999.cluster.com --as system:serviceaccount:a8v4sw:padmin-xqdfz + By(`kubectl -n a8v4sw auth can-i create alp999.cluster.com --as system:serviceaccount:a8v4sw:padmin-xqdfz`) - // Generate namespaceA - // Generate operatorGroupA - OwnNamespace - // Generate csvA in namespaceA with all installmodes supported - // Create crd so csv succeeds - // Ensure clusterroles created and aggregated for access provided APIs + By(`Generate namespaceA`) + By(`Generate operatorGroupA - OwnNamespace`) + By(`Generate csvA in namespaceA with all installmodes supported`) + By(`Create crd so csv succeeds`) + By(`Ensure clusterroles created and aggregated for access provided APIs`) nsA := genName("a") GinkgoT().Logf("generating namespaceA: %s", nsA) @@ -630,27 +630,27 @@ var _ = Describe("Operator Group", func() { }) It("install mode support", func() { - // Generate namespaceA - // Generate namespaceB - // Create operatorGroupA in namespaceA that selects namespaceA - // Generate csvA with an unfulfilled required CRD and no supported InstallModes in namespaceA - // Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup" - // Update csvA to have OwnNamespace supported=true - // Ensure csvA transitions to Succeeded - // Update operatorGroupA's target namespaces to select namespaceB - // Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup" - // Update csvA to have SingleNamespace supported=true - // Ensure csvA transitions to Pending - // Update operatorGroupA's target namespaces to select namespaceA and namespaceB - // Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup" - // Update csvA to have MultiNamespace supported=true - // Ensure csvA transitions to Pending - // Update operatorGroupA to select all namespaces - // Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup" - // Update csvA to have AllNamespaces supported=true - // Ensure csvA transitions to Pending - - // Generate namespaceA and namespaceB + By(`Generate namespaceA`) + By(`Generate namespaceB`) + By(`Create operatorGroupA in namespaceA that selects namespaceA`) + By(`Generate csvA with an unfulfilled required CRD and no supported InstallModes in namespaceA`) + By(`Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup"`) + By(`Update csvA to have OwnNamespace supported=true`) + By(`Ensure csvA transitions to Succeeded`) + By(`Update operatorGroupA's target namespaces to select namespaceB`) + By(`Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup"`) + By(`Update csvA to have SingleNamespace supported=true`) + By(`Ensure csvA transitions to Pending`) + By(`Update operatorGroupA's target namespaces to select namespaceA and namespaceB`) + By(`Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup"`) + By(`Update csvA to have MultiNamespace supported=true`) + By(`Ensure csvA transitions to Pending`) + By(`Update operatorGroupA to select all namespaces`) + By(`Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup"`) + By(`Update csvA to have AllNamespaces supported=true`) + By(`Ensure csvA transitions to Pending`) + + By(`Generate namespaceA and namespaceB`) nsA := genName("a") nsB := genName("b") @@ -668,7 +668,7 @@ var _ = Describe("Operator Group", func() { }(ns) } - // Generate operatorGroupA + By(`Generate operatorGroupA`) groupA := newOperatorGroup(nsA, genName("a"), nil, nil, []string{nsA}, false) _, err := crc.OperatorsV1().OperatorGroups(nsA).Create(context.TODO(), groupA, metav1.CreateOptions{}) require.NoError(GinkgoT(), err) @@ -676,7 +676,7 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), crc.OperatorsV1().OperatorGroups(nsA).Delete(context.TODO(), groupA.GetName(), metav1.DeleteOptions{})) }() - // Generate csvA in namespaceA with no supported InstallModes + By(`Generate csvA in namespaceA with no supported InstallModes`) crd := newCRD(genName("b")) namedStrategy := newNginxInstallStrategy(genName("dep-"), nil, nil) csv := newCSV("nginx-a", nsA, "", semver.MustParse("0.1.0"), nil, []apiextensionsv1.CustomResourceDefinition{crd}, &namedStrategy) @@ -705,14 +705,14 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), crc.OperatorsV1alpha1().ClusterServiceVersions(nsA).Delete(context.TODO(), csvA.GetName(), metav1.DeleteOptions{})) }() - // Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup" + By(`Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup"`) failedWithUnsupportedOperatorGroup := func(csv *v1alpha1.ClusterServiceVersion) bool { return csvFailedChecker(csv) && csv.Status.Reason == v1alpha1.CSVReasonUnsupportedOperatorGroup } csvA, err = fetchCSV(crc, nsA, csvA.GetName(), failedWithUnsupportedOperatorGroup) require.NoError(GinkgoT(), err) - // Update csvA to have OwnNamespace supported=true + By(`Update csvA to have OwnNamespace supported=true`) csvA.Spec.InstallModes = []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -734,27 +734,27 @@ var _ = Describe("Operator Group", func() { _, err = crc.OperatorsV1alpha1().ClusterServiceVersions(nsA).Update(context.TODO(), csvA, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Create crd so csv succeeds + By(`Create crd so csv succeeds`) cleanupCRD, err := createCRD(c, crd) require.NoError(GinkgoT(), err) defer cleanupCRD() - // Ensure csvA transitions to Succeeded + By(`Ensure csvA transitions to Succeeded`) csvA, err = fetchCSV(crc, nsA, csvA.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Update operatorGroupA's target namespaces to select namespaceB + By(`Update operatorGroupA's target namespaces to select namespaceB`) groupA, err = crc.OperatorsV1().OperatorGroups(nsA).Get(context.TODO(), groupA.GetName(), metav1.GetOptions{}) require.NoError(GinkgoT(), err) groupA.Spec.TargetNamespaces = []string{nsB} _, err = crc.OperatorsV1().OperatorGroups(nsA).Update(context.TODO(), groupA, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup" + By(`Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup"`) csvA, err = fetchCSV(crc, nsA, csvA.GetName(), failedWithUnsupportedOperatorGroup) require.NoError(GinkgoT(), err) - // Update csvA to have SingleNamespace supported=true + By(`Update csvA to have SingleNamespace supported=true`) csvA.Spec.InstallModes = []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -776,22 +776,22 @@ var _ = Describe("Operator Group", func() { _, err = crc.OperatorsV1alpha1().ClusterServiceVersions(nsA).Update(context.TODO(), csvA, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Ensure csvA transitions to Succeeded + By(`Ensure csvA transitions to Succeeded`) csvA, err = fetchCSV(crc, nsA, csvA.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Update operatorGroupA's target namespaces to select namespaceA and namespaceB + By(`Update operatorGroupA's target namespaces to select namespaceA and namespaceB`) groupA, err = crc.OperatorsV1().OperatorGroups(nsA).Get(context.TODO(), groupA.GetName(), metav1.GetOptions{}) require.NoError(GinkgoT(), err) groupA.Spec.TargetNamespaces = []string{nsA, nsB} _, err = crc.OperatorsV1().OperatorGroups(nsA).Update(context.TODO(), groupA, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup" + By(`Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup"`) csvA, err = fetchCSV(crc, nsA, csvA.GetName(), failedWithUnsupportedOperatorGroup) require.NoError(GinkgoT(), err) - // Update csvA to have MultiNamespace supported=true + By(`Update csvA to have MultiNamespace supported=true`) csvA.Spec.InstallModes = []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -813,22 +813,22 @@ var _ = Describe("Operator Group", func() { _, err = crc.OperatorsV1alpha1().ClusterServiceVersions(nsA).Update(context.TODO(), csvA, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Ensure csvA transitions to Succeeded + By(`Ensure csvA transitions to Succeeded`) csvA, err = fetchCSV(crc, nsA, csvA.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Update operatorGroupA's target namespaces to select all namespaces + By(`Update operatorGroupA's target namespaces to select all namespaces`) groupA, err = crc.OperatorsV1().OperatorGroups(nsA).Get(context.TODO(), groupA.GetName(), metav1.GetOptions{}) require.NoError(GinkgoT(), err) groupA.Spec.TargetNamespaces = []string{} _, err = crc.OperatorsV1().OperatorGroups(nsA).Update(context.TODO(), groupA, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup" + By(`Ensure csvA transitions to Failed with reason "UnsupportedOperatorGroup"`) csvA, err = fetchCSV(crc, nsA, csvA.GetName(), failedWithUnsupportedOperatorGroup) require.NoError(GinkgoT(), err) - // Update csvA to have AllNamespaces supported=true + By(`Update csvA to have AllNamespaces supported=true`) csvA.Spec.InstallModes = []v1alpha1.InstallMode{ { Type: v1alpha1.InstallModeTypeOwnNamespace, @@ -850,45 +850,45 @@ var _ = Describe("Operator Group", func() { _, err = crc.OperatorsV1alpha1().ClusterServiceVersions(nsA).Update(context.TODO(), csvA, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Ensure csvA transitions to Pending + By(`Ensure csvA transitions to Pending`) csvA, err = fetchCSV(crc, nsA, csvA.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) }) It("intersection", func() { - // Generate namespaceA - // Generate namespaceB - // Generate namespaceC - // Generate namespaceD - // Generate namespaceE - // Generate operatorGroupD in namespaceD that selects namespace D and E - // Generate csvD in namespaceD - // Wait for csvD to be successful - // Wait for csvD to have a CSV with copied status in namespace E - // Wait for operatorGroupD to have providedAPI annotation with crdD's Kind.version.group - // Generate operatorGroupA in namespaceA that selects AllNamespaces - // Generate csvD in namespaceA - // Wait for csvD to fail with status "InterOperatorGroupOwnerConflict" - // Ensure operatorGroupA's providedAPIs are empty - // Ensure csvD in namespaceD is still successful - // Generate csvA in namespaceA that owns crdA - // Wait for csvA to be successful - // Ensure clusterroles created and aggregated for accessing provided APIs - // Wait for operatorGroupA to have providedAPI annotation with crdA's Kind.version.group in its providedAPIs annotation - // Wait for csvA to have a CSV with copied status in namespace D - // Ensure csvA retains the operatorgroup annotations for operatorgroupA - // Wait for csvA to have a CSV with copied status in namespace C - // Generate operatorGroupB in namespaceB that selects namespace C - // Generate csvB in namespaceB that owns crdA - // Wait for csvB to fail with status "InterOperatorGroupOwnerConflict" - // Delete csvA - // Wait for crdA's Kind.version.group to be removed from operatorGroupA's providedAPIs annotation - // Ensure csvA's deployments are deleted - // Wait for csvB to be successful - // Wait for operatorGroupB to have providedAPI annotation with crdB's Kind.version.group - // Wait for csvB to have a CSV with a copied status in namespace C - - // Create a catalog for csvA, csvB, and csvD + By(`Generate namespaceA`) + By(`Generate namespaceB`) + By(`Generate namespaceC`) + By(`Generate namespaceD`) + By(`Generate namespaceE`) + By(`Generate operatorGroupD in namespaceD that selects namespace D and E`) + By(`Generate csvD in namespaceD`) + By(`Wait for csvD to be successful`) + By(`Wait for csvD to have a CSV with copied status in namespace E`) + By(`Wait for operatorGroupD to have providedAPI annotation with crdD's Kind.version.group`) + By(`Generate operatorGroupA in namespaceA that selects AllNamespaces`) + By(`Generate csvD in namespaceA`) + By(`Wait for csvD to fail with status "InterOperatorGroupOwnerConflict"`) + By(`Ensure operatorGroupA's providedAPIs are empty`) + By(`Ensure csvD in namespaceD is still successful`) + By(`Generate csvA in namespaceA that owns crdA`) + By(`Wait for csvA to be successful`) + By(`Ensure clusterroles created and aggregated for accessing provided APIs`) + By(`Wait for operatorGroupA to have providedAPI annotation with crdA's Kind.version.group in its providedAPIs annotation`) + By(`Wait for csvA to have a CSV with copied status in namespace D`) + By(`Ensure csvA retains the operatorgroup annotations for operatorgroupA`) + By(`Wait for csvA to have a CSV with copied status in namespace C`) + By(`Generate operatorGroupB in namespaceB that selects namespace C`) + By(`Generate csvB in namespaceB that owns crdA`) + By(`Wait for csvB to fail with status "InterOperatorGroupOwnerConflict"`) + By(`Delete csvA`) + By(`Wait for crdA's Kind.version.group to be removed from operatorGroupA's providedAPIs annotation`) + By(`Ensure csvA's deployments are deleted`) + By(`Wait for csvB to be successful`) + By(`Wait for operatorGroupB to have providedAPI annotation with crdB's Kind.version.group`) + By(`Wait for csvB to have a CSV with a copied status in namespace C`) + + By(`Create a catalog for csvA, csvB, and csvD`) pkgA := genName("a-") pkgB := genName("b-") pkgD := genName("d-") @@ -909,7 +909,7 @@ var _ = Describe("Operator Group", func() { csvB := newCSV(pkgBStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crdA, crdB}, nil, &strategyB) csvD := newCSV(pkgDStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crdD}, nil, &strategyD) - // Create namespaces + By(`Create namespaces`) nsA, nsB, nsC, nsD, nsE := genName("a-"), genName("b-"), genName("c-"), genName("d-"), genName("e-") for _, ns := range []string{nsA, nsB, nsC, nsD, nsE} { namespace := &corev1.Namespace{ @@ -924,7 +924,7 @@ var _ = Describe("Operator Group", func() { }(ns) } - // Create the initial catalogsources + By(`Create the initial catalogsources`) manifests := []registry.PackageManifest{ { PackageName: pkgA, @@ -963,7 +963,7 @@ var _ = Describe("Operator Group", func() { _, err = fetchCatalogSourceOnStatus(crc, catalog, nsD, catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // Create operatorgroups + By(`Create operatorgroups`) groupA := newOperatorGroup(nsA, genName("a-"), nil, nil, nil, false) groupB := newOperatorGroup(nsB, genName("b-"), nil, nil, []string{nsC}, false) groupD := newOperatorGroup(nsD, genName("d-"), nil, nil, []string{nsD, nsE}, false) @@ -975,7 +975,7 @@ var _ = Describe("Operator Group", func() { }(group.GetNamespace(), group.GetName()) } - // Create subscription for csvD in namespaceD + By(`Create subscription for csvD in namespaceD`) subDName := genName("d-") cleanupSubD := createSubscriptionForCatalog(crc, nsD, subDName, catalog, pkgD, stableChannel, pkgDStable, v1alpha1.ApprovalAutomatic) defer cleanupSubD() @@ -983,22 +983,22 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subD) - // Await csvD's success + By(`Await csvD's success`) _, err = fetchCSV(crc, nsD, csvD.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Await csvD's copy in namespaceE + By(`Await csvD's copy in namespaceE`) _, err = fetchCSV(crc, nsE, csvD.GetName(), csvCopiedChecker) require.NoError(GinkgoT(), err) - // Await annotation on groupD + By(`Await annotation on groupD`) q := func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsD).Get(context.TODO(), groupD.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{v1.OperatorGroupProvidedAPIsAnnotationKey: kvgD})) - // Create subscription for csvD2 in namespaceA + By(`Create subscription for csvD2 in namespaceA`) subD2Name := genName("d2-") cleanupSubD2 := createSubscriptionForCatalog(crc, nsA, subD2Name, catalog, pkgD, stableChannel, pkgDStable, v1alpha1.ApprovalAutomatic) defer cleanupSubD2() @@ -1006,23 +1006,23 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subD2) - // Await csvD2's failure + By(`Await csvD2's failure`) csvD2, err := fetchCSV(crc, nsA, csvD.GetName(), csvFailedChecker) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), v1alpha1.CSVReasonInterOperatorGroupOwnerConflict, csvD2.Status.Reason) - // Ensure groupA's annotations are blank + By(`Ensure groupA's annotations are blank`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsA).Get(context.TODO(), groupA.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{})) - // Ensure csvD is still successful + By(`Ensure csvD is still successful`) _, err = fetchCSV(crc, nsD, csvD.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Create subscription for csvA in namespaceA + By(`Create subscription for csvA in namespaceA`) subAName := genName("a-") cleanupSubA := createSubscriptionForCatalog(crc, nsA, subAName, catalog, pkgA, stableChannel, pkgAStable, v1alpha1.ApprovalAutomatic) defer cleanupSubA() @@ -1030,11 +1030,11 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subA) - // Await csvA's success + By(`Await csvA's success`) _, err = fetchCSV(crc, nsA, csvA.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Ensure clusterroles created and aggregated for access provided APIs + By(`Ensure clusterroles created and aggregated for access provided APIs`) padmin, cleanupPadmin := createProjectAdmin(GinkgoT(), c, nsA) defer cleanupPadmin() @@ -1062,18 +1062,18 @@ var _ = Describe("Operator Group", func() { }) require.NoError(GinkgoT(), err) - // Await annotation on groupA + By(`Await annotation on groupA`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsA).Get(context.TODO(), groupA.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{v1.OperatorGroupProvidedAPIsAnnotationKey: kvgA})) - // Wait for csvA to have a CSV with copied status in namespace D + By(`Wait for csvA to have a CSV with copied status in namespace D`) csvAinNsD, err := fetchCSV(crc, nsD, csvA.GetName(), csvCopiedChecker) require.NoError(GinkgoT(), err) - // trigger a resync of operatorgropuD + By(`trigger a resync of operatorgropuD`) fetchedGroupD, err := crc.OperatorsV1().OperatorGroups(nsD).Get(context.TODO(), groupD.GetName(), metav1.GetOptions{}) require.NoError(GinkgoT(), err) @@ -1081,7 +1081,7 @@ var _ = Describe("Operator Group", func() { _, err = crc.OperatorsV1().OperatorGroups(nsD).Update(context.TODO(), fetchedGroupD, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Ensure csvA retains the operatorgroup annotations for operatorgroupA + By(`Ensure csvA retains the operatorgroup annotations for operatorgroupA`) csvAinNsD, err = fetchCSV(crc, nsD, csvA.GetName(), csvCopiedChecker) require.NoError(GinkgoT(), err) @@ -1089,11 +1089,11 @@ var _ = Describe("Operator Group", func() { require.Equal(GinkgoT(), nsA, csvAinNsD.Annotations[v1.OperatorGroupNamespaceAnnotationKey]) require.Equal(GinkgoT(), nsA, csvAinNsD.Labels[v1alpha1.CopiedLabelKey]) - // Await csvA's copy in namespaceC + By(`Await csvA's copy in namespaceC`) _, err = fetchCSV(crc, nsC, csvA.GetName(), csvCopiedChecker) require.NoError(GinkgoT(), err) - // Create subscription for csvB in namespaceB + By(`Create subscription for csvB in namespaceB`) subBName := genName("b-") cleanupSubB := createSubscriptionForCatalog(crc, nsB, subBName, catalog, pkgB, stableChannel, pkgBStable, v1alpha1.ApprovalAutomatic) defer cleanupSubB() @@ -1101,40 +1101,40 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subB) - // Await csvB's failure + By(`Await csvB's failure`) fetchedB, err := fetchCSV(crc, nsB, csvB.GetName(), csvFailedChecker) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), v1alpha1.CSVReasonInterOperatorGroupOwnerConflict, fetchedB.Status.Reason) - // Ensure no annotation on groupB + By(`Ensure no annotation on groupB`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsB).Get(context.TODO(), groupB.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{})) - // Delete csvA + By(`Delete csvA`) require.NoError(GinkgoT(), crc.OperatorsV1alpha1().ClusterServiceVersions(nsA).Delete(context.TODO(), csvA.GetName(), metav1.DeleteOptions{})) - // Ensure annotations are removed from groupA + By(`Ensure annotations are removed from groupA`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsA).Get(context.TODO(), groupA.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{v1.OperatorGroupProvidedAPIsAnnotationKey: ""})) - // Ensure csvA's deployment is deleted + By(`Ensure csvA's deployment is deleted`) require.NoError(GinkgoT(), waitForDeploymentToDelete(generatedNamespace.GetName(), pkgAStable, c)) - // Await csvB's success + By(`Await csvB's success`) _, err = fetchCSV(crc, nsB, csvB.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Await csvB's copy in namespace C + By(`Await csvB's copy in namespace C`) _, err = fetchCSV(crc, nsC, csvB.GetName(), csvCopiedChecker) require.NoError(GinkgoT(), err) - // Ensure annotations exist on group B + By(`Ensure annotations exist on group B`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsB).Get(context.TODO(), groupB.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err @@ -1143,30 +1143,30 @@ var _ = Describe("Operator Group", func() { }) It("static provider", func() { - // Generate namespaceA - // Generate namespaceB - // Generate namespaceC - // Generate namespaceD - // Create static operatorGroupA in namespaceA that targets namespaceD with providedAPIs annotation containing KindA.version.group - // Create operatorGroupB in namespaceB that targets all namespaces - // Create operatorGroupC in namespaceC that targets namespaceC - // Create csvA in namespaceB that provides KindA.version.group - // Wait for csvA in namespaceB to fail - // Ensure no providedAPI annotations on operatorGroupB - // Ensure providedAPI annotations are unchanged on operatorGroupA - // Create csvA in namespaceC - // Wait for csvA in namespaceC to succeed - // Ensure KindA.version.group providedAPI annotation on operatorGroupC - // Create csvB in namespaceB that provides KindB.version.group - // Wait for csvB to succeed - // Wait for csvB to be copied to namespaceA, namespaceC, and namespaceD - // Wait for KindB.version.group to exist in operatorGroupB's providedAPIs annotation - // Add namespaceD to operatorGroupC's targetNamespaces - // Wait for csvA in namespaceC to FAIL with status "InterOperatorGroupOwnerConflict" - // Wait for KindA.version.group providedAPI annotation to be removed from operatorGroupC's providedAPIs annotation - // Ensure KindA.version.group providedAPI annotation on operatorGroupA - - // Create a catalog for csvA, csvB + By(`Generate namespaceA`) + By(`Generate namespaceB`) + By(`Generate namespaceC`) + By(`Generate namespaceD`) + By(`Create static operatorGroupA in namespaceA that targets namespaceD with providedAPIs annotation containing KindA.version.group`) + By(`Create operatorGroupB in namespaceB that targets all namespaces`) + By(`Create operatorGroupC in namespaceC that targets namespaceC`) + By(`Create csvA in namespaceB that provides KindA.version.group`) + By(`Wait for csvA in namespaceB to fail`) + By(`Ensure no providedAPI annotations on operatorGroupB`) + By(`Ensure providedAPI annotations are unchanged on operatorGroupA`) + By(`Create csvA in namespaceC`) + By(`Wait for csvA in namespaceC to succeed`) + By(`Ensure KindA.version.group providedAPI annotation on operatorGroupC`) + By(`Create csvB in namespaceB that provides KindB.version.group`) + By(`Wait for csvB to succeed`) + By(`Wait for csvB to be copied to namespaceA, namespaceC, and namespaceD`) + By(`Wait for KindB.version.group to exist in operatorGroupB's providedAPIs annotation`) + By(`Add namespaceD to operatorGroupC's targetNamespaces`) + By(`Wait for csvA in namespaceC to FAIL with status "InterOperatorGroupOwnerConflict"`) + By(`Wait for KindA.version.group providedAPI annotation to be removed from operatorGroupC's providedAPIs annotation`) + By(`Ensure KindA.version.group providedAPI annotation on operatorGroupA`) + + By(`Create a catalog for csvA, csvB`) pkgA := genName("a-") pkgB := genName("b-") pkgAStable := pkgA + "-stable" @@ -1181,7 +1181,7 @@ var _ = Describe("Operator Group", func() { csvA := newCSV(pkgAStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crdA}, nil, &strategyA) csvB := newCSV(pkgBStable, generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crdB}, nil, &strategyB) - // Create namespaces + By(`Create namespaces`) nsA, nsB, nsC, nsD := genName("a-"), genName("b-"), genName("c-"), genName("d-") for _, ns := range []string{nsA, nsB, nsC, nsD} { @@ -1197,7 +1197,7 @@ var _ = Describe("Operator Group", func() { }(ns) } - // Create the initial catalogsources + By(`Create the initial catalogsources`) manifests := []registry.PackageManifest{ { PackageName: pkgA, @@ -1215,7 +1215,7 @@ var _ = Describe("Operator Group", func() { }, } - // Create catalog in namespaceB and namespaceC + By(`Create catalog in namespaceB and namespaceC`) catalog := genName("catalog-") _, cleanupCatalogSource := createInternalCatalogSource(c, crc, catalog, nsB, manifests, []apiextensionsv1.CustomResourceDefinition{crdA, crdB}, []v1alpha1.ClusterServiceVersion{csvA, csvB}) defer cleanupCatalogSource() @@ -1226,7 +1226,7 @@ var _ = Describe("Operator Group", func() { _, err = fetchCatalogSourceOnStatus(crc, catalog, nsC, catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // Create OperatorGroups + By(`Create OperatorGroups`) groupA := newOperatorGroup(nsA, genName("a-"), map[string]string{v1.OperatorGroupProvidedAPIsAnnotationKey: kvgA}, nil, []string{nsD}, true) groupB := newOperatorGroup(nsB, genName("b-"), nil, nil, nil, false) groupC := newOperatorGroup(nsC, genName("d-"), nil, nil, []string{nsC}, false) @@ -1238,7 +1238,7 @@ var _ = Describe("Operator Group", func() { }(group.GetNamespace(), group.GetName()) } - // Create subscription for csvA in namespaceB + By(`Create subscription for csvA in namespaceB`) subAName := genName("a-") cleanupSubA := createSubscriptionForCatalog(crc, nsB, subAName, catalog, pkgA, stableChannel, pkgAStable, v1alpha1.ApprovalAutomatic) defer cleanupSubA() @@ -1246,51 +1246,51 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subA) - // Await csvA's failure + By(`Await csvA's failure`) fetchedCSVA, err := fetchCSV(crc, nsB, csvA.GetName(), csvFailedChecker) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), v1alpha1.CSVReasonInterOperatorGroupOwnerConflict, fetchedCSVA.Status.Reason) - // Ensure operatorGroupB doesn't have providedAPI annotation + By(`Ensure operatorGroupB doesn't have providedAPI annotation`) q := func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsB).Get(context.TODO(), groupB.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{})) - // Ensure operatorGroupA still has KindA.version.group in its providedAPIs annotation + By(`Ensure operatorGroupA still has KindA.version.group in its providedAPIs annotation`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsA).Get(context.TODO(), groupA.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{v1.OperatorGroupProvidedAPIsAnnotationKey: kvgA})) - // Create subscription for csvA in namespaceC + By(`Create subscription for csvA in namespaceC`) cleanupSubAC := createSubscriptionForCatalog(crc, nsC, subAName, catalog, pkgA, stableChannel, pkgAStable, v1alpha1.ApprovalAutomatic) defer cleanupSubAC() subAC, err := fetchSubscription(crc, nsC, subAName, subscriptionHasInstallPlanChecker()) require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subAC) - // Await csvA's success + By(`Await csvA's success`) _, err = fetchCSV(crc, nsC, csvA.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Ensure operatorGroupC has KindA.version.group in its providedAPIs annotation + By(`Ensure operatorGroupC has KindA.version.group in its providedAPIs annotation`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsC).Get(context.TODO(), groupC.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{v1.OperatorGroupProvidedAPIsAnnotationKey: kvgA})) - // Ensure operatorGroupA still has KindA.version.group in its providedAPIs annotation + By(`Ensure operatorGroupA still has KindA.version.group in its providedAPIs annotation`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsA).Get(context.TODO(), groupA.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{v1.OperatorGroupProvidedAPIsAnnotationKey: kvgA})) - // Create subscription for csvB in namespaceB + By(`Create subscription for csvB in namespaceB`) subBName := genName("b-") cleanupSubB := createSubscriptionForCatalog(crc, nsB, subBName, catalog, pkgB, stableChannel, pkgBStable, v1alpha1.ApprovalAutomatic) defer cleanupSubB() @@ -1298,11 +1298,11 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subB) - // Await csvB's success + By(`Await csvB's success`) _, err = fetchCSV(crc, nsB, csvB.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Await copied csvBs + By(`Await copied csvBs`) _, err = fetchCSV(crc, nsA, csvB.GetName(), csvCopiedChecker) require.NoError(GinkgoT(), err) _, err = fetchCSV(crc, nsC, csvB.GetName(), csvCopiedChecker) @@ -1310,40 +1310,40 @@ var _ = Describe("Operator Group", func() { _, err = fetchCSV(crc, nsD, csvB.GetName(), csvCopiedChecker) require.NoError(GinkgoT(), err) - // Ensure operatorGroupB has KindB.version.group in its providedAPIs annotation + By(`Ensure operatorGroupB has KindB.version.group in its providedAPIs annotation`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsB).Get(context.TODO(), groupB.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{v1.OperatorGroupProvidedAPIsAnnotationKey: kvgB})) - // Ensure operatorGroupA still has KindA.version.group in its providedAPIs annotation + By(`Ensure operatorGroupA still has KindA.version.group in its providedAPIs annotation`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsA).Get(context.TODO(), groupA.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{v1.OperatorGroupProvidedAPIsAnnotationKey: kvgA})) - // Add namespaceD to operatorGroupC's targetNamespaces + By(`Add namespaceD to operatorGroupC's targetNamespaces`) groupC, err = crc.OperatorsV1().OperatorGroups(groupC.GetNamespace()).Get(context.TODO(), groupC.GetName(), metav1.GetOptions{}) require.NoError(GinkgoT(), err) groupC.Spec.TargetNamespaces = []string{nsC, nsD} _, err = crc.OperatorsV1().OperatorGroups(groupC.GetNamespace()).Update(context.TODO(), groupC, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Wait for csvA in namespaceC to fail with status "InterOperatorGroupOwnerConflict" + By(`Wait for csvA in namespaceC to fail with status "InterOperatorGroupOwnerConflict"`) fetchedCSVA, err = fetchCSV(crc, nsC, csvA.GetName(), csvFailedChecker) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), v1alpha1.CSVReasonInterOperatorGroupOwnerConflict, fetchedCSVA.Status.Reason) - // Wait for crdA's providedAPIs to be removed from operatorGroupC's providedAPIs annotation + By(`Wait for crdA's providedAPIs to be removed from operatorGroupC's providedAPIs annotation`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsC).Get(context.TODO(), groupC.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err } require.NoError(GinkgoT(), awaitAnnotations(GinkgoT(), q, map[string]string{v1.OperatorGroupProvidedAPIsAnnotationKey: ""})) - // Ensure operatorGroupA still has KindA.version.group in its providedAPIs annotation + By(`Ensure operatorGroupA still has KindA.version.group in its providedAPIs annotation`) q = func() (metav1.ObjectMeta, error) { g, err := crc.OperatorsV1().OperatorGroups(nsA).Get(context.TODO(), groupA.GetName(), metav1.GetOptions{}) return g.ObjectMeta, err @@ -1388,7 +1388,7 @@ var _ = Describe("Operator Group", func() { }) require.NoError(GinkgoT(), err) GinkgoT().Log("Creating CSV") - // Generate permissions + By(`Generate permissions`) serviceAccountName := genName("nginx-sa") permissions := []v1alpha1.StrategyDeploymentPermissions{ { @@ -1460,13 +1460,13 @@ var _ = Describe("Operator Group", func() { } c.DeleteRoleBinding(roleBinding.GetNamespace(), roleBinding.GetName(), metav1.NewDeleteOptions(0)) }() - // Create a new NamedInstallStrategy + By(`Create a new NamedInstallStrategy`) deploymentName := genName("operator-deployment") namedStrategy := newNginxInstallStrategy(deploymentName, permissions, nil) aCSV := newCSV(csvName, opGroupNamespace, "", semver.MustParse("0.0.0"), []apiextensionsv1.CustomResourceDefinition{mainCRD}, nil, &namedStrategy) - // Use the It spec name as label after stripping whitespaces + By(`Use the It spec name as label after stripping whitespaces`) aCSV.Labels = map[string]string{"label": K8sSafeCurrentTestDescription()} createdCSV, err := crc.OperatorsV1alpha1().ClusterServiceVersions(opGroupNamespace).Create(context.TODO(), &aCSV, metav1.CreateOptions{}) require.NoError(GinkgoT(), err) @@ -1639,7 +1639,7 @@ var _ = Describe("Operator Group", func() { log("Creating operator group") serviceAccountName := genName("nginx-sa") - // intentionally creating an operator group without a service account already existing + By(`intentionally creating an operator group without a service account already existing`) operatorGroup := v1.OperatorGroup{ ObjectMeta: metav1.ObjectMeta{ Name: genName("e2e-operator-group-"), @@ -1655,7 +1655,7 @@ var _ = Describe("Operator Group", func() { log("Creating CSV") - // Create a new NamedInstallStrategy + By(`Create a new NamedInstallStrategy`) deploymentName := genName("operator-deployment") namedStrategy := newNginxInstallStrategy(deploymentName, nil, nil) @@ -1675,7 +1675,7 @@ var _ = Describe("Operator Group", func() { _, err = c.CreateServiceAccount(serviceAccount) require.NoError(GinkgoT(), err) - // Create token secret for the serviceaccount + By(`Create token secret for the serviceaccount`) _, cleanupSE := newTokenSecret(c, newNamespaceName, serviceAccount.GetName()) defer cleanupSE() @@ -1690,7 +1690,7 @@ var _ = Describe("Operator Group", func() { }) require.NoError(GinkgoT(), err) - // now add cluster admin permissions to service account + By(`now add cluster admin permissions to service account`) role := &rbacv1.Role{ ObjectMeta: metav1.ObjectMeta{ Namespace: newNamespaceName, @@ -1775,7 +1775,7 @@ var _ = Describe("Operator Group", func() { log("Creating operator group") serviceAccountName := genName("nginx-sa") - // intentionally creating an operator group without a service account already existing + By(`intentionally creating an operator group without a service account already existing`) operatorGroup := v1.OperatorGroup{ ObjectMeta: metav1.ObjectMeta{ Name: genName("e2e-operator-group-"), @@ -1791,7 +1791,7 @@ var _ = Describe("Operator Group", func() { log("Creating CSV") - // Create a new NamedInstallStrategy + By(`Create a new NamedInstallStrategy`) deploymentName := genName("operator-deployment") namedStrategy := newNginxInstallStrategy(deploymentName, nil, nil) @@ -1811,7 +1811,7 @@ var _ = Describe("Operator Group", func() { _, err = c.CreateServiceAccount(serviceAccount) require.NoError(GinkgoT(), err) - // Create token secret for the serviceaccount + By(`Create token secret for the serviceaccount`) _, cleanupSE := newTokenSecret(c, newNamespaceName, serviceAccount.GetName()) defer cleanupSE() @@ -1826,7 +1826,7 @@ var _ = Describe("Operator Group", func() { }) require.NoError(GinkgoT(), err) - // now remove operator group specified service account + By(`now remove operator group specified service account`) createdOpGroup, err := crc.OperatorsV1().OperatorGroups(newNamespaceName).Get(context.TODO(), operatorGroup.GetName(), metav1.GetOptions{}) require.NoError(GinkgoT(), err) createdOpGroup.Spec.ServiceAccountName = "" @@ -1845,9 +1845,9 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) }) - // Versions of OLM at 0.14.1 and older had a bug that would place the wrong namespace annotation on copied CSVs, - // preventing them from being GCd. This ensures that any leftover CSVs in that state are properly cleared up. It("cleanup csvs with bad namespace annotation", func() { + By(`Versions of OLM at 0.14.1 and older had a bug that would place the wrong namespace annotation on copied CSVs,`) + By(`preventing them from being GCd. This ensures that any leftover CSVs in that state are properly cleared up.`) csvName := genName("another-csv-") // must be lowercase for DNS-1123 validation @@ -1881,7 +1881,7 @@ var _ = Describe("Operator Group", func() { }) require.NoError(GinkgoT(), err) GinkgoT().Log("Creating CSV") - // Generate permissions + By(`Generate permissions`) serviceAccountName := genName("nginx-sa") permissions := []v1alpha1.StrategyDeploymentPermissions{ { @@ -1953,13 +1953,13 @@ var _ = Describe("Operator Group", func() { } c.DeleteRoleBinding(roleBinding.GetNamespace(), roleBinding.GetName(), metav1.NewDeleteOptions(0)) }() - // Create a new NamedInstallStrategy + By(`Create a new NamedInstallStrategy`) deploymentName := genName("operator-deployment") namedStrategy := newNginxInstallStrategy(deploymentName, permissions, nil) aCSV := newCSV(csvName, opGroupNamespace, "", semver.MustParse("0.0.0"), []apiextensionsv1.CustomResourceDefinition{mainCRD}, nil, &namedStrategy) - // Use the It spec name as label after stripping whitespaces + By(`Use the It spec name as label after stripping whitespaces`) aCSV.Labels = map[string]string{"label": K8sSafeCurrentTestDescription()} createdCSV, err := crc.OperatorsV1alpha1().ClusterServiceVersions(opGroupNamespace).Create(context.TODO(), &aCSV, metav1.CreateOptions{}) require.NoError(GinkgoT(), err) @@ -2100,9 +2100,9 @@ var _ = Describe("Operator Group", func() { GinkgoT().Logf("Error (in %v): %v", opGroupNamespace, fetchErr.Error()) return false, fetchErr } - // The CSV with the wrong annotation could have been replaced with a new copied CSV by this time - // If we find a CSV in the namespace, and it contains the correct annotation, it means the CSV - // with the wrong annotation was GCed + By(`The CSV with the wrong annotation could have been replaced with a new copied CSV by this time`) + By(`If we find a CSV in the namespace, and it contains the correct annotation, it means the CSV`) + By(`with the wrong annotation was GCed`) if csv.Annotations[v1.OperatorGroupNamespaceAnnotationKey] != csv.GetNamespace() { return true, nil } @@ -2112,7 +2112,7 @@ var _ = Describe("Operator Group", func() { }) It("OperatorGroupLabels", func() { - // Create the namespaces that will have an OperatorGroup Label applied. + By(`Create the namespaces that will have an OperatorGroup Label applied.`) testNamespaceA := genName("namespace-a-") testNamespaceB := genName("namespace-b-") testNamespaceC := genName("namespace-c-") @@ -2120,7 +2120,7 @@ var _ = Describe("Operator Group", func() { testNamespaceA, testNamespaceB, testNamespaceC, } - // Create the namespaces + By(`Create the namespaces`) for _, namespace := range testNamespaces { _, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.TODO(), &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ @@ -2130,7 +2130,7 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) } - // Cleanup namespaces + By(`Cleanup namespaces`) defer func() { for _, namespace := range testNamespaces { err := c.KubernetesInterface().CoreV1().Namespaces().Delete(context.TODO(), namespace, metav1.DeleteOptions{}) @@ -2138,7 +2138,7 @@ var _ = Describe("Operator Group", func() { } }() - // Create an OperatorGroup + By(`Create an OperatorGroup`) operatorGroup := &v1.OperatorGroup{ ObjectMeta: metav1.ObjectMeta{ Name: genName("e2e-operator-group-"), @@ -2151,17 +2151,17 @@ var _ = Describe("Operator Group", func() { operatorGroup, err := crc.OperatorsV1().OperatorGroups(testNamespaceA).Create(context.TODO(), operatorGroup, metav1.CreateOptions{}) require.NoError(GinkgoT(), err) - // Cleanup OperatorGroup + By(`Cleanup OperatorGroup`) defer func() { err := crc.OperatorsV1().OperatorGroups(testNamespaceA).Delete(context.TODO(), operatorGroup.GetName(), metav1.DeleteOptions{}) require.NoError(GinkgoT(), err) }() - // Create the OperatorGroup Label + By(`Create the OperatorGroup Label`) ogLabel, err := getOGLabelKey(operatorGroup) require.NoError(GinkgoT(), err) - // Create list options + By(`Create list options`) listOptions := metav1.ListOptions{ LabelSelector: labels.Set(map[string]string{ogLabel: ""}).String(), } @@ -2169,7 +2169,7 @@ var _ = Describe("Operator Group", func() { namespaceList, err := pollForNamespaceListCount(c, listOptions, 0) require.NoError(GinkgoT(), err) - // Update the OperatorGroup to include a single namespace + By(`Update the OperatorGroup to include a single namespace`) operatorGroup.Spec.TargetNamespaces = []string{testNamespaceA} updateOGSpecFunc := updateOperatorGroupSpecFunc(GinkgoT(), crc, testNamespaceA, operatorGroup.GetName()) require.NoError(GinkgoT(), retry.RetryOnConflict(retry.DefaultBackoff, updateOGSpecFunc(operatorGroup.Spec))) @@ -2178,7 +2178,7 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.True(GinkgoT(), checkForOperatorGroupLabels(operatorGroup, namespaceList.Items)) - // Update the OperatorGroup to include two namespaces + By(`Update the OperatorGroup to include two namespaces`) operatorGroup.Spec.TargetNamespaces = []string{testNamespaceA, testNamespaceC} require.NoError(GinkgoT(), retry.RetryOnConflict(retry.DefaultBackoff, updateOGSpecFunc(operatorGroup.Spec))) @@ -2186,7 +2186,7 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.True(GinkgoT(), checkForOperatorGroupLabels(operatorGroup, namespaceList.Items)) - // Update the OperatorGroup to include three namespaces + By(`Update the OperatorGroup to include three namespaces`) operatorGroup.Spec.TargetNamespaces = []string{testNamespaceA, testNamespaceB, testNamespaceC} require.NoError(GinkgoT(), retry.RetryOnConflict(retry.DefaultBackoff, updateOGSpecFunc(operatorGroup.Spec))) @@ -2194,7 +2194,7 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.True(GinkgoT(), checkForOperatorGroupLabels(operatorGroup, namespaceList.Items)) - // Update the OperatorGroup to include two namespaces + By(`Update the OperatorGroup to include two namespaces`) operatorGroup.Spec.TargetNamespaces = []string{testNamespaceA, testNamespaceC} require.NoError(GinkgoT(), retry.RetryOnConflict(retry.DefaultBackoff, updateOGSpecFunc(operatorGroup.Spec))) @@ -2202,7 +2202,7 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.True(GinkgoT(), checkForOperatorGroupLabels(operatorGroup, namespaceList.Items)) - // Make the OperatorGroup a Cluster OperatorGroup. + By(`Make the OperatorGroup a Cluster OperatorGroup.`) operatorGroup.Spec.TargetNamespaces = []string{} require.NoError(GinkgoT(), retry.RetryOnConflict(retry.DefaultBackoff, updateOGSpecFunc(operatorGroup.Spec))) @@ -2211,7 +2211,7 @@ var _ = Describe("Operator Group", func() { }) It("CleanupDeletedOperatorGroupLabels", func() { - // Create the namespaces that will have an OperatorGroup Label applied. + By(`Create the namespaces that will have an OperatorGroup Label applied.`) testNamespaceA := genName("namespace-a-") testNamespaceB := genName("namespace-b-") testNamespaceC := genName("namespace-c-") @@ -2219,7 +2219,7 @@ var _ = Describe("Operator Group", func() { testNamespaceA, testNamespaceB, testNamespaceC, } - // Create the namespaces + By(`Create the namespaces`) for _, namespace := range testNamespaces { _, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.TODO(), &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ @@ -2229,7 +2229,7 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) } - // Cleanup namespaces + By(`Cleanup namespaces`) defer func() { for _, namespace := range testNamespaces { err := c.KubernetesInterface().CoreV1().Namespaces().Delete(context.TODO(), namespace, metav1.DeleteOptions{}) @@ -2237,7 +2237,7 @@ var _ = Describe("Operator Group", func() { } }() - // Create an OperatorGroup with three target namespaces. + By(`Create an OperatorGroup with three target namespaces.`) operatorGroup := &v1.OperatorGroup{ ObjectMeta: metav1.ObjectMeta{ Name: genName("e2e-operator-group-"), @@ -2250,11 +2250,11 @@ var _ = Describe("Operator Group", func() { operatorGroup, err := crc.OperatorsV1().OperatorGroups(testNamespaceA).Create(context.TODO(), operatorGroup, metav1.CreateOptions{}) require.NoError(GinkgoT(), err) - // Create the OperatorGroup Label + By(`Create the OperatorGroup Label`) ogLabel, err := getOGLabelKey(operatorGroup) require.NoError(GinkgoT(), err) - // Create list options + By(`Create list options`) listOptions := metav1.ListOptions{ LabelSelector: labels.Set(map[string]string{ogLabel: ""}).String(), } @@ -2263,11 +2263,11 @@ var _ = Describe("Operator Group", func() { require.NoError(GinkgoT(), err) require.True(GinkgoT(), checkForOperatorGroupLabels(operatorGroup, namespaceList.Items)) - // Delete the operatorGroup. + By(`Delete the operatorGroup.`) err = crc.OperatorsV1().OperatorGroups(testNamespaceA).Delete(context.TODO(), operatorGroup.GetName(), metav1.DeleteOptions{}) require.NoError(GinkgoT(), err) - // Check that no namespaces have the OperatorGroup. + By(`Check that no namespaces have the OperatorGroup.`) namespaceList, err = pollForNamespaceListCount(c, listOptions, 0) require.NoError(GinkgoT(), err) }) @@ -2284,7 +2284,7 @@ var _ = Describe("Operator Group", func() { c = newKubeClient() crc = newCRClient() - // Create the namespaces that will have an OperatorGroup Label applied. + By(`Create the namespaces that will have an OperatorGroup Label applied.`) testNamespaceA = genName("namespace-a-") testNamespaceB := genName("namespace-b-") testNamespaceC := genName("namespace-c-") @@ -2292,7 +2292,7 @@ var _ = Describe("Operator Group", func() { testNamespaceA, testNamespaceB, testNamespaceC, } - // Create the namespaces + By(`Create the namespaces`) for _, namespace := range testNamespaces { _, err := c.KubernetesInterface().CoreV1().Namespaces().Create(context.TODO(), &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ @@ -2304,7 +2304,7 @@ var _ = Describe("Operator Group", func() { }) AfterEach(func() { - // Cleanup namespaces + By(`Cleanup namespaces`) for _, namespace := range testNamespaces { err := c.KubernetesInterface().CoreV1().Namespaces().Delete(context.TODO(), namespace, metav1.DeleteOptions{}) Expect(err).ToNot(HaveOccurred()) @@ -2319,7 +2319,7 @@ var _ = Describe("Operator Group", func() { BeforeEach(func() { matchingLabel = map[string]string{"foo": "bar"} - // Updating Namespace with labels + By(`Updating Namespace with labels`) for _, namespace := range testNamespaces { _, err := c.KubernetesInterface().CoreV1().Namespaces().Update(context.TODO(), &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ @@ -2336,7 +2336,7 @@ var _ = Describe("Operator Group", func() { var operatorGroup *v1.OperatorGroup BeforeEach(func() { - // Creating operator group + By(`Creating operator group`) operatorGroup = &v1.OperatorGroup{ ObjectMeta: metav1.ObjectMeta{ Name: genName("e2e-operator-group-"), @@ -2353,17 +2353,17 @@ var _ = Describe("Operator Group", func() { Expect(err).ToNot(HaveOccurred()) }) - // issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2637 It("[FLAKE] OLM applies labels to Namespaces that are associated with an OperatorGroup", func() { + By(`issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2637`) ogLabel, err := getOGLabelKey(operatorGroup) Expect(err).ToNot(HaveOccurred()) - // Create list options + By(`Create list options`) listOptions := metav1.ListOptions{ LabelSelector: labels.Set(map[string]string{ogLabel: ""}).String(), } - // Verify that all the namespaces listed in targetNamespaces field of OperatorGroup have labels applied on them + By(`Verify that all the namespaces listed in targetNamespaces field of OperatorGroup have labels applied on them`) namespaceList, err := pollForNamespaceListCount(c, listOptions, 3) Expect(err).ToNot(HaveOccurred()) Expect(checkForOperatorGroupLabels(operatorGroup, namespaceList.Items)).Should(BeTrue()) @@ -2375,7 +2375,7 @@ var _ = Describe("Operator Group", func() { var operatorGroup *v1.OperatorGroup BeforeEach(func() { - // Create an OperatorGroup with three target namespaces. + By(`Create an OperatorGroup with three target namespaces.`) operatorGroup = &v1.OperatorGroup{ ObjectMeta: metav1.ObjectMeta{ Name: genName("e2e-operator-group-"), @@ -2395,12 +2395,12 @@ var _ = Describe("Operator Group", func() { ogLabel, err := getOGLabelKey(operatorGroup) Expect(err).ToNot(HaveOccurred()) - // Create list options + By(`Create list options`) listOptions := metav1.ListOptions{ LabelSelector: labels.Set(map[string]string{ogLabel: ""}).String(), } - // Verify that all the namespaces listed in targetNamespaces field of OperatorGroup have labels applied on them + By(`Verify that all the namespaces listed in targetNamespaces field of OperatorGroup have labels applied on them`) namespaceList, err := pollForNamespaceListCount(c, listOptions, 3) Expect(err).ToNot(HaveOccurred()) Expect(checkForOperatorGroupLabels(operatorGroup, namespaceList.Items)).Should(BeTrue()) diff --git a/test/e2e/packagemanifest_e2e_test.go b/test/e2e/packagemanifest_e2e_test.go index f380305875..e1ee68f605 100644 --- a/test/e2e/packagemanifest_e2e_test.go +++ b/test/e2e/packagemanifest_e2e_test.go @@ -57,7 +57,7 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So ) BeforeEach(func() { - // create a simple catalogsource + By(`create a simple catalogsource`) packageName = genName("nginx") alphaChannel = "alpha" packageAlpha = packageName + "-alpha" @@ -114,7 +114,7 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So _, cleanupCatalogSource = createInternalCatalogSource(c, crc, catsrcName, generatedNamespace.GetName(), manifests, []apiextensionsv1.CustomResourceDefinition{crd}, []v1alpha1.ClusterServiceVersion{csv, csvAlpha}) - // Verify catalog source was created + By(`Verify catalog source was created`) _, err := fetchCatalogSourceOnStatus(crc, catsrcName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred()) }) @@ -126,7 +126,7 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So }) It("retrieves the PackageManifest by package name and validates its fields", func() { - // Drop icons to account for pruning + By(`Drop icons to account for pruning`) csvAlpha.Spec.Icon = nil csv.Spec.Icon = nil @@ -181,7 +181,7 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So }) It("lists PackageManifest and ensures it has valid PackageManifest item", func() { - // Get a PackageManifestList and ensure it has the correct items + By(`Get a PackageManifestList and ensure it has the correct items`) Eventually(func() (bool, error) { pmList, err := pmc.OperatorsV1().PackageManifests(generatedNamespace.GetName()).List(context.TODO(), metav1.ListOptions{}) return containsPackageManifest(pmList.Items, packageName), err @@ -198,7 +198,7 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So data, err := res.Raw() Expect(err).ToNot(HaveOccurred()) - // Match against icon from the default + By(`Match against icon from the default`) expected, err := base64.StdEncoding.DecodeString(csv.Spec.Icon[0].Data) Expect(err).ToNot(HaveOccurred()) Expect(data).To(Equal(expected)) @@ -241,7 +241,7 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So catalogSource, err = crc.OperatorsV1alpha1().CatalogSources(catalogSource.GetNamespace()).Create(context.TODO(), catalogSource, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) - // Wait for the CatalogSource to be ready + By(`Wait for the CatalogSource to be ready`) _, err = fetchCatalogSourceOnStatus(crc, catalogSource.GetName(), catalogSource.GetNamespace(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready") }) @@ -258,7 +258,7 @@ var _ = Describe("Package Manifest API lists available Operators from Catalog So Expect(pm).ShouldNot(BeNil()) Expect(pm.GetName()).Should(Equal(packageName)) - // Verify related images from the package manifest + By(`Verify related images from the package manifest`) relatedImages := pm.Status.Channels[0].CurrentCSVDesc.RelatedImages Expect(relatedImages).To(ConsistOf([]string{ diff --git a/test/e2e/resource_manager_test.go b/test/e2e/resource_manager_test.go index bb8df84a35..702aaaecf2 100644 --- a/test/e2e/resource_manager_test.go +++ b/test/e2e/resource_manager_test.go @@ -28,7 +28,7 @@ var _ = Describe("ResourceManager", func() { }) It("should tag resources created with it", func() { - // Create a namespace + By(`Create a namespace`) ns := &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ Name: genName("test-"), @@ -36,14 +36,14 @@ var _ = Describe("ResourceManager", func() { } Expect(ctx.Ctx().E2EClient().Create(context.TODO(), ns)).To(Succeed()) - // Get namespace + By(`Get namespace`) Expect(ctx.Ctx().E2EClient().Get(context.TODO(), client.ObjectKeyFromObject(ns), ns)).To(Succeed()) Expect(ns.GetAnnotations()).NotTo(BeEmpty()) Expect(ns.GetAnnotations()[util.E2ETestNameTag]).To(Equal("ResourceManager should tag resources created with it")) }) It("should delete resources on reset", func() { - // Create a namespace + By(`Create a namespace`) ns := &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ Name: genName("test-"), @@ -51,22 +51,20 @@ var _ = Describe("ResourceManager", func() { } Expect(ctx.Ctx().E2EClient().Create(context.TODO(), ns)).To(Succeed()) - // Add a config map + By(`Add a config map`) + By(`creating the configmap in the generated (spec) namespace so if the namespace (ns, above) gets deleted on reset it won't take the config map with it`) configMap := &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ - Name: genName("configmap-"), - - // creating the configmap in the generated (spec) namespace - // so if the namespace (ns, above) gets deleted on reset it won't take the config map with it + Name: genName("configmap-"), Namespace: generatedNamespace.GetName(), }, } Expect(ctx.Ctx().E2EClient().Create(context.TODO(), configMap)) - // Reset the client + By(`Reset the client`) Expect(ctx.Ctx().E2EClient().Reset()).To(Succeed()) - // And just like that resources should be gone + By(`And just like that resources should be gone`) Eventually(func() error { return ctx.Ctx().E2EClient().Get(context.TODO(), client.ObjectKeyFromObject(configMap), configMap) }).Should(WithTransform(k8serror.IsNotFound, BeTrue())) diff --git a/test/e2e/scoped_client_test.go b/test/e2e/scoped_client_test.go index db41720fff..3b201d3c67 100644 --- a/test/e2e/scoped_client_test.go +++ b/test/e2e/scoped_client_test.go @@ -71,21 +71,16 @@ var _ = Describe("Scoped Client bound to a service account can be used to make A } DescribeTable("API call using scoped client", func(tc testParameter) { - // Steps: - // 1. Create a new namespace - // 2. Create a service account. - // 3. Grant permission(s) to the service account if specified. - // 4. Get scoped client instance(s) - // 5. Invoke Get API call on non existent object(s) to check if - // the call can be made successfully. + By(`Create a new namespace`) namespace := genName("a") _, cleanupNS := newNamespace(kubeclient, namespace) defer cleanupNS() + By(`Create a service account.`) saName := genName("user-defined-") sa, cleanupSA := newServiceAccount(kubeclient, namespace, saName) defer cleanupSA() - // Create token secret for the serviceaccount + By(`Create token secret for the serviceaccount`) secret, cleanupSE := newTokenSecret(kubeclient, namespace, saName) defer cleanupSE() @@ -97,6 +92,7 @@ var _ = Describe("Scoped Client bound to a service account can be used to make A return string(v.Data[corev1.ServiceAccountTokenKey]) }, BeEmpty())) + By(`Grant permission(s) to the service account if specified.`) strategy := scoped.NewClientAttenuator(logger, config, kubeclient) getter := func() (reference *corev1.ObjectReference, err error) { reference = &corev1.ObjectReference{ @@ -126,6 +122,7 @@ var _ = Describe("Scoped Client bound to a service account can be used to make A Expect(err).ToNot(HaveOccurred()) Expect(dynamicClientGot).ToNot(BeNil()) + By(`Invoke Get API call on non existent object(s) to check if the call can be made successfully.`) _, err = kubeclientGot.KubernetesInterface().CoreV1().ConfigMaps(namespace).Get(context.TODO(), genName("does-not-exist-"), metav1.GetOptions{}) Expect(err).To(HaveOccurred()) tc.assertFunc(err) diff --git a/test/e2e/subscription_e2e_test.go b/test/e2e/subscription_e2e_test.go index 795c07f305..9a8a487873 100644 --- a/test/e2e/subscription_e2e_test.go +++ b/test/e2e/subscription_e2e_test.go @@ -154,9 +154,9 @@ var _ = Describe("Subscription", func() { }) }) - // I. Creating a new subscription - // A. If package is not installed, creating a subscription should install latest version It("creation if not installed", func() { + By(` I. Creating a new subscription`) + By(` A. If package is not installed, creating a subscription should install latest version`) defer func() { if env := os.Getenv("SKIP_CLEANUP"); env != "" { @@ -190,8 +190,8 @@ var _ = Describe("Subscription", func() { csv, err := fetchCSV(crc, generatedNamespace.GetName(), currentCSV, buildCSVConditionChecker(operatorsv1alpha1.CSVPhaseSucceeded)) require.NoError(GinkgoT(), err) - // Check for the olm.package property as a proxy for - // verifying that the annotation value is reasonable. + By(`Check for the olm.package property as a proxy for`) + By(`verifying that the annotation value is reasonable.`) Expect( projection.PropertyListFromPropertiesAnnotation(csv.GetAnnotations()["operatorframework.io/properties"]), ).To(ContainElement( @@ -199,17 +199,16 @@ var _ = Describe("Subscription", func() { )) }) - // I. Creating a new subscription - // B. If package is already installed, creating a subscription should upgrade it to the latest - // version It("creation using existing CSV", func() { + By(` I. Creating a new subscription`) + By(` B. If package is already installed, creating a subscription should upgrade it to the latest version`) defer func() { require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{})) }() require.NoError(GinkgoT(), initCatalog(GinkgoT(), generatedNamespace.GetName(), c, crc)) - // Will be cleaned up by the upgrade process + By(`Will be cleaned up by the upgrade process`) _, err := createCSV(c, crc, stableCSV, generatedNamespace.GetName(), false, false) require.NoError(GinkgoT(), err) @@ -271,7 +270,7 @@ var _ = Describe("Subscription", func() { mainCatalogName := genName("mock-ocs-main-") - // Create separate manifests for each CatalogSource + By(`Create separate manifests for each CatalogSource`) mainManifests := []registry.PackageManifest{ { PackageName: mainPackageName, @@ -291,35 +290,35 @@ var _ = Describe("Subscription", func() { }, } - // Create catalog source + By(`Create catalog source`) _, cleanupMainCatalogSource := createInternalCatalogSource(c, crc, mainCatalogName, generatedNamespace.GetName(), mainManifests, []apiextensionsv1.CustomResourceDefinition{crd}, []operatorsv1alpha1.ClusterServiceVersion{mainCSV}) defer cleanupMainCatalogSource() - // Attempt to get the catalog source before creating subscription + By(`Attempt to get the catalog source before creating subscription`) _, err := fetchCatalogSourceOnStatus(crc, mainCatalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // Create a subscription + By(`Create a subscription`) subscriptionName := genName("sub-nginx-") subscriptionCleanup := createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subscriptionName, mainCatalogName, mainPackageName, stableChannel, "", operatorsv1alpha1.ApprovalAutomatic) defer subscriptionCleanup() - // Wait for csv to install + By(`Wait for csv to install`) firstCSV, err := fetchCSV(crc, generatedNamespace.GetName(), mainCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Update catalog with a new csv in the channel with a skip range + By(`Update catalog with a new csv in the channel with a skip range`) updateInternalCatalog(GinkgoT(), c, crc, mainCatalogName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{crd}, []operatorsv1alpha1.ClusterServiceVersion{updatedCSV}, updatedManifests) - // Wait for csv to update + By(`Wait for csv to update`) finalCSV, err := fetchCSV(crc, generatedNamespace.GetName(), updatedCSV.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Ensure we set the replacement field based on the registry data + By(`Ensure we set the replacement field based on the registry data`) require.Equal(GinkgoT(), firstCSV.GetName(), finalCSV.Spec.Replaces) }) - // If installPlanApproval is set to manual, the installplans created should be created with approval: manual It("creation manual approval", func() { + By(`If installPlanApproval is set to manual, the installplans created should be created with approval: manual`) defer func() { require.NoError(GinkgoT(), crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{})) @@ -340,7 +339,7 @@ var _ = Describe("Subscription", func() { require.Equal(GinkgoT(), operatorsv1alpha1.ApprovalManual, installPlan.Spec.Approval) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseRequiresApproval, installPlan.Status.Phase) - // Delete the current installplan + By(`Delete the current installplan`) err = crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Delete(context.Background(), installPlan.Name, metav1.DeleteOptions{}) require.NoError(GinkgoT(), err) @@ -357,7 +356,7 @@ var _ = Describe("Subscription", func() { return false }, 5*time.Minute, 10*time.Second).Should(BeTrue()) - // Fetch new installplan + By(`Fetch new installplan`) newInstallPlan, err := fetchInstallPlanWithNamespace(GinkgoT(), crc, ipName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseRequiresApproval)) require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), newInstallPlan) @@ -366,7 +365,7 @@ var _ = Describe("Subscription", func() { require.Equal(GinkgoT(), operatorsv1alpha1.ApprovalManual, newInstallPlan.Spec.Approval) require.Equal(GinkgoT(), operatorsv1alpha1.InstallPlanPhaseRequiresApproval, newInstallPlan.Status.Phase) - // Set the InstallPlan's approved to True + By(`Set the InstallPlan's approved to True`) Eventually(Apply(newInstallPlan, func(p *operatorsv1alpha1.InstallPlan) error { p.Spec.Approved = true return nil @@ -414,14 +413,14 @@ var _ = Describe("Subscription", func() { }, } - // Create CSV + By(`Create CSV`) packageName := genName("nginx-") stableChannel := "stable" csvA := newCSV("nginx-a", generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crd}, nil, nil) csvB := newCSV("nginx-b", generatedNamespace.GetName(), "nginx-a", semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{crd}, nil, nil) - // Create PackageManifests + By(`Create PackageManifests`) manifests := []registry.PackageManifest{ { PackageName: packageName, @@ -432,12 +431,12 @@ var _ = Describe("Subscription", func() { }, } - // Create the CatalogSource + By(`Create the CatalogSource`) catalogSourceName := genName("mock-nginx-") _, cleanupCatalogSource := createInternalCatalogSource(c, crc, catalogSourceName, generatedNamespace.GetName(), manifests, []apiextensionsv1.CustomResourceDefinition{crd}, []operatorsv1alpha1.ClusterServiceVersion{csvA, csvB}) defer cleanupCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err := fetchCatalogSourceOnStatus(crc, catalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -451,17 +450,17 @@ var _ = Describe("Subscription", func() { installPlanName := subscription.Status.Install.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) requiresApprovalChecker := buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseRequiresApproval) fetchedInstallPlan, err := fetchInstallPlanWithNamespace(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), requiresApprovalChecker) require.NoError(GinkgoT(), err) - // Ensure that only 1 installplan was created + By(`Ensure that only 1 installplan was created`) ips, err := crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).List(context.Background(), metav1.ListOptions{}) require.NoError(GinkgoT(), err) require.Len(GinkgoT(), ips.Items, 1) - // Ensure that csvA and its crd are found in the plan + By(`Ensure that csvA and its crd are found in the plan`) csvFound := false crdFound := false for _, s := range fetchedInstallPlan.Status.Plan { @@ -482,7 +481,7 @@ var _ = Describe("Subscription", func() { require.True(GinkgoT(), csvFound, "expected csv not found in installplan") require.True(GinkgoT(), crdFound, "expected crd not found in installplan") - // Ensure that csvB is not found in the plan + By(`Ensure that csvB is not found in the plan`) csvFound = false for _, s := range fetchedInstallPlan.Status.Plan { require.Equal(GinkgoT(), csvA.GetName(), s.Resolving, "unexpected resolution found") @@ -497,7 +496,7 @@ var _ = Describe("Subscription", func() { } require.False(GinkgoT(), csvFound, "expected csv not found in installplan") - // Approve the installplan and wait for csvA to be installed + By(`Approve the installplan and wait for csvA to be installed`) fetchedInstallPlan.Spec.Approved = true _, err = crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Update(context.Background(), fetchedInstallPlan, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) @@ -505,8 +504,8 @@ var _ = Describe("Subscription", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csvA.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Wait for the subscription to begin upgrading to csvB - // The upgrade changes the installplanref on the subscription + By(`Wait for the subscription to begin upgrading to csvB`) + By(`The upgrade changes the installplanref on the subscription`) Eventually(func() (bool, error) { subscription, err = crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).Get(context.Background(), subscriptionName, metav1.GetOptions{}) return subscription != nil && subscription.Status.InstallPlanRef.Name != fetchedInstallPlan.GetName() && subscription.Status.State == operatorsv1alpha1.SubscriptionStateUpgradePending, err @@ -515,7 +514,7 @@ var _ = Describe("Subscription", func() { upgradeInstallPlan, err := fetchInstallPlanWithNamespace(GinkgoT(), crc, subscription.Status.InstallPlanRef.Name, generatedNamespace.GetName(), requiresApprovalChecker) require.NoError(GinkgoT(), err) - // Approve the upgrade installplan and wait for + By(`Approve the upgrade installplan and wait for`) upgradeInstallPlan.Spec.Approved = true _, err = crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Update(context.Background(), upgradeInstallPlan, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) @@ -523,18 +522,18 @@ var _ = Describe("Subscription", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csvB.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Ensure that 2 installplans were created + By(`Ensure that 2 installplans were created`) ips, err = crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).List(context.Background(), metav1.ListOptions{}) require.NoError(GinkgoT(), err) require.Len(GinkgoT(), ips.Items, 2) }) - // issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2635 It("[FLAKE] updates multiple intermediates", func() { + By(`issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2635`) crd := newCRD("ins") - // Create CSV + By(`Create CSV`) packageName := genName("nginx-") stableChannel := "stable" @@ -542,7 +541,7 @@ var _ = Describe("Subscription", func() { csvB := newCSV("nginx-b", generatedNamespace.GetName(), "nginx-a", semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{crd}, nil, nil) csvC := newCSV("nginx-c", generatedNamespace.GetName(), "nginx-b", semver.MustParse("0.3.0"), []apiextensionsv1.CustomResourceDefinition{crd}, nil, nil) - // Create PackageManifests + By(`Create PackageManifests`) manifests := []registry.PackageManifest{ { PackageName: packageName, @@ -553,12 +552,12 @@ var _ = Describe("Subscription", func() { }, } - // Create the CatalogSource with just one version + By(`Create the CatalogSource with just one version`) catalogSourceName := genName("mock-nginx-") _, cleanupCatalogSource := createInternalCatalogSource(c, crc, catalogSourceName, generatedNamespace.GetName(), manifests, []apiextensionsv1.CustomResourceDefinition{crd}, []operatorsv1alpha1.ClusterServiceVersion{csvA}) defer cleanupCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err := fetchCatalogSourceOnStatus(crc, catalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -570,11 +569,11 @@ var _ = Describe("Subscription", func() { require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subscription) - // Wait for csvA to be installed + By(`Wait for csvA to be installed`) _, err = fetchCSV(crc, generatedNamespace.GetName(), csvA.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Set up async watches that will fail the test if csvB doesn't get created in between csvA and csvC + By(`Set up async watches that will fail the test if csvB doesn't get created in between csvA and csvC`) var wg sync.WaitGroup go func(t GinkgoTInterface) { defer GinkgoRecover() @@ -583,7 +582,7 @@ var _ = Describe("Subscription", func() { _, err := fetchCSV(crc, generatedNamespace.GetName(), csvB.GetName(), csvReplacingChecker) require.NoError(GinkgoT(), err) }(GinkgoT()) - // Update the catalog to include multiple updates + By(`Update the catalog to include multiple updates`) packages := []registry.PackageManifest{ { PackageName: packageName, @@ -596,37 +595,36 @@ var _ = Describe("Subscription", func() { updateInternalCatalog(GinkgoT(), c, crc, catalogSourceName, generatedNamespace.GetName(), []apiextensionsv1.CustomResourceDefinition{crd}, []operatorsv1alpha1.ClusterServiceVersion{csvA, csvB, csvC}, packages) - // wait for checks on intermediate csvs to succeed + By(`wait for checks on intermediate csvs to succeed`) wg.Wait() - // Wait for csvC to be installed + By(`Wait for csvC to be installed`) _, err = fetchCSV(crc, generatedNamespace.GetName(), csvC.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Should eventually GC the CSVs + By(`Should eventually GC the CSVs`) err = waitForCsvToDelete(generatedNamespace.GetName(), csvA.Name, crc) Expect(err).ShouldNot(HaveOccurred()) err = waitForCsvToDelete(generatedNamespace.GetName(), csvB.Name, crc) Expect(err).ShouldNot(HaveOccurred()) - // TODO: check installplans, subscription status, etc + By(`TODO: check installplans, subscription status, etc`) }) - // TestSubscriptionUpdatesExistingInstallPlan ensures that an existing InstallPlan - // has the appropriate approval requirement from Subscription. It("updates existing install plan", func() { + By(`TestSubscriptionUpdatesExistingInstallPlan ensures that an existing InstallPlan has the appropriate approval requirement from Subscription.`) Skip("ToDo: This test was skipped before ginkgo conversion") - // Create CSV + By(`Create CSV`) packageName := genName("nginx-") stableChannel := "stable" csvA := newCSV("nginx-a", generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), nil, nil, nil) csvB := newCSV("nginx-b", generatedNamespace.GetName(), "nginx-a", semver.MustParse("0.2.0"), nil, nil, nil) - // Create PackageManifests + By(`Create PackageManifests`) manifests := []registry.PackageManifest{ { PackageName: packageName, @@ -637,33 +635,33 @@ var _ = Describe("Subscription", func() { }, } - // Create the CatalogSource with just one version + By(`Create the CatalogSource with just one version`) catalogSourceName := genName("mock-nginx-") _, cleanupCatalogSource := createInternalCatalogSource(c, crc, catalogSourceName, generatedNamespace.GetName(), manifests, nil, []operatorsv1alpha1.ClusterServiceVersion{csvA, csvB}) defer cleanupCatalogSource() - // Attempt to get the catalog source before creating install plan + By(`Attempt to get the catalog source before creating install plan`) _, err := fetchCatalogSourceOnStatus(crc, catalogSourceName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // Create a subscription to just get an InstallPlan for csvB + By(`Create a subscription to just get an InstallPlan for csvB`) subscriptionName := genName("sub-nginx-") createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subscriptionName, catalogSourceName, packageName, stableChannel, csvB.GetName(), operatorsv1alpha1.ApprovalAutomatic) - // Wait for csvB to be installed + By(`Wait for csvB to be installed`) _, err = fetchCSV(crc, generatedNamespace.GetName(), csvB.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) subscription, err := fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanChecker()) fetchedInstallPlan, err := fetchInstallPlanWithNamespace(GinkgoT(), crc, subscription.Status.InstallPlanRef.Name, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) - // Delete this subscription + By(`Delete this subscription`) err = crc.OperatorsV1alpha1().Subscriptions(generatedNamespace.GetName()).DeleteCollection(context.Background(), *metav1.NewDeleteOptions(0), metav1.ListOptions{}) require.NoError(GinkgoT(), err) - // Delete orphaned csvB + By(`Delete orphaned csvB`) require.NoError(GinkgoT(), crc.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Delete(context.Background(), csvB.GetName(), metav1.DeleteOptions{})) - // Create an InstallPlan for csvB + By(`Create an InstallPlan for csvB`) ip := &operatorsv1alpha1.InstallPlan{ ObjectMeta: metav1.ObjectMeta{ GenerateName: "install-", @@ -696,35 +694,35 @@ var _ = Describe("Subscription", func() { installPlanName := subscription.Status.Install.Name - // Wait for InstallPlan to be status: Complete before checking resource presence + By(`Wait for InstallPlan to be status: Complete before checking resource presence`) requiresApprovalChecker := buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseRequiresApproval) fetchedInstallPlan, err = fetchInstallPlanWithNamespace(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), requiresApprovalChecker) require.NoError(GinkgoT(), err) - // Approve the installplan and wait for csvA to be installed + By(`Approve the installplan and wait for csvA to be installed`) fetchedInstallPlan.Spec.Approved = true _, err = crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Update(context.Background(), fetchedInstallPlan, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Wait for csvA to be installed + By(`Wait for csvA to be installed`) _, err = fetchCSV(crc, generatedNamespace.GetName(), csvA.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Wait for the subscription to begin upgrading to csvB + By(`Wait for the subscription to begin upgrading to csvB`) subscription, err = fetchSubscription(crc, generatedNamespace.GetName(), subscriptionName, subscriptionStateUpgradePendingChecker()) require.NoError(GinkgoT(), err) - // Fetch existing csvB installPlan + By(`Fetch existing csvB installPlan`) fetchedInstallPlan, err = fetchInstallPlanWithNamespace(GinkgoT(), crc, subscription.Status.InstallPlanRef.Name, generatedNamespace.GetName(), requiresApprovalChecker) require.NoError(GinkgoT(), err) require.Equal(GinkgoT(), ip2.GetName(), subscription.Status.InstallPlanRef.Name, "expected new installplan is the same with pre-exising one") - // Approve the installplan and wait for csvB to be installed + By(`Approve the installplan and wait for csvB to be installed`) fetchedInstallPlan.Spec.Approved = true _, err = crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Update(context.Background(), fetchedInstallPlan, metav1.UpdateOptions{}) require.NoError(GinkgoT(), err) - // Wait for csvB to be installed + By(`Wait for csvB to be installed`) _, err = fetchCSV(crc, generatedNamespace.GetName(), csvB.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) }) @@ -746,17 +744,16 @@ var _ = Describe("Subscription", func() { }) When("missing target catalog", func() { - // TestSubscriptionStatusMissingTargetCatalogSource ensures that a Subscription has the appropriate status condition when - // its target catalog is missing. - // - // Steps: - // 1. Generate an initial CatalogSource in the target namespace - // 2. Generate Subscription, "sub", targetting non-existent CatalogSource, "missing" - // 3. Wait for sub status to show SubscriptionCatalogSourcesUnhealthy with status True, reason CatalogSourcesUpdated, and appropriate missing message - // 4. Update sub's spec to target the "mysubscription" - // 5. Wait for sub's status to show SubscriptionCatalogSourcesUnhealthy with status False, reason AllCatalogSourcesHealthy, and reason "all available catalogsources are healthy" - // 6. Wait for sub to succeed It("should surface the missing catalog", func() { + By(`TestSubscriptionStatusMissingTargetCatalogSource ensures that a Subscription has the appropriate status condition when`) + By(`its target catalog is missing.`) + By(` BySteps:`) + By(`1. Generate an initial CatalogSource in the target namespace`) + By(`2. Generate Subscription, "sub", targetting non-existent CatalogSource, "missing"`) + By(`3. Wait for sub status to show SubscriptionCatalogSourcesUnhealthy with status True, reason CatalogSourcesUpdated, and appropriate missing message`) + By(`4. Update sub's spec to target the "mysubscription"`) + By(`5. Wait for sub's status to show SubscriptionCatalogSourcesUnhealthy with status False, reason AllCatalogSourcesHealthy, and reason "all available catalogsources are healthy"`) + By(`6. Wait for sub to succeed`) err := initCatalog(GinkgoT(), generatedNamespace.GetName(), c, crc) Expect(err).NotTo(HaveOccurred()) @@ -783,12 +780,12 @@ var _ = Describe("Subscription", func() { return err }).Should(Succeed()) - // Wait for SubscriptionCatalogSourcesUnhealthy to be false + By(`Wait for SubscriptionCatalogSourcesUnhealthy to be false`) By("detecting a new existing target") _, err = fetchSubscription(crc, generatedNamespace.GetName(), testSubscriptionName, subscriptionHasCondition(operatorsv1alpha1.SubscriptionCatalogSourcesUnhealthy, corev1.ConditionFalse, operatorsv1alpha1.AllCatalogSourcesHealthy, "all available catalogsources are healthy")) Expect(err).NotTo(HaveOccurred()) - // Wait for success + By(`Wait for success`) _, err = fetchSubscription(crc, generatedNamespace.GetName(), testSubscriptionName, subscriptionStateAtLatestChecker()) Expect(err).NotTo(HaveOccurred()) }) @@ -848,7 +845,7 @@ var _ = Describe("Subscription", func() { Expect(err).NotTo(HaveOccurred()) Expect(sub).ToNot(BeNil()) - // Get the latest CatalogSource + By(`Get the latest CatalogSource`) cs, err = crc.OperatorsV1alpha1().CatalogSources(cs.GetNamespace()).Get(context.Background(), cs.GetName(), getOpts) Expect(err).NotTo(HaveOccurred()) Expect(cs).ToNot(BeNil()) @@ -857,7 +854,7 @@ var _ = Describe("Subscription", func() { Context("is grpc and its spec is missing the address and image fields", func() { It("should surface catalog health", func() { - // Create a CatalogSource pointing to the grpc pod + By(`Create a CatalogSource pointing to the grpc pod`) cs := &operatorsv1alpha1.CatalogSource{ TypeMeta: metav1.TypeMeta{ Kind: operatorsv1alpha1.CatalogSourceKind, @@ -882,7 +879,7 @@ var _ = Describe("Subscription", func() { Expect(err).ToNot(HaveOccurred()) }() - // Wait for the CatalogSource status to be updated to reflect its invalid spec + By(`Wait for the CatalogSource status to be updated to reflect its invalid spec`) _, err = fetchCatalogSourceOnStatus(crc, cs.GetName(), cs.GetNamespace(), catalogSourceInvalidSpec) Expect(err).ToNot(HaveOccurred(), "catalog source did not become ready") @@ -1031,35 +1028,34 @@ var _ = Describe("Subscription", func() { }) - // TestSubscriptionInstallPlanStatus ensures that a Subscription has the appropriate status conditions for possible referenced - // InstallPlan states. - // - // Steps: - // - Utilize the namespace and OG targeting that namespace created in the BeforeEach clause - // - Create CatalogSource, cs, in ns - // - Create Subscription to a package of cs in ns, sub - // - Wait for the package from sub to install successfully with no remaining InstallPlan status conditions - // - Store conditions for later comparision - // - Get the InstallPlan - // - Set the InstallPlan's approval mode to Manual - // - Set the InstallPlan's phase to None - // - Wait for sub to have status condition SubscriptionInstallPlanPending true and reason InstallPlanNotYetReconciled - // - Get the latest IntallPlan and set the phase to InstallPlanPhaseRequiresApproval - // - Wait for sub to have status condition SubscriptionInstallPlanPending true and reason RequiresApproval - // - Get the latest InstallPlan and set the phase to InstallPlanPhaseInstalling - // - Wait for sub to have status condition SubscriptionInstallPlanPending true and reason Installing - // - Get the latest InstallPlan and set the phase to InstallPlanPhaseFailed and remove all status conditions - // - Wait for sub to have status condition SubscriptionInstallPlanFailed true and reason InstallPlanFailed - // - Get the latest InstallPlan and set status condition of type Installed to false with reason InstallComponentFailed - // - Wait for sub to have status condition SubscriptionInstallPlanFailed true and reason InstallComponentFailed - // - Delete the referenced InstallPlan - // - Wait for sub to have status condition SubscriptionInstallPlanMissing true - // - Ensure original non-InstallPlan status conditions remain after InstallPlan transitions It("can reconcile InstallPlan status", func() { + By(`TestSubscriptionInstallPlanStatus ensures that a Subscription has the appropriate status conditions for possible referenced`) + By(`InstallPlan states.`) + By(` BySteps:`) + By(`- Utilize the namespace and OG targeting that namespace created in the BeforeEach clause`) + By(`- Create CatalogSource, cs, in ns`) + By(`- Create Subscription to a package of cs in ns, sub`) + By(`- Wait for the package from sub to install successfully with no remaining InstallPlan status conditions`) + By(`- Store conditions for later comparision`) + By(`- Get the InstallPlan`) + By(`- Set the InstallPlan's approval mode to Manual`) + By(`- Set the InstallPlan's phase to None`) + By(`- Wait for sub to have status condition SubscriptionInstallPlanPending true and reason InstallPlanNotYetReconciled`) + By(`- Get the latest IntallPlan and set the phase to InstallPlanPhaseRequiresApproval`) + By(`- Wait for sub to have status condition SubscriptionInstallPlanPending true and reason RequiresApproval`) + By(`- Get the latest InstallPlan and set the phase to InstallPlanPhaseInstalling`) + By(`- Wait for sub to have status condition SubscriptionInstallPlanPending true and reason Installing`) + By(`- Get the latest InstallPlan and set the phase to InstallPlanPhaseFailed and remove all status conditions`) + By(`- Wait for sub to have status condition SubscriptionInstallPlanFailed true and reason InstallPlanFailed`) + By(`- Get the latest InstallPlan and set status condition of type Installed to false with reason InstallComponentFailed`) + By(`- Wait for sub to have status condition SubscriptionInstallPlanFailed true and reason InstallComponentFailed`) + By(`- Delete the referenced InstallPlan`) + By(`- Wait for sub to have status condition SubscriptionInstallPlanMissing true`) + By(`- Ensure original non-InstallPlan status conditions remain after InstallPlan transitions`) c := newKubeClient() crc := newCRClient() - // Create CatalogSource, cs, in ns + By(`Create CatalogSource, cs, in ns`) pkgName := genName("pkg-") channelName := genName("channel-") crd := newCRD(pkgName) @@ -1079,11 +1075,11 @@ var _ = Describe("Subscription", func() { _, err := fetchCatalogSourceOnStatus(crc, catalogName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred()) - // Create Subscription to a package of cs in ns, sub + By(`Create Subscription to a package of cs in ns, sub`) subName := genName("sub-") defer createSubscriptionForCatalog(crc, generatedNamespace.GetName(), subName, catalogName, pkgName, channelName, pkgName, operatorsv1alpha1.ApprovalAutomatic)() - // Wait for the package from sub to install successfully with no remaining InstallPlan status conditions + By(`Wait for the package from sub to install successfully with no remaining InstallPlan status conditions`) checker := subscriptionStateAtLatestChecker() sub, err := fetchSubscription(crc, generatedNamespace.GetName(), subName, func(s *operatorsv1alpha1.Subscription) bool { for _, cond := range s.Status.Conditions { @@ -1097,7 +1093,7 @@ var _ = Describe("Subscription", func() { Expect(err).ToNot(HaveOccurred()) Expect(sub).ToNot(BeNil()) - // Store conditions for later comparision + By(`Store conditions for later comparision`) conds := sub.Status.Conditions ref := sub.Status.InstallPlanRef @@ -1107,46 +1103,46 @@ var _ = Describe("Subscription", func() { plan.SetNamespace(ref.Namespace) plan.SetName(ref.Name) - // Set the InstallPlan's approval mode to Manual + By(`Set the InstallPlan's approval mode to Manual`) Eventually(Apply(plan, func(p *operatorsv1alpha1.InstallPlan) error { p.Spec.Approval = operatorsv1alpha1.ApprovalManual p.Spec.Approved = false return nil })).Should(Succeed()) - // Set the InstallPlan's phase to None + By(`Set the InstallPlan's phase to None`) Eventually(Apply(plan, func(p *operatorsv1alpha1.InstallPlan) error { p.Status.Phase = operatorsv1alpha1.InstallPlanPhaseNone return nil })).Should(Succeed()) - // Wait for sub to have status condition SubscriptionInstallPlanPending true and reason InstallPlanNotYetReconciled + By(`Wait for sub to have status condition SubscriptionInstallPlanPending true and reason InstallPlanNotYetReconciled`) sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, func(s *operatorsv1alpha1.Subscription) bool { cond := s.Status.GetCondition(operatorsv1alpha1.SubscriptionInstallPlanPending) return cond.Status == corev1.ConditionTrue && cond.Reason == operatorsv1alpha1.InstallPlanNotYetReconciled }) Expect(err).ToNot(HaveOccurred()) - // Set the phase to InstallPlanPhaseRequiresApproval + By(`Set the phase to InstallPlanPhaseRequiresApproval`) Eventually(Apply(plan, func(p *operatorsv1alpha1.InstallPlan) error { p.Status.Phase = operatorsv1alpha1.InstallPlanPhaseRequiresApproval return nil })).Should(Succeed()) - // Wait for sub to have status condition SubscriptionInstallPlanPending true and reason RequiresApproval + By(`Wait for sub to have status condition SubscriptionInstallPlanPending true and reason RequiresApproval`) sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, func(s *operatorsv1alpha1.Subscription) bool { cond := s.Status.GetCondition(operatorsv1alpha1.SubscriptionInstallPlanPending) return cond.Status == corev1.ConditionTrue && cond.Reason == string(operatorsv1alpha1.InstallPlanPhaseRequiresApproval) }) Expect(err).ToNot(HaveOccurred()) - // Set the phase to InstallPlanPhaseInstalling + By(`Set the phase to InstallPlanPhaseInstalling`) Eventually(Apply(plan, func(p *operatorsv1alpha1.InstallPlan) error { p.Status.Phase = operatorsv1alpha1.InstallPlanPhaseInstalling return nil })).Should(Succeed()) - // Wait for sub to have status condition SubscriptionInstallPlanPending true and reason Installing + By(`Wait for sub to have status condition SubscriptionInstallPlanPending true and reason Installing`) sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, func(s *operatorsv1alpha1.Subscription) bool { cond := s.Status.GetCondition(operatorsv1alpha1.SubscriptionInstallPlanPending) isConditionPresent := cond.Status == corev1.ConditionTrue && cond.Reason == string(operatorsv1alpha1.InstallPlanPhaseInstalling) @@ -1155,14 +1151,14 @@ var _ = Describe("Subscription", func() { return true } - // Sometimes the transition from installing to complete can be so quick that the test does not capture - // the condition in the subscription before it is removed. To mitigate this, we check if the installplan - // has transitioned to complete and exit out the fetch subscription loop if so. - // This is a mitigation. We should probably fix this test appropriately. - // issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2667 + By(`Sometimes the transition from installing to complete can be so quick that the test does not capture`) + By(`the condition in the subscription before it is removed. To mitigate this, we check if the installplan`) + By(`has transitioned to complete and exit out the fetch subscription loop if so.`) + By(`This is a mitigation. We should probably fix this test appropriately.`) + By(`issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2667`) ip, err := crc.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Get(context.TODO(), plan.Name, metav1.GetOptions{}) if err != nil { - // retry on failure + By(`retry on failure`) return false } isInstallPlanComplete := ip.Status.Phase == operatorsv1alpha1.InstallPlanPhaseComplete @@ -1171,21 +1167,21 @@ var _ = Describe("Subscription", func() { }) Expect(err).ToNot(HaveOccurred()) - // Set the phase to InstallPlanPhaseFailed and remove all status conditions + By(`Set the phase to InstallPlanPhaseFailed and remove all status conditions`) Eventually(Apply(plan, func(p *operatorsv1alpha1.InstallPlan) error { p.Status.Phase = operatorsv1alpha1.InstallPlanPhaseFailed p.Status.Conditions = nil return nil })).Should(Succeed()) - // Wait for sub to have status condition SubscriptionInstallPlanFailed true and reason InstallPlanFailed + By(`Wait for sub to have status condition SubscriptionInstallPlanFailed true and reason InstallPlanFailed`) sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, func(s *operatorsv1alpha1.Subscription) bool { cond := s.Status.GetCondition(operatorsv1alpha1.SubscriptionInstallPlanFailed) return cond.Status == corev1.ConditionTrue && cond.Reason == operatorsv1alpha1.InstallPlanFailed }) Expect(err).ToNot(HaveOccurred()) - // Set status condition of type Installed to false with reason InstallComponentFailed + By(`Set status condition of type Installed to false with reason InstallComponentFailed`) Eventually(Apply(plan, func(p *operatorsv1alpha1.InstallPlan) error { p.Status.Phase = operatorsv1alpha1.InstallPlanPhaseFailed failedCond := p.Status.GetCondition(operatorsv1alpha1.InstallPlanInstalled) @@ -1195,26 +1191,26 @@ var _ = Describe("Subscription", func() { return nil })).Should(Succeed()) - // Wait for sub to have status condition SubscriptionInstallPlanFailed true and reason InstallComponentFailed + By(`Wait for sub to have status condition SubscriptionInstallPlanFailed true and reason InstallComponentFailed`) sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, func(s *operatorsv1alpha1.Subscription) bool { cond := s.Status.GetCondition(operatorsv1alpha1.SubscriptionInstallPlanFailed) return cond.Status == corev1.ConditionTrue && cond.Reason == string(operatorsv1alpha1.InstallPlanReasonComponentFailed) }) Expect(err).ToNot(HaveOccurred()) - // Delete the referenced InstallPlan + By(`Delete the referenced InstallPlan`) Eventually(func() error { return crc.OperatorsV1alpha1().InstallPlans(ref.Namespace).Delete(context.Background(), ref.Name, metav1.DeleteOptions{}) }).Should(Succeed()) - // Wait for sub to have status condition SubscriptionInstallPlanMissing true + By(`Wait for sub to have status condition SubscriptionInstallPlanMissing true`) sub, err = fetchSubscription(crc, generatedNamespace.GetName(), subName, func(s *operatorsv1alpha1.Subscription) bool { return s.Status.GetCondition(operatorsv1alpha1.SubscriptionInstallPlanMissing).Status == corev1.ConditionTrue }) Expect(err).ToNot(HaveOccurred()) Expect(sub).ToNot(BeNil()) - // Ensure original non-InstallPlan status conditions remain after InstallPlan transitions + By(`Ensure original non-InstallPlan status conditions remain after InstallPlan transitions`) hashEqual := comparison.NewHashEqualitor() for _, cond := range conds { switch condType := cond.Type; condType { @@ -1279,7 +1275,7 @@ var _ = Describe("Subscription", func() { crClient := newCRClient() config := newConfigClient(GinkgoT()) - // Create a ConfigMap that is mounted to the operator via the subscription + By(`Create a ConfigMap that is mounted to the operator via the subscription`) testConfigMapName := genName("test-configmap-") testConfigMap := &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ @@ -1294,7 +1290,7 @@ var _ = Describe("Subscription", func() { require.NoError(GinkgoT(), err) }() - // Configure the Subscription. + By(`Configure the Subscription.`) podEnv := []corev1.EnvVar{ { @@ -1354,7 +1350,7 @@ var _ = Describe("Subscription", func() { catsrc, subSpec, catsrcCleanup := newCatalogSource(GinkgoT(), kubeClient, crClient, "podconfig", generatedNamespace.GetName(), permissions) defer catsrcCleanup() - // Ensure that the catalog source is resolved before we create a subscription. + By(`Ensure that the catalog source is resolved before we create a subscription.`) _, err = fetchCatalogSourceOnStatus(crClient, catsrc.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -1385,7 +1381,7 @@ var _ = Describe("Subscription", func() { kubeClient := newKubeClient() crClient := newCRClient() - // Create a ConfigMap that is mounted to the operator via the subscription + By(`Create a ConfigMap that is mounted to the operator via the subscription`) testConfigMapName := genName("test-configmap-") testConfigMap := &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ @@ -1400,7 +1396,7 @@ var _ = Describe("Subscription", func() { require.NoError(GinkgoT(), err) }() - // Configure the Subscription. + By(`Configure the Subscription.`) podNodeSelector := map[string]string{ "foo": "bar", } @@ -1413,7 +1409,7 @@ var _ = Describe("Subscription", func() { catsrc, subSpec, catsrcCleanup := newCatalogSource(GinkgoT(), kubeClient, crClient, "podconfig", generatedNamespace.GetName(), permissions) defer catsrcCleanup() - // Ensure that the catalog source is resolved before we create a subscription. + By(`Ensure that the catalog source is resolved before we create a subscription.`) _, err = fetchCatalogSourceOnStatus(crClient, catsrc.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -1445,21 +1441,21 @@ var _ = Describe("Subscription", func() { catsrc, subSpec, catsrcCleanup := newCatalogSourceWithDependencies(GinkgoT(), kubeClient, crClient, "podconfig", generatedNamespace.GetName(), permissions) defer catsrcCleanup() - // Ensure that the catalog source is resolved before we create a subscription. + By(`Ensure that the catalog source is resolved before we create a subscription.`) _, err := fetchCatalogSourceOnStatus(crClient, catsrc.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // Create duplicates of the CatalogSource + By(`Create duplicates of the CatalogSource`) for i := 0; i < 10; i++ { duplicateCatsrc, _, duplicateCatSrcCleanup := newCatalogSourceWithDependencies(GinkgoT(), kubeClient, crClient, "podconfig", generatedNamespace.GetName(), permissions) defer duplicateCatSrcCleanup() - // Ensure that the catalog source is resolved before we create a subscription. + By(`Ensure that the catalog source is resolved before we create a subscription.`) _, err = fetchCatalogSourceOnStatus(crClient, duplicateCatsrc.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) } - // Create a subscription that has a dependency + By(`Create a subscription that has a dependency`) subscriptionName := genName("podconfig-sub-") cleanupSubscription := createSubscriptionForCatalogWithSpec(GinkgoT(), crClient, generatedNamespace.GetName(), subscriptionName, subSpec) defer cleanupSubscription() @@ -1468,24 +1464,24 @@ var _ = Describe("Subscription", func() { require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subscription) - // Check that a single catalog source was used to resolve the InstallPlan + By(`Check that a single catalog source was used to resolve the InstallPlan`) installPlan, err := fetchInstallPlanWithNamespace(GinkgoT(), crClient, subscription.Status.InstallPlanRef.Name, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) require.Len(GinkgoT(), installPlan.Status.CatalogSources, 1) }) It("creation with dependencies required and provided in different versions of an operator in the same package", func() { - // PARITY: this test covers the same scenario as the TestSolveOperators_PackageCannotSelfSatisfy unit test + By(` PARITY: this test covers the same scenario as the TestSolveOperators_PackageCannotSelfSatisfy unit test`) kubeClient := ctx.Ctx().KubeClient() crClient := ctx.Ctx().OperatorClient() crd := newCRD(genName("ins")) crd2 := newCRD(genName("ins")) - // csvs for catalogsource 1 + By(`csvs for catalogsource 1`) csvs1 := make([]operatorsv1alpha1.ClusterServiceVersion, 0) - // csvs for catalogsource 2 + By(`csvs for catalogsource 2`) csvs2 := make([]operatorsv1alpha1.ClusterServiceVersion, 0) packageA := registry.PackageManifest{PackageName: "PackageA"} @@ -1564,7 +1560,7 @@ var _ = Describe("Subscription", func() { }) }) - // create catalogsources + By(`create catalogsources`) var catsrc, catsrc2 *operatorsv1alpha1.CatalogSource var cleanup cleanupFunc By("creating catalogsources", func() { @@ -1585,7 +1581,7 @@ var _ = Describe("Subscription", func() { require.NoError(GinkgoT(), err) }) - // Create a subscription for packageA in catsrc + By(`Create a subscription for packageA in catsrc`) subscriptionSpec := &operatorsv1alpha1.SubscriptionSpec{ CatalogSource: catsrc.GetName(), CatalogSourceNamespace: catsrc.GetNamespace(), @@ -1601,7 +1597,7 @@ var _ = Describe("Subscription", func() { require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subscription) - // ensure correct CSVs were picked + By(`ensure correct CSVs were picked`) var got []string Eventually(func() []string { ip, err := crClient.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Get(context.Background(), subscription.Status.InstallPlanRef.Name, metav1.GetOptions{}) @@ -1695,7 +1691,7 @@ var _ = Describe("Subscription", func() { var subscription *operatorsv1alpha1.Subscription BeforeEach(func() { - // Create a subscription for packageA in catsrc + By(`Create a subscription for packageA in catsrc`) subscriptionSpec := &operatorsv1alpha1.SubscriptionSpec{ CatalogSource: catsrcMain.GetName(), CatalogSourceNamespace: catsrcMain.GetNamespace(), @@ -1726,7 +1722,7 @@ var _ = Describe("Subscription", func() { }) It("choose the dependency from the right CatalogSource based on lexicographical name ordering of catalogs", func() { - // ensure correct CSVs were picked + By(`ensure correct CSVs were picked`) Eventually(func() ([]string, error) { ip, err := crClient.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Get(context.Background(), subscription.Status.InstallPlanRef.Name, metav1.GetOptions{}) if err != nil { @@ -1762,7 +1758,7 @@ var _ = Describe("Subscription", func() { genName("catsrc"), generatedNamespace.GetName(), []registry.PackageManifest{packageDepWrong}, []apiextensionsv1.CustomResourceDefinition{crd}, csvsWrong, 100) - // waiting for catalogsources to be ready + By(`waiting for catalogsources to be ready`) _, err := fetchCatalogSourceOnStatus(crClient, catsrcMain.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred()) _, err = fetchCatalogSourceOnStatus(crClient, catsrcDepWrong.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) @@ -1783,7 +1779,7 @@ var _ = Describe("Subscription", func() { var subscription *operatorsv1alpha1.Subscription BeforeEach(func() { - // Create a subscription for packageA in catsrc + By(`Create a subscription for packageA in catsrc`) subscriptionSpec := &operatorsv1alpha1.SubscriptionSpec{ CatalogSource: catsrcMain.GetName(), CatalogSourceNamespace: catsrcMain.GetNamespace(), @@ -1814,7 +1810,7 @@ var _ = Describe("Subscription", func() { }) It("choose the dependent package from the same catsrc as the installing operator", func() { - // ensure correct CSVs were picked + By(`ensure correct CSVs were picked`) Eventually(func() ([]string, error) { ip, err := crClient.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Get(context.Background(), subscription.Status.InstallPlanRef.Name, metav1.GetOptions{}) if err != nil { @@ -1852,7 +1848,7 @@ var _ = Describe("Subscription", func() { catsrcDepWrong, catsrcCleanup3 = createInternalCatalogSource(kubeClient, crClient, genName("catsrc"), generatedNamespace.GetName(), []registry.PackageManifest{packageDepWrong}, []apiextensionsv1.CustomResourceDefinition{crd}, csvsWrong) - // waiting for catalogsources to be ready + By(`waiting for catalogsources to be ready`) _, err := fetchCatalogSourceOnStatus(crClient, catsrcMain.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred()) _, err = fetchCatalogSourceOnStatus(crClient, catsrcDepRight.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) @@ -1877,7 +1873,7 @@ var _ = Describe("Subscription", func() { var subscription *operatorsv1alpha1.Subscription BeforeEach(func() { - // Create a subscription for packageA in catsrc + By(`Create a subscription for packageA in catsrc`) subscriptionSpec := &operatorsv1alpha1.SubscriptionSpec{ CatalogSource: catsrcMain.GetName(), CatalogSourceNamespace: catsrcMain.GetNamespace(), @@ -1908,7 +1904,7 @@ var _ = Describe("Subscription", func() { }) It("choose the dependent package from the catsrc with higher priority", func() { - // ensure correct CSVs were picked + By(`ensure correct CSVs were picked`) Eventually(func() ([]string, error) { ip, err := crClient.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Get(context.Background(), subscription.Status.InstallPlanRef.Name, metav1.GetOptions{}) if err != nil { @@ -1946,7 +1942,7 @@ var _ = Describe("Subscription", func() { catsrcDepWrong, catsrcCleanup3 = createInternalCatalogSource(kubeClient, crClient, genName("catsrc"), operatorNamespace, []registry.PackageManifest{packageDepWrong}, []apiextensionsv1.CustomResourceDefinition{crd}, csvsWrong) - // waiting for catalogsources to be ready + By(`waiting for catalogsources to be ready`) _, err := fetchCatalogSourceOnStatus(crClient, catsrcMain.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) Expect(err).ToNot(HaveOccurred()) _, err = fetchCatalogSourceOnStatus(crClient, catsrcDepRight.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) @@ -1971,7 +1967,7 @@ var _ = Describe("Subscription", func() { var subscription *operatorsv1alpha1.Subscription BeforeEach(func() { - // Create a subscription for packageA in catsrc + By(`Create a subscription for packageA in catsrc`) subscriptionSpec := &operatorsv1alpha1.SubscriptionSpec{ CatalogSource: catsrcMain.GetName(), CatalogSourceNamespace: catsrcMain.GetNamespace(), @@ -2002,7 +1998,7 @@ var _ = Describe("Subscription", func() { }) It("choose the dependent package from the catsrc in the same namespace as the installing operator", func() { - // ensure correct CSVs were picked + By(`ensure correct CSVs were picked`) Eventually(func() ([]string, error) { ip, err := crClient.OperatorsV1alpha1().InstallPlans(generatedNamespace.GetName()).Get(context.Background(), subscription.Status.InstallPlanRef.Name, metav1.GetOptions{}) if err != nil { @@ -2015,45 +2011,45 @@ var _ = Describe("Subscription", func() { }) }) - // csvA owns CRD1 & csvB owns CRD2 and requires CRD1 - // Create subscription for csvB lead to installation of csvB and csvA - // Update catsrc to upgrade csvA to csvNewA which now requires CRD1 - // csvNewA can't be installed due to no other operators provide CRD1 for it - // (Note: OLM can't pick csvA as dependency for csvNewA as it is from the same - // same package) - // Update catsrc again to upgrade csvB to csvNewB which now owns both CRD1 and - // CRD2. - // Now csvNewA and csvNewB are installed successfully as csvNewB provides CRD1 - // that csvNewA requires It("creation in case of transferring providedAPIs", func() { - // PARITY: this test covers the same scenario as the TestSolveOperators_TransferApiOwnership unit test + By(`csvA owns CRD1 & csvB owns CRD2 and requires CRD1`) + By(`Create subscription for csvB lead to installation of csvB and csvA`) + By(`Update catsrc to upgrade csvA to csvNewA which now requires CRD1`) + By(`csvNewA can't be installed due to no other operators provide CRD1 for it`) + By(`(Note: OLM can't pick csvA as dependency for csvNewA as it is from the same`) + By(`same package)`) + By(`Update catsrc again to upgrade csvB to csvNewB which now owns both CRD1 and`) + By(`CRD2.`) + By(`Now csvNewA and csvNewB are installed successfully as csvNewB provides CRD1`) + By(`that csvNewA requires`) + By(` PARITY: this test covers the same scenario as the TestSolveOperators_TransferApiOwnership unit test`) kubeClient := ctx.Ctx().KubeClient() crClient := ctx.Ctx().OperatorClient() crd := newCRD(genName("ins")) crd2 := newCRD(genName("ins")) - // Create CSV + By(`Create CSV`) packageName1 := genName("apackage") packageName2 := genName("bpackage") - // csvA provides CRD + By(`csvA provides CRD`) csvA := newCSV("nginx-a", generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crd}, nil, nil) - // csvB provides CRD2 and requires CRD + By(`csvB provides CRD2 and requires CRD`) csvB := newCSV("nginx-b", generatedNamespace.GetName(), "", semver.MustParse("0.1.0"), []apiextensionsv1.CustomResourceDefinition{crd2}, []apiextensionsv1.CustomResourceDefinition{crd}, nil) - // New csvA requires CRD (transfer CRD ownership to the new csvB) + By(`New csvA requires CRD (transfer CRD ownership to the new csvB)`) csvNewA := newCSV("nginx-new-a", generatedNamespace.GetName(), "nginx-a", semver.MustParse("0.2.0"), nil, []apiextensionsv1.CustomResourceDefinition{crd}, nil) - // New csvB provides CRD and CRD2 + By(`New csvB provides CRD and CRD2`) csvNewB := newCSV("nginx-new-b", generatedNamespace.GetName(), "nginx-b", semver.MustParse("0.2.0"), []apiextensionsv1.CustomResourceDefinition{crd, crd2}, nil, nil) - // constraints not satisfiable: - // apackagert6cq requires at least one of catsrcc6xgr/operators/stable/nginx-new-a, - // apackagert6cq is mandatory, - // pkgunique/apackagert6cq permits at most 1 of catsrcc6xgr/operators/stable/nginx-new-a, catsrcc6xgr/operators/stable/nginx-a, - // catsrcc6xgr/operators/stable/nginx-new-a requires at least one of catsrcc6xgr/operators/stable/nginx-a + By(`constraints not satisfiable:`) + By(`apackagert6cq requires at least one of catsrcc6xgr/operators/stable/nginx-new-a,`) + By(`apackagert6cq is mandatory,`) + By(`pkgunique/apackagert6cq permits at most 1 of catsrcc6xgr/operators/stable/nginx-new-a, catsrcc6xgr/operators/stable/nginx-a,`) + By(`catsrcc6xgr/operators/stable/nginx-new-a requires at least one of catsrcc6xgr/operators/stable/nginx-a`) - // Create PackageManifests 1 - // Contain csvA, ABC and B + By(`Create PackageManifests 1`) + By(`Contain csvA, ABC and B`) manifests := []registry.PackageManifest{ { PackageName: packageName1, @@ -2075,7 +2071,7 @@ var _ = Describe("Subscription", func() { catsrc, cleanup := createInternalCatalogSource(kubeClient, crClient, catalogSourceName, generatedNamespace.GetName(), manifests, []apiextensionsv1.CustomResourceDefinition{crd, crd2}, []operatorsv1alpha1.ClusterServiceVersion{csvA, csvB}) defer cleanup() - // Ensure that the catalog source is resolved before we create a subscription. + By(`Ensure that the catalog source is resolved before we create a subscription.`) _, err := fetchCatalogSourceOnStatus(crClient, catsrc.GetName(), generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -2088,7 +2084,7 @@ var _ = Describe("Subscription", func() { InstallPlanApproval: operatorsv1alpha1.ApprovalAutomatic, } - // Create a subscription that has a dependency + By(`Create a subscription that has a dependency`) subscriptionName := genName("sub-") cleanupSubscription := createSubscriptionForCatalogWithSpec(GinkgoT(), crClient, generatedNamespace.GetName(), subscriptionName, subscriptionSpec) defer cleanupSubscription() @@ -2097,16 +2093,16 @@ var _ = Describe("Subscription", func() { require.NoError(GinkgoT(), err) require.NotNil(GinkgoT(), subscription) - // Check that a single catalog source was used to resolve the InstallPlan + By(`Check that a single catalog source was used to resolve the InstallPlan`) _, err = fetchInstallPlanWithNamespace(GinkgoT(), crClient, subscription.Status.InstallPlanRef.Name, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete)) require.NoError(GinkgoT(), err) - // Fetch CSVs A and B + By(`Fetch CSVs A and B`) _, err = fetchCSV(crClient, generatedNamespace.GetName(), csvA.Name, csvSucceededChecker) require.NoError(GinkgoT(), err) _, err = fetchCSV(crClient, generatedNamespace.GetName(), csvB.Name, csvSucceededChecker) require.NoError(GinkgoT(), err) - // Update PackageManifest + By(`Update PackageManifest`) manifests = []registry.PackageManifest{ { PackageName: packageName1, @@ -2127,14 +2123,14 @@ var _ = Describe("Subscription", func() { csvAsub := strings.Join([]string{packageName1, stableChannel, catalogSourceName, generatedNamespace.GetName()}, "-") _, err = fetchSubscription(crClient, generatedNamespace.GetName(), csvAsub, subscriptionStateAtLatestChecker()) require.NoError(GinkgoT(), err) - // Ensure csvNewA is not installed + By(`Ensure csvNewA is not installed`) _, err = crClient.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Get(context.Background(), csvNewA.Name, metav1.GetOptions{}) require.Error(GinkgoT(), err) - // Ensure csvA still exists + By(`Ensure csvA still exists`) _, err = fetchCSV(crClient, generatedNamespace.GetName(), csvA.Name, csvSucceededChecker) require.NoError(GinkgoT(), err) - // Update packagemanifest again + By(`Update packagemanifest again`) manifests = []registry.PackageManifest{ { PackageName: packageName1, @@ -2155,10 +2151,10 @@ var _ = Describe("Subscription", func() { _, err = fetchSubscription(crClient, generatedNamespace.GetName(), subscriptionName, subscriptionHasInstallPlanDifferentChecker(subscription.Status.InstallPlanRef.Name)) require.NoError(GinkgoT(), err) - // Ensure csvNewA is installed + By(`Ensure csvNewA is installed`) _, err = fetchCSV(crClient, generatedNamespace.GetName(), csvNewA.Name, csvSucceededChecker) require.NoError(GinkgoT(), err) - // Ensure csvNewB is installed + By(`Ensure csvNewB is installed`) _, err = fetchCSV(crClient, generatedNamespace.GetName(), csvNewB.Name, csvSucceededChecker) require.NoError(GinkgoT(), err) }) @@ -2194,7 +2190,7 @@ var _ = Describe("Subscription", func() { _, teardown = createInternalCatalogSource(c, ctx.Ctx().OperatorClient(), catSrcName, generatedNamespace.GetName(), packages, nil, []operatorsv1alpha1.ClusterServiceVersion{csvA}) - // Ensure that the catalog source is resolved before we create a subscription. + By(`Ensure that the catalog source is resolved before we create a subscription.`) _, err := fetchCatalogSourceOnStatus(crc, catSrcName, generatedNamespace.GetName(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) @@ -2563,7 +2559,7 @@ var _ = Describe("Subscription", func() { Expect(err).Should(BeNil()) By("checking for the deprecated conditions") - // Operator is deprecated at all three levels in the catalog + By(`Operator is deprecated at all three levels in the catalog`) packageCondition := sub.Status.GetCondition(operatorsv1alpha1.SubscriptionPackageDeprecated) Expect(packageCondition.Status).To(Equal(corev1.ConditionTrue)) channelCondition := sub.Status.GetCondition(operatorsv1alpha1.SubscriptionChannelDeprecated) @@ -2572,7 +2568,7 @@ var _ = Describe("Subscription", func() { Expect(bundleCondition.Status).To(Equal(corev1.ConditionTrue)) By("verifying that a roll-up condition is present containing all deprecation conditions") - // Roll-up condition should be present and contain deprecation messages from all three levels + By(`Roll-up condition should be present and contain deprecation messages from all three levels`) rollUpCondition := sub.Status.GetCondition(operatorsv1alpha1.SubscriptionDeprecated) Expect(rollUpCondition.Status).To(Equal(corev1.ConditionTrue)) Expect(rollUpCondition.Message).To(ContainSubstring(packageCondition.Message)) @@ -2631,7 +2627,7 @@ var _ = Describe("Subscription", func() { Expect(err).Should(BeNil()) By("checking for the deprecated conditions") - // Operator is deprecated at only Package and Channel levels + By(`Operator is deprecated at only Package and Channel levels`) packageCondition := sub.Status.GetCondition(operatorsv1alpha1.SubscriptionPackageDeprecated) Expect(packageCondition.Status).To(Equal(corev1.ConditionTrue)) channelCondition := sub.Status.GetCondition(operatorsv1alpha1.SubscriptionChannelDeprecated) @@ -2640,7 +2636,7 @@ var _ = Describe("Subscription", func() { Expect(bundleCondition.Status).To(Equal(corev1.ConditionUnknown)) By("verifying that a roll-up condition is present not containing bundle deprecation condition") - // Roll-up condition should be present and contain deprecation messages from Package and Channel levels + By(`Roll-up condition should be present and contain deprecation messages from Package and Channel levels`) rollUpCondition := sub.Status.GetCondition(operatorsv1alpha1.SubscriptionDeprecated) Expect(rollUpCondition.Status).To(Equal(corev1.ConditionTrue)) Expect(rollUpCondition.Message).To(ContainSubstring(packageCondition.Message)) @@ -2707,7 +2703,7 @@ var _ = Describe("Subscription", func() { Expect(err).NotTo(HaveOccurred(), "error creating container registry: %s", err) defer deleteDockerRegistry(c, generatedNamespace.GetName()) - // ensure registry pod is ready before attempting port-forwarding + By(`ensure registry pod is ready before attempting port-forwarding`) _ = awaitPod(GinkgoT(), c, generatedNamespace.GetName(), registryName, podReady) err = registryPortForward(generatedNamespace.GetName()) @@ -2739,7 +2735,7 @@ var _ = Describe("Subscription", func() { return fmt.Errorf("error creating skopeo pod: %v", err) } - // wait for skopeo pod to exit successfully + By(`wait for skopeo pod to exit successfully`) awaitPod(GinkgoT(), c, generatedNamespace.GetName(), skopeo, func(pod *corev1.Pod) bool { return pod.Status.Phase == corev1.PodSucceeded }) @@ -2751,11 +2747,11 @@ var _ = Describe("Subscription", func() { } } - // The remote image to be copied onto the local registry + By(`The remote image to be copied onto the local registry`) srcImage := "quay.io/olmtest/example-operator-bundle:" srcTag := "0.1.0" - // on-cluster image ref + By(`on-cluster image ref`) bundleImage := registryURL + "/unpack-retry-bundle:" bundleTag := genName("x") diff --git a/test/e2e/webhook_e2e_test.go b/test/e2e/webhook_e2e_test.go index 6a10cb2ce9..dcd601e04d 100644 --- a/test/e2e/webhook_e2e_test.go +++ b/test/e2e/webhook_e2e_test.go @@ -154,7 +154,7 @@ var _ = Describe("CSVs with a Webhook", func() { } Expect(actualWebhook.Webhooks[0].NamespaceSelector).Should(Equal(expected)) - // Ensure that changes to the WebhookDescription within the CSV trigger an update to on cluster resources + By(`Ensure that changes to the WebhookDescription within the CSV trigger an update to on cluster resources`) changedGenerateName := webhookName + "-changed" Eventually(func() error { existingCSV, err := crc.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Get(context.TODO(), csv.GetName(), metav1.GetOptions{}) @@ -167,13 +167,13 @@ var _ = Describe("CSVs with a Webhook", func() { return err }, time.Minute, 5*time.Second).Should(Succeed()) Eventually(func() bool { - // Previous Webhook should be deleted + By(`Previous Webhook should be deleted`) _, err = getWebhookWithGenerateName(c, webhookName) if err != nil && err.Error() != "NotFound" { return false } - // Current Webhook should exist + By(`Current Webhook should exist`) _, err = getWebhookWithGenerateName(c, changedGenerateName) return err == nil }, time.Minute, 5*time.Second).Should(BeTrue()) @@ -197,12 +197,12 @@ var _ = Describe("CSVs with a Webhook", func() { _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).Should(BeNil()) - // Get the existing secret + By(`Get the existing secret`) webhookSecretName := webhook.DeploymentName + "-service-cert" existingSecret, err := c.KubernetesInterface().CoreV1().Secrets(generatedNamespace.GetName()).Get(context.TODO(), webhookSecretName, metav1.GetOptions{}) require.NoError(GinkgoT(), err) - // Modify the phase + By(`Modify the phase`) Eventually(func() bool { fetchedCSV, err := crc.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Get(context.TODO(), csv.GetName(), metav1.GetOptions{}) if err != nil { @@ -215,11 +215,11 @@ var _ = Describe("CSVs with a Webhook", func() { return err == nil }).Should(BeTrue(), "Unable to set CSV phase to Pending") - // Wait for webhook-operator to succeed + By(`Wait for webhook-operator to succeed`) _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.GetName(), csvSucceededChecker) require.NoError(GinkgoT(), err) - // Get the updated secret + By(`Get the updated secret`) updatedSecret, err := c.KubernetesInterface().CoreV1().Secrets(generatedNamespace.GetName()).Get(context.TODO(), webhookSecretName, metav1.GetOptions{}) require.NoError(GinkgoT(), err) @@ -398,7 +398,7 @@ var _ = Describe("CSVs with a Webhook", func() { _, err := createCSV(c, crc, csv, generatedNamespace.GetName(), false, false) Expect(err).Should(BeNil()) - // cleanup by upgrade + By(`cleanup by upgrade`) _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, csvSucceededChecker) Expect(err).Should(BeNil()) @@ -406,7 +406,7 @@ var _ = Describe("CSVs with a Webhook", func() { _, err = getWebhookWithGenerateName(c, webhook.GenerateName) Expect(err).Should(BeNil()) - // Update the CSV so it it replaces the existing CSV + By(`Update the CSV so it it replaces the existing CSV`) csv.Spec.Replaces = csv.GetName() csv.Name = genName("csv-") previousWebhookName := webhook.GenerateName @@ -421,11 +421,11 @@ var _ = Describe("CSVs with a Webhook", func() { _, err = getWebhookWithGenerateName(c, webhook.GenerateName) Expect(err).Should(BeNil()) - // Make sure old resources are cleaned up. + By(`Make sure old resources are cleaned up.`) err = waitForCsvToDelete(generatedNamespace.GetName(), csv.Spec.Replaces, crc) Expect(err).ShouldNot(HaveOccurred()) - // Wait until previous webhook is cleaned up + By(`Wait until previous webhook is cleaned up`) Eventually(func() (bool, error) { _, err := c.KubernetesInterface().AdmissionregistrationV1().ValidatingWebhookConfigurations().Get(context.TODO(), previousWebhookName, metav1.GetOptions{}) if errors.IsNotFound(err) { @@ -437,8 +437,8 @@ var _ = Describe("CSVs with a Webhook", func() { return false, nil }).Should(BeTrue()) }) - // issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2629 It("[FLAKE] Is updated when the CAs expire", func() { + By(`issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/2629`) sideEffect := admissionregistrationv1.SideEffectClassNone webhook := operatorsv1alpha1.WebhookDescription{ GenerateName: webhookName, @@ -463,7 +463,7 @@ var _ = Describe("CSVs with a Webhook", func() { oldWebhookCABundle := actualWebhook.Webhooks[0].ClientConfig.CABundle - // Get the deployment + By(`Get the deployment`) dep, err := c.KubernetesInterface().AppsV1().Deployments(generatedNamespace.GetName()).Get(context.TODO(), csv.Spec.WebhookDefinitions[0].DeploymentName, metav1.GetOptions{}) Expect(err).Should(BeNil()) @@ -471,7 +471,7 @@ var _ = Describe("CSVs with a Webhook", func() { oldCAAnnotation, ok := dep.Spec.Template.GetAnnotations()[install.OLMCAHashAnnotationKey] Expect(ok).Should(BeTrue()) - // Induce a cert rotation + By(`Induce a cert rotation`) Eventually(Apply(fetchedCSV, func(csv *operatorsv1alpha1.ClusterServiceVersion) error { now := metav1.Now() csv.Status.CertsLastUpdated = &now @@ -480,20 +480,20 @@ var _ = Describe("CSVs with a Webhook", func() { })).Should(Succeed()) _, err = fetchCSV(crc, generatedNamespace.GetName(), csv.Name, func(csv *operatorsv1alpha1.ClusterServiceVersion) bool { - // Should create deployment + By(`Should create deployment`) dep, err = c.GetDeployment(generatedNamespace.GetName(), csv.Spec.WebhookDefinitions[0].DeploymentName) if err != nil { return false } - // Should have a new ca hash annotation + By(`Should have a new ca hash annotation`) newCAAnnotation, ok := dep.Spec.Template.GetAnnotations()[install.OLMCAHashAnnotationKey] if !ok { return false } if newCAAnnotation != oldCAAnnotation { - // Check for success + By(`Check for success`) return csvSucceededChecker(csv) } @@ -501,7 +501,7 @@ var _ = Describe("CSVs with a Webhook", func() { }) Expect(err).Should(BeNil()) - // get new webhook + By(`get new webhook`) actualWebhook, err = getWebhookWithGenerateName(c, webhook.GenerateName) Expect(err).Should(BeNil()) @@ -648,14 +648,14 @@ var _ = Describe("CSVs with a Webhook", func() { _, err := crc.OperatorsV1().OperatorGroups(generatedNamespace.GetName()).Create(context.TODO(), og, metav1.CreateOptions{}) Expect(err).Should(BeNil()) - // Create a catalogSource which has the webhook-operator + By(`Create a catalogSource which has the webhook-operator`) sourceName := genName("catalog-") packageName := "webhook-operator" channelName := "alpha" catSrcImage := "quay.io/operator-framework/webhook-operator-index" - // Create gRPC CatalogSource + By(`Create gRPC CatalogSource`) source := &operatorsv1alpha1.CatalogSource{ TypeMeta: metav1.TypeMeta{ Kind: operatorsv1alpha1.CatalogSourceKind, @@ -680,11 +680,11 @@ var _ = Describe("CSVs with a Webhook", func() { require.NoError(GinkgoT(), crc.OperatorsV1alpha1().CatalogSources(source.GetNamespace()).Delete(context.TODO(), source.GetName(), metav1.DeleteOptions{})) } - // Wait for the CatalogSource to be ready + By(`Wait for the CatalogSource to be ready`) _, err = fetchCatalogSourceOnStatus(crc, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced()) require.NoError(GinkgoT(), err) - // Create a Subscription for the webhook-operator + By(`Create a Subscription for the webhook-operator`) subscriptionName := genName("sub-") cleanupSubscription := createSubscriptionForCatalog(crc, source.GetNamespace(), subscriptionName, source.GetName(), packageName, channelName, "", operatorsv1alpha1.ApprovalAutomatic) defer cleanupSubscription() @@ -692,7 +692,7 @@ var _ = Describe("CSVs with a Webhook", func() { _, err = fetchSubscription(crc, source.GetNamespace(), subscriptionName, subscriptionHasInstallPlanChecker()) require.NoError(GinkgoT(), err) - // Wait for webhook-operator v2 csv to succeed + By(`Wait for webhook-operator v2 csv to succeed`) csv, err := fetchCSV(crc, source.GetNamespace(), csvName, csvSucceededChecker) require.NoError(GinkgoT(), err) @@ -712,7 +712,7 @@ var _ = Describe("CSVs with a Webhook", func() { }) It("Validating, Mutating and Conversion webhooks work as intended", func() { - // An invalid custom resource is rejected by the validating webhook + By(`An invalid custom resource is rejected by the validating webhook`) invalidCR := &unstructured.Unstructured{ Object: map[string]interface{}{ "apiVersion": "webhook.operators.coreos.io/v1", @@ -735,7 +735,7 @@ var _ = Describe("CSVs with a Webhook", func() { return true }).Should(BeTrue(), "The admission webhook should have rejected the invalid resource") - // An valid custom resource is acceoted by the validating webhook and the mutating webhook sets the CR's spec.mutate field to true. + By(`An valid custom resource is acceoted by the validating webhook and the mutating webhook sets the CR's spec.mutate field to true.`) validCR := &unstructured.Unstructured{ Object: map[string]interface{}{ "apiVersion": "webhook.operators.coreos.io/v1", @@ -753,7 +753,7 @@ var _ = Describe("CSVs with a Webhook", func() { defer crCleanupFunc() require.NoError(GinkgoT(), err, "The valid CR should have been approved by the validating webhook") - // Check that you can get v1 of the webhooktest cr + By(`Check that you can get v1 of the webhooktest cr`) v1UnstructuredObject, err := c.GetCustomResource("webhook.operators.coreos.io", "v1", generatedNamespace.GetName(), "webhooktests", "my-cr-1") require.NoError(GinkgoT(), err, "Unable to get the v1 of the valid CR") v1Object := v1UnstructuredObject.Object @@ -767,7 +767,7 @@ var _ = Describe("CSVs with a Webhook", func() { require.True(GinkgoT(), v1SpecMutate, "The mutating webhook should have set the valid CR's spec.mutate field to true") require.True(GinkgoT(), v1SpecValid, "The validating webhook should have required that the CR's spec.valid field is true") - // Check that you can get v2 of the webhooktest cr + By(`Check that you can get v2 of the webhooktest cr`) v2UnstructuredObject, err := c.GetCustomResource("webhook.operators.coreos.io", "v2", generatedNamespace.GetName(), "webhooktests", "my-cr-1") require.NoError(GinkgoT(), err, "Unable to get the v2 of the valid CR") v2Object := v2UnstructuredObject.Object @@ -782,7 +782,7 @@ var _ = Describe("CSVs with a Webhook", func() { require.True(GinkgoT(), v2SpecConversionMutate) require.True(GinkgoT(), v2SpecConversionValid) - // Check that conversion strategies are disabled after uninstalling the operator. + By(`Check that conversion strategies are disabled after uninstalling the operator.`) err = crc.OperatorsV1alpha1().ClusterServiceVersions(generatedNamespace.GetName()).Delete(context.TODO(), csvName, metav1.DeleteOptions{}) require.NoError(GinkgoT(), err) @@ -806,7 +806,7 @@ var _ = Describe("CSVs with a Webhook", func() { var cleanupCSV cleanupFunc BeforeEach(func() { - // global operator group + By(`global operator group`) og := newOperatorGroup(generatedNamespace.GetName(), genName("global-og-"), nil, nil, []string{}, false) og, err := crc.OperatorsV1().OperatorGroups(generatedNamespace.GetName()).Create(context.TODO(), og, metav1.CreateOptions{}) Expect(err).Should(BeNil()) @@ -819,21 +819,21 @@ var _ = Describe("CSVs with a Webhook", func() { }) It("The conversion CRD is not updated via webhook when CSV does not own this CRD", func() { - // create CRD (crdA) + By(`create CRD (crdA)`) crdAPlural := genName("mockcrda") crdA := newV1CRD(crdAPlural) cleanupCRD, er := createCRD(c, crdA) require.NoError(GinkgoT(), er) defer cleanupCRD() - // create another CRD (crdB) + By(`create another CRD (crdB)`) crdBPlural := genName("mockcrdb") crdB := newV1CRD(crdBPlural) cleanupCRD2, er := createCRD(c, crdB) require.NoError(GinkgoT(), er) defer cleanupCRD2() - // describe webhook + By(`describe webhook`) sideEffect := admissionregistrationv1.SideEffectClassNone webhook := operatorsv1alpha1.WebhookDescription{ GenerateName: webhookName, @@ -847,7 +847,7 @@ var _ = Describe("CSVs with a Webhook", func() { ownedCRDDescs := make([]operatorsv1alpha1.CRDDescription, 0) - // create CSV + By(`create CSV`) csv := createCSVWithWebhookAndCrds(generatedNamespace.GetName(), webhook, ownedCRDDescs) var err error @@ -869,10 +869,10 @@ var _ = Describe("CSVs with a Webhook", func() { Strategy: "Webhook", } - // Read the updated crdA on cluster into the following crd + By(`Read the updated crdA on cluster into the following crd`) tempCrdA, err := c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), crdA.GetName(), metav1.GetOptions{}) - // Read the updated crdB on cluster into the following crd + By(`Read the updated crdB on cluster into the following crd`) tempCrdB, err := c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), crdB.GetName(), metav1.GetOptions{}) Expect(tempCrdA.Spec.Conversion.Strategy).Should(Equal(expectedUpdatedCrdFields.Strategy)) @@ -888,14 +888,14 @@ var _ = Describe("CSVs with a Webhook", func() { Expect(tempCrdA.Spec.Conversion.Webhook.ClientConfig.Service.Namespace).Should(Equal(expectedConvertNamespace)) }) It("The CSV is not created when dealing with conversionCRD and multiple installModes support exists", func() { - // create CRD (crdA) + By(`create CRD (crdA)`) crdAPlural := genName("mockcrda") crdA := newV1CRD(crdAPlural) cleanupCRD, er := createCRD(c, crdA) require.NoError(GinkgoT(), er) defer cleanupCRD() - // describe webhook + By(`describe webhook`) sideEffect := admissionregistrationv1.SideEffectClassNone webhook := operatorsv1alpha1.WebhookDescription{ GenerateName: webhookName, @@ -910,7 +910,7 @@ var _ = Describe("CSVs with a Webhook", func() { ownedCRDDescs := make([]operatorsv1alpha1.CRDDescription, 0) ownedCRDDescs = append(ownedCRDDescs, operatorsv1alpha1.CRDDescription{Name: crdA.GetName(), Version: crdA.Spec.Versions[0].Name, Kind: crdA.Spec.Names.Kind}) - // create CSV + By(`create CSV`) csv := createCSVWithWebhookAndCrdsAndInvalidInstallModes(generatedNamespace.GetName(), webhook, ownedCRDDescs) var err error @@ -932,7 +932,7 @@ var _ = Describe("CSVs with a Webhook", func() { Strategy: "Webhook", } - // Read the updated crdA on cluster into the following crd + By(`Read the updated crdA on cluster into the following crd`) tempCrdA, err := c.ApiextensionsInterface().ApiextensionsV1().CustomResourceDefinitions().Get(context.TODO(), crdA.GetName(), metav1.GetOptions{}) Expect(tempCrdA.Spec.Conversion.Strategy).Should(Equal(expectedUpdatedCrdFields.Strategy)) @@ -942,7 +942,7 @@ var _ = Describe("CSVs with a Webhook", func() { Expect(tempCrdA.Spec.Conversion.Webhook.ClientConfig.Service.Port).Should(Equal(&expectedTempPort)) Expect(tempCrdA.Spec.Conversion.Webhook.ClientConfig.Service.Path).Should(Equal(&expectedConvertPath)) - // CRD namespace would not be updated, hence conversion webhook won't work for objects of this CRD's Kind + By(`CRD namespace would not be updated, hence conversion webhook won't work for objects of this CRD's Kind`) Expect(tempCrdA.Spec.Conversion.Webhook.ClientConfig.Service.Namespace).ShouldNot(Equal(csv.GetNamespace())) }) })