Skip to content

Commit

Permalink
whats next?
Browse files Browse the repository at this point in the history
  • Loading branch information
AvielSegev committed Jan 8, 2025
1 parent b341b86 commit 713351e
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ var _ = Describe("e2e", func() {

BeforeEach(func() {
svc, err = NewPlannerService(defaultConfigPath)
Expect(err).To(BeNil())
Expect(err).To(BeNil(), "Failed to create PlannerService")
agent, err = NewPlannerAgent(defaultConfigPath, vmName)
Expect(err).To(BeNil())
Expect(err).To(BeNil(), "Failed to create PlannerAgent")
err = agent.Run()
Expect(err).To(BeNil())
Expect(err).To(BeNil(), "Failed to run PlannerAgent")
Eventually(func() string {
agentIP, err = agent.GetIp()
if err != nil {
return ""
}
return agentIP
}, "1m", "3s").ShouldNot(BeEmpty())
Expect(agentIP).ToNot(BeEmpty())
}, "1m", "3s").ShouldNot(BeEmpty(), "Failed - bad agent IP")
Expect(agentIP).ToNot(BeEmpty(), "Failed - empty agent IP")
Eventually(func() bool {
return agent.IsServiceRunning(agentIP, "planner-agent")
}, "3m", "2s").Should(BeTrue())
}, "3m", "2s").Should(BeTrue(), "Failed Planner agent service is not running")

Eventually(func() string {
s, err := svc.GetAgent()
Expand All @@ -64,19 +64,19 @@ var _ = Describe("e2e", func() {

Context("Check Vcenter login mechanism", func() {

It("should successfully login with valid credentials", func() {

// Check that planner-agent service is running
r := agent.IsServiceRunning(agentIP, "planner-agent")
Expect(r).To(BeTrue())

// By default, any non-empty username & password should pass 'TestVmwareConnection' func
res, err := agent.Login(fmt.Sprintf("https://%s:8989/sdk", systemIP), "user", "pass")
Expect(err).To(BeNil())
// after passing 'TestVmwareConnection' func should be successful response (204) from 'credentialHandler' func
Expect(res.StatusCode).To(Equal(http.StatusNoContent))

})
//It("should successfully login with valid credentials", func() {
//
// // Check that planner-agent service is running
// r := agent.IsServiceRunning(agentIP, "planner-agent")
// Expect(r).To(BeTrue())
//
// // By default, any non-empty username & password should pass 'TestVmwareConnection' func
// res, err := agent.Login(fmt.Sprintf("https://%s:8989/sdk", systemIP), "user", "pass")
// Expect(err).To(BeNil())
// // after passing 'TestVmwareConnection' func should be successful response (204) from 'credentialHandler' func
// Expect(res.StatusCode).To(Equal(http.StatusNoContent))
//
//})

It("should return unauthorized for empty credentials", func() {

Expand All @@ -85,7 +85,10 @@ var _ = Describe("e2e", func() {
Expect(r).To(BeTrue())

// Expect(res.StatusCode).To(Equal(http.StatusUnauthorized)) which should be raised from 'TestVmwareConnection' func
res, _ := agent.Login(fmt.Sprintf("https://%s:8989/sdk", systemIP), "", "")
res, err := agent.Login(fmt.Sprintf("https://%s:8989/sdk", systemIP), "", "")
if err != nil {
fmt.Println("this is the error: ", err.Error())
}
//Expect(err).NotTo(BeNil())
Expect(res.StatusCode).To(Equal(http.StatusUnauthorized))

Expand All @@ -109,11 +112,9 @@ var _ = Describe("e2e", func() {
Context("Flow", func() {

It("Up to date", func() {

// Check that planner-agent service is running
r := agent.IsServiceRunning(agentIP, "planner-agent")
Expect(r).To(BeTrue())

// Put the vCenter credentials and check that source is up to date eventually
res, err := agent.Login(fmt.Sprintf("https://%s:8989/sdk", systemIP), "user", "pass")
Expect(err).To(BeNil())
Expand All @@ -127,5 +128,4 @@ var _ = Describe("e2e", func() {
}, "1m", "2s").Should(BeTrue())
})
})

})

0 comments on commit 713351e

Please sign in to comment.