Skip to content

Commit

Permalink
Fix test for upsi last operation update type
Browse files Browse the repository at this point in the history
Co-authored-by: Danail Branekov <danailster@gmail.com>
  • Loading branch information
uzabanov and danail-branekov committed Dec 12, 2024
1 parent 6913a05 commit d681e21
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions controllers/controllers/services/instances/upsi/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ var _ = Describe("CFServiceInstance", func() {
g.Expect(instance.Status.CredentialsObservedVersion).NotTo(Equal(secretVersion))
}).Should(Succeed())
})

It("sets the instance last operation update type", func() {
Eventually(func(g Gomega) {
g.Expect(adminClient.Get(ctx, client.ObjectKeyFromObject(instance), instance)).To(Succeed())
g.Expect(instance.Status.LastOperation).To(Equal(services.LastOperation{
Type: "update",
State: "succeeded",
}))
}).Should(Succeed())
})
})

When("the credentials secret gets deleted", func() {
Expand Down Expand Up @@ -196,24 +206,6 @@ var _ = Describe("CFServiceInstance", func() {
})
})

When("credentials observed version is not equal to the secret version", func() {
BeforeEach(func() {
Expect(k8s.Patch(ctx, adminClient, instance, func() {
instance.Status.CredentialsObservedVersion = "invalid-version"
})).To(Succeed())
})

It("sets the instance last operation update type", func() {
Eventually(func(g Gomega) {
g.Expect(adminClient.Get(ctx, client.ObjectKeyFromObject(instance), instance)).To(Succeed())
g.Expect(instance.Status.LastOperation).To(Equal(services.LastOperation{
Type: "update",
State: "succeeded",
}))
}).Should(Succeed())
})
})

When("the instance is deleted", func() {
JustBeforeEach(func() {
Expect(adminClient.Delete(ctx, instance)).To(Succeed())
Expand Down

0 comments on commit d681e21

Please sign in to comment.