Add func test for compute 2.94

The only thing that changes in 2.94 is server-side validation of the
``hostname`` parameter, so no client-side changes are needed other
than to bump novaclient's max supported microversion (see dependent
patch), but it's still nice to have a test to assert that osc pipes
through the correct value to the Nova API.

Change-Id: Id1049965150c46fe972733d6194b78d996c6e5d3
Depends-on: https://review.opendev.org/c/openstack/python-novaclient/+/872418
This commit is contained in:
Artom Lifshitz
2023-02-01 10:18:20 -05:00
parent 1e0880eda8
commit 74fee34334

View File

@@ -1050,6 +1050,24 @@ class ServerTests(common.ComputeTestCase):
# check the volume is in 'available' status # check the volume is in 'available' status
self.assertEqual('available', cmd_output['status']) self.assertEqual('available', cmd_output['status'])
def test_server_create_with_fqdn_hostname(self):
server_name = uuid.uuid4().hex
server = self.openstack(
'--os-compute-api-version 2.94 ' +
'server create ' +
'--flavor ' + self.flavor_name + ' ' +
'--image ' + self.image_name + ' ' +
'--nic none ' +
'--hostname test.example.com' +
server_name,
parse_output=True,
)
self.assertIsNotNone(server["id"])
self.addCleanup(self.openstack, 'server delete --wait ' + server_name)
self.wait_for_status(server_name, "ACTIVE")
self.assertEqual('test.example.com',
server['OS-EXT-SRV-ATTR:hostname'])
def test_server_create_with_none_network(self): def test_server_create_with_none_network(self):
"""Test server create with none network option.""" """Test server create with none network option."""
server_name = uuid.uuid4().hex server_name = uuid.uuid4().hex