Skip to content

Commit

Permalink
Remove pending test
Browse files Browse the repository at this point in the history
  • Loading branch information
bonzofenix committed Nov 27, 2024
1 parent 687b8e1 commit 7933021
Showing 1 changed file with 30 additions and 36 deletions.
66 changes: 30 additions & 36 deletions src/autoscaler/api/cmd/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,50 +297,44 @@ var _ = Describe("Api", func() {
})

When("running CF server", func() {
XWhen("running in outside cf", func() {})
When("running in CF", func() {

BeforeEach(func() {
os.Setenv("VCAP_APPLICATION", "{}")
os.Setenv("VCAP_SERVICES", getVcapServices())
os.Setenv("PORT", fmt.Sprintf("%d", vcapPort))
runner.Start()
})
AfterEach(func() {
runner.Interrupt()
Eventually(runner.Session, 5).Should(Exit(0))
os.Unsetenv("VCAP_APPLICATION")
os.Unsetenv("VCAP_SERVICES")
os.Unsetenv("PORT")
})

It("should start a cf server", func() {
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/v1/info", cfServerURL), nil)
Expect(err).NotTo(HaveOccurred())
BeforeEach(func() {
os.Setenv("VCAP_APPLICATION", "{}")
os.Setenv("VCAP_SERVICES", getVcapServices())
os.Setenv("PORT", fmt.Sprintf("%d", vcapPort))
runner.Start()
})
AfterEach(func() {
runner.Interrupt()
Eventually(runner.Session, 5).Should(Exit(0))
os.Unsetenv("VCAP_APPLICATION")
os.Unsetenv("VCAP_SERVICES")
os.Unsetenv("PORT")
})

rsp, err = cfServerHttpClient.Do(req)
Expect(err).ToNot(HaveOccurred())
It("should start a cf server", func() {
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/v1/info", cfServerURL), nil)
Expect(err).NotTo(HaveOccurred())

bodyBytes, err := io.ReadAll(rsp.Body)
Expect(err).ToNot(HaveOccurred())
Expect(bodyBytes).To(ContainSubstring("Automatically increase or decrease the number of application instances based on a policy you define."))
rsp, err = cfServerHttpClient.Do(req)
Expect(err).ToNot(HaveOccurred())

req, err = http.NewRequest(http.MethodGet, fmt.Sprintf("%s/v2/catalog", cfServerURL), nil)
Expect(err).NotTo(HaveOccurred())
req.SetBasicAuth(username, password)
bodyBytes, err := io.ReadAll(rsp.Body)
Expect(err).ToNot(HaveOccurred())
Expect(bodyBytes).To(ContainSubstring("Automatically increase or decrease the number of application instances based on a policy you define."))

rsp, err = cfServerHttpClient.Do(req)
Expect(err).ToNot(HaveOccurred())
Expect(rsp.StatusCode).To(Equal(http.StatusOK))
req, err = http.NewRequest(http.MethodGet, fmt.Sprintf("%s/v2/catalog", cfServerURL), nil)
Expect(err).NotTo(HaveOccurred())
req.SetBasicAuth(username, password)

bodyBytes, err = io.ReadAll(rsp.Body)
Expect(err).ToNot(HaveOccurred())
Expect(bodyBytes).To(ContainSubstring("autoscaler-free-plan-id"))
})
rsp, err = cfServerHttpClient.Do(req)
Expect(err).ToNot(HaveOccurred())
Expect(rsp.StatusCode).To(Equal(http.StatusOK))

bodyBytes, err = io.ReadAll(rsp.Body)
Expect(err).ToNot(HaveOccurred())
Expect(bodyBytes).To(ContainSubstring("autoscaler-free-plan-id"))
})
})

})

func getVcapServices() (result string) {
Expand Down

0 comments on commit 7933021

Please sign in to comment.