Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Kuznetsov <[email protected]>
  • Loading branch information
stevekuznetsov committed Sep 13, 2023
1 parent 09292e4 commit 365a2ec
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/install/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/catalog_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand Down
23 changes: 22 additions & 1 deletion test/e2e/csv_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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())

Expand Down

0 comments on commit 365a2ec

Please sign in to comment.