Skip to content

Commit

Permalink
Fix envtest evaluating wrong data
Browse files Browse the repository at this point in the history
fixes #807
  • Loading branch information
git-hyagi authored and openshift-merge-robot committed Nov 28, 2022
1 parent 3c95eca commit 1a77192
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGES/807.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed an issue with envtest failing because of an assessment with old value.
38 changes: 14 additions & 24 deletions controllers/repo_manager/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -798,12 +798,13 @@ var _ = Describe("Pulp controller", Ordered, func() {
By("Modifying database image")

// make sure that there is no tasks running before proceeding
//waitPulpOperatorFinish(ctx, createdPulp)
objectGet(ctx, createdSts, StsName)
objectGet(ctx, createdPulp, PulpName)

createdPulp.Spec.Database.PostgresImage = "postgres:12"
objectUpdate(ctx, createdPulp)
Eventually(func() bool {
k8sClient.Get(ctx, types.NamespacedName{Name: PulpName, Namespace: PulpNamespace}, createdPulp)
createdPulp.Spec.Database.PostgresImage = "postgres:12"
objectUpdate(ctx, createdPulp)
return createdPulp.Spec.Database.PostgresImage == "postgres:12"
}, timeout, interval).Should(BeTrue())

// we expect that pulp controller update sts with the new image defined in pulp CR
Eventually(func() bool {
Expand Down Expand Up @@ -947,16 +948,10 @@ var _ = Describe("Pulp controller", Ordered, func() {
Context("When creating Content deployment", func() {
It("Should follow the spec from pulp CR", func() {
By("Checking content deployment being found")
//waitPulpOperatorFinish(ctx, createdPulp)

objectGet(ctx, createdContentDeployment, ContentName)

var isEqual = func(predicate interface{}) bool {
return equality.Semantic.DeepDerivative(expectedContentDeployment.Spec.Template, predicate)
}

By("Checking content deployment expected Template")
Expect(createdContentDeployment.Spec.Template).Should(Satisfy(isEqual))
Eventually(func() bool {
k8sClient.Get(ctx, types.NamespacedName{Name: ContentName, Namespace: PulpNamespace}, createdContentDeployment)
return equality.Semantic.DeepDerivative(expectedContentDeployment.Spec.Template, createdContentDeployment.Spec.Template)
}, timeout, interval).Should(BeTrue())
})
})

Expand Down Expand Up @@ -1013,15 +1008,10 @@ var _ = Describe("Pulp controller", Ordered, func() {
Context("When creating Worker deployment", func() {
It("Should follow the spec from pulp CR", func() {
By("Checking worker deployment being found")
//waitPulpOperatorFinish(ctx, createdPulp)
objectGet(ctx, createdWorkerDeployment, WorkerName)

var isEqual = func(predicate interface{}) bool {
return equality.Semantic.DeepDerivative(expectedWorkerDeployment.Spec.Template, predicate)
}

By("Checking content deployment expected Template")
Expect(createdWorkerDeployment.Spec.Template).Should(Satisfy(isEqual))
Eventually(func() bool {
k8sClient.Get(ctx, types.NamespacedName{Name: WorkerName, Namespace: PulpNamespace}, createdWorkerDeployment)
return equality.Semantic.DeepDerivative(expectedWorkerDeployment.Spec.Template, createdWorkerDeployment.Spec.Template)
}, timeout, interval).Should(BeTrue())
})
})

Expand Down

0 comments on commit 1a77192

Please sign in to comment.