From e77fae7688ef91fa9090cb4379323c99f3299eb2 Mon Sep 17 00:00:00 2001 From: Steve Kuznetsov Date: Wed, 13 Sep 2023 07:53:05 -0600 Subject: [PATCH] work Signed-off-by: Steve Kuznetsov --- pkg/controller/install/deployment.go | 2 +- pkg/controller/install/deployment_test.go | 1 + test/e2e/catalog_e2e_test.go | 2 +- test/e2e/csv_e2e_test.go | 23 ++++++++++++++++++++++- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/pkg/controller/install/deployment.go b/pkg/controller/install/deployment.go index 12e8044b259..8d5e7262618 100644 --- a/pkg/controller/install/deployment.go +++ b/pkg/controller/install/deployment.go @@ -152,11 +152,11 @@ func (i *StrategyDeploymentInstaller) deploymentForSpec(name string, spec appsv1 dep.Spec.Template.SetAnnotations(annotations) // Set custom labels before CSV owner labels + dep.SetLabels(specLabels) if dep.Labels == nil { dep.Labels = map[string]string{} } dep.Labels[OLMManagedLabelKey] = OLMManagedLabelValue - dep.SetLabels(specLabels) ownerutil.AddNonBlockingOwner(dep, i.owner) ownerutil.AddOwnerLabelsForKind(dep, i.owner, v1alpha1.ClusterServiceVersionKind) diff --git a/pkg/controller/install/deployment_test.go b/pkg/controller/install/deployment_test.go index d9ec66cc2a8..cceea7deb99 100644 --- a/pkg/controller/install/deployment_test.go +++ b/pkg/controller/install/deployment_test.go @@ -353,6 +353,7 @@ func TestInstallStrategyDeploymentCheckInstallErrors(t *testing.T) { dep.Spec.Template.SetAnnotations(map[string]string{"test": "annotation"}) dep.Spec.RevisionHistoryLimit = &revisionHistoryLimit dep.SetLabels(labels.CloneAndAddLabel(dep.ObjectMeta.GetLabels(), DeploymentSpecHashLabelKey, HashDeploymentSpec(dep.Spec))) + dep.Labels[OLMManagedLabelKey] = OLMManagedLabelValue dep.Status.Conditions = append(dep.Status.Conditions, appsv1.DeploymentCondition{ Type: appsv1.DeploymentAvailable, Status: corev1.ConditionTrue, diff --git a/test/e2e/catalog_e2e_test.go b/test/e2e/catalog_e2e_test.go index ff041e9159e..b7aa95a1d85 100644 --- a/test/e2e/catalog_e2e_test.go +++ b/test/e2e/catalog_e2e_test.go @@ -783,7 +783,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() { Expect(err).ShouldNot(HaveOccurred()) By("Wait for the CatalogSource to be ready") - source, err = fetchCatalogSourceOnStatus(crc, source.GetName(), source.GetNamespace(), catalogSourceRegistryPodSynced) + 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 - diff --git a/test/e2e/csv_e2e_test.go b/test/e2e/csv_e2e_test.go index ea7409745fd..2b7560470d4 100644 --- a/test/e2e/csv_e2e_test.go +++ b/test/e2e/csv_e2e_test.go @@ -4402,21 +4402,43 @@ func newMockExtServerDeployment(labelName string, mGVKs []mockGroupVersionKind) type csvConditionChecker func(csv *operatorsv1alpha1.ClusterServiceVersion) bool func buildCSVConditionChecker(phases ...operatorsv1alpha1.ClusterServiceVersionPhase) csvConditionChecker { + var lastPhase operatorsv1alpha1.ClusterServiceVersionPhase + var lastReason operatorsv1alpha1.ConditionReason + var lastMessage string + lastTime := time.Now() + return func(csv *operatorsv1alpha1.ClusterServiceVersion) bool { conditionMet := false for _, phase := range phases { conditionMet = conditionMet || csv.Status.Phase == phase } + phase, reason, message := csv.Status.Phase, csv.Status.Reason, csv.Status.Message + if phase != lastPhase || reason != lastReason || message != lastMessage { + ctx.Ctx().Logf("waited %s for CSV %s/%s: to be in phases %s, in phase %s (%s): %s", time.Since(lastTime), csv.Namespace, csv.Name, phases, phase, reason, message) + lastPhase, lastReason, lastMessage = phase, reason, message + lastTime = time.Now() + } return conditionMet } } func buildCSVReasonChecker(reasons ...operatorsv1alpha1.ConditionReason) csvConditionChecker { + var lastPhase operatorsv1alpha1.ClusterServiceVersionPhase + var lastReason operatorsv1alpha1.ConditionReason + var lastMessage string + lastTime := time.Now() + return func(csv *operatorsv1alpha1.ClusterServiceVersion) bool { conditionMet := false for _, reason := range reasons { conditionMet = conditionMet || csv.Status.Reason == reason } + phase, reason, message := csv.Status.Phase, csv.Status.Reason, csv.Status.Message + if phase != lastPhase || reason != lastReason || message != lastMessage { + ctx.Ctx().Logf("waited %s for CSV %s/%s: to have reasons %s, in phase %s (%s): %s", time.Since(lastTime), csv.Namespace, csv.Name, reasons, phase, reason, message) + lastPhase, lastReason, lastMessage = phase, reason, message + lastTime = time.Now() + } return conditionMet } } @@ -4438,7 +4460,6 @@ func fetchCSV(c versioned.Interface, name, namespace string, checker csvConditio if err != nil { return false, err } - ctx.Ctx().Logf("CSV %s/%s: phase %s (%s): %s", namespace, name, fetchedCSV.Status.Phase, fetchedCSV.Status.Reason, fetchedCSV.Status.Message) return checker(fetchedCSV), nil }).Should(BeTrue())