Skip to content

Commit

Permalink
Delete domain test waits for the deletion job
Browse files Browse the repository at this point in the history
It is incorrect to perform checks on domain routes while the domain is
being deleted.

Co-authored-by: Danail Branekov <[email protected]>
  • Loading branch information
georgethebeatle and danail-branekov committed Dec 11, 2023
1 parent 1265677 commit dd7f806
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tests/e2e/domains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ var _ = Describe("Domain", func() {
resp, err = adminClient.R().
Delete("/v3/domains/" + domainGUID)
Expect(err).NotTo(HaveOccurred())
})

It("succeeds with a job redirect", func() {
Expect(resp).To(SatisfyAll(
HaveRestyStatusCode(http.StatusAccepted),
HaveRestyHeaderWithValue("Location", HaveSuffix("/v3/jobs/domain.delete~"+domainGUID)),
Expand All @@ -173,7 +171,9 @@ var _ = Describe("Domain", func() {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(string(resp.Body())).To(ContainSubstring("COMPLETE"))
}).Should(Succeed())
})

It("deletes the domain", func() {
getDomainResp, err := adminClient.R().Get("/v3/domains/" + domainGUID)
Expect(err).NotTo(HaveOccurred())
Expect(getDomainResp).To(HaveRestyStatusCode(http.StatusNotFound))
Expand Down Expand Up @@ -204,15 +204,13 @@ var _ = Describe("Domain", func() {
})

It("deletes the domain routes", func() {
Eventually(func(g Gomega) {
var routes resourceList[responseResource]
listRoutesResp, err := adminClient.R().
SetResult(&routes).
Get("/v3/routes?space_guids=" + spaceGUID)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(listRoutesResp).To(HaveRestyStatusCode(http.StatusOK))
g.Expect(routes.Resources).To(BeEmpty())
}).Should(Succeed())
var routes resourceList[responseResource]
listRoutesResp, err := adminClient.R().
SetResult(&routes).
Get("/v3/routes?space_guids=" + spaceGUID)
Expect(err).NotTo(HaveOccurred())
Expect(listRoutesResp).To(HaveRestyStatusCode(http.StatusOK))
Expect(routes.Resources).To(BeEmpty())
})
})
})
Expand Down

0 comments on commit dd7f806

Please sign in to comment.