@@ -27,11 +27,11 @@ class ServerTests(common.ComputeTestCase):
2727
2828 @classmethod
2929 def setUpClass (cls ):
30- super (ServerTests , cls ).setUpClass ()
30+ super ().setUpClass ()
3131 cls .haz_network = cls .is_service_enabled ('network' )
3232
3333 def test_server_list (self ):
34- """Test server list, set """
34+ """Test server list"""
3535 cmd_output = self .server_create ()
3636 name1 = cmd_output ['name' ]
3737 cmd_output = self .server_create ()
@@ -1447,6 +1447,46 @@ def test_server_add_remove_volume(self):
14471447 raw_output = self .openstack ('server volume list ' + server_name )
14481448 self .assertEqual ('\n ' , raw_output )
14491449
1450+ def test_server_stop_start (self ):
1451+ """Test server stop, start"""
1452+ server_name = uuid .uuid4 ().hex
1453+ cmd_output = self .openstack (
1454+ 'server create '
1455+ + '--network private '
1456+ + '--flavor '
1457+ + self .flavor_name
1458+ + ' '
1459+ + '--image '
1460+ + self .image_name
1461+ + ' '
1462+ + '--wait '
1463+ + server_name ,
1464+ parse_output = True ,
1465+ )
1466+
1467+ self .assertIsNotNone (cmd_output ['id' ])
1468+ self .assertEqual (server_name , cmd_output ['name' ])
1469+ self .addCleanup (self .openstack , 'server delete --wait ' + server_name )
1470+ server_id = cmd_output ['id' ]
1471+
1472+ cmd_output = self .openstack (
1473+ 'server stop ' + server_name ,
1474+ )
1475+ self .assertEqual ("" , cmd_output )
1476+
1477+ # This is our test that the request succeeded. If it doesn't transition
1478+ # to SHUTOFF then it didn't work.
1479+ self .wait_for_status (server_id , "SHUTOFF" )
1480+
1481+ cmd_output = self .openstack (
1482+ 'server start ' + server_name ,
1483+ )
1484+ self .assertEqual ("" , cmd_output )
1485+
1486+ # As above, this is our test that the request succeeded. If it doesn't
1487+ # transition to ACTIVE then it didn't work.
1488+ self .wait_for_status (server_id , "ACTIVE" )
1489+
14501490 def test_server_migration_list (self ):
14511491 # Verify that the command does not raise an exception when we list
14521492 # migrations, including when we specify a query.
0 commit comments