Skip to content

Commit

Permalink
Bugfixes in Test REST
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Jan 28, 2016
1 parent 9f2e72c commit c64f2af
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/TestREST.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,12 @@ def test_57_reconfigure_list(self):
self.assertTrue(all_configured, msg="ERROR waiting the infrastructure to be configured (timeout).")

def test_60_stop(self):
time.sleep(10)
self.server.request('PUT', "/infrastructures/" + self.inf_id + "/stop", headers = {"Content-type": "application/x-www-form-urlencoded", 'AUTHORIZATION' : self.auth_data})
resp = self.server.getresponse()
output = str(resp.read())
self.assertEqual(resp.status, 200, msg="ERROR stopping the infrastructure:" + output)
time.sleep(10)

all_stopped = self.wait_inf_state(VirtualMachine.STOPPED, 120, [VirtualMachine.RUNNING])
self.assertTrue(all_stopped, msg="ERROR waiting the infrastructure to be stopped (timeout).")
Expand All @@ -308,15 +310,18 @@ def test_70_start(self):
resp = self.server.getresponse()
output = str(resp.read())
self.assertEqual(resp.status, 200, msg="ERROR starting the infrastructure:" + output)
time.sleep(10)

all_configured = self.wait_inf_state(VirtualMachine.CONFIGURED, 120, [VirtualMachine.RUNNING])
self.assertTrue(all_configured, msg="ERROR waiting the infrastructure to be started (timeout).")

def test_80_stop_vm(self):
time.sleep(10)
self.server.request('PUT', "/infrastructures/" + self.inf_id + "/vms/0/stop", headers = {"Content-type": "application/x-www-form-urlencoded", 'AUTHORIZATION' : self.auth_data})
resp = self.server.getresponse()
output = str(resp.read())
self.assertEqual(resp.status, 200, msg="ERROR stopping the vm:" + output)
time.sleep(10)

all_stopped = self.wait_inf_state(VirtualMachine.STOPPED, 120, [VirtualMachine.RUNNING], ["/infrastructures/" + self.inf_id + "/vms/0"])
self.assertTrue(all_stopped, msg="ERROR waiting the infrastructure to be stopped (timeout).")
Expand All @@ -328,6 +333,7 @@ def test_90_start_vm(self):
resp = self.server.getresponse()
output = str(resp.read())
self.assertEqual(resp.status, 200, msg="ERROR starting the vm:" + output)
time.sleep(10)

all_configured = self.wait_inf_state(VirtualMachine.CONFIGURED, 120, [VirtualMachine.RUNNING], ["/infrastructures/" + self.inf_id + "/vms/0"])
self.assertTrue(all_configured, msg="ERROR waiting the vm to be started (timeout).")
Expand Down

0 comments on commit c64f2af

Please sign in to comment.