Esempio n. 1
0
 def test_reboot_booting_server(self, mock_sleep):
     """
     Reboot a server that has status 'booting'
     """
     server = BootingOpenStackServerFactory()
     server.reboot()
     self.assertEqual(server.status, ServerStatus.Booting)
     server.os_server.reboot.assert_not_called()
     mock_sleep.assert_not_called()
Esempio n. 2
0
 def test_update_status_booting_to_ready(self, mock_is_port_open):
     """
     Update status while the server is booting, when the VM becomes ready
     """
     server = BootingOpenStackServerFactory(os_server_fixture='openstack/api_server_2_active.json')
     self.assertEqual(server.status, ServerStatus.Booting)
     mock_is_port_open.return_value = False
     self.assertIsInstance(server.update_status(), ServerStatus.Booting)
     self.assertEqual(server.status, ServerStatus.Booting)
     mock_is_port_open.return_value = True
     self.assertIsInstance(server.update_status(), ServerStatus.Ready)
     self.assertEqual(server.status, ServerStatus.Ready)