Fix compute tests for resource.prop ID attributes
Fix unit, functional and examples tests for [1]. Also fix the documentation for the server image_id and flavor_id properties. [1] https://review.openstack.org/#/c/279618/ Change-Id: Ia37ecc7c9dccb90fabf7bf73601a6ad519212556 Partial-Bug: #1461200
This commit is contained in:
@@ -61,7 +61,7 @@ def create_server(conn):
|
|||||||
keypair = create_keypair(conn)
|
keypair = create_keypair(conn)
|
||||||
|
|
||||||
server = conn.compute.create_server(
|
server = conn.compute.create_server(
|
||||||
name=SERVER_NAME, image=image, flavor=flavor,
|
name=SERVER_NAME, image_id=image.id, flavor_id=flavor.id,
|
||||||
networks=[{"uuid": network.id}], key_name=keypair.name)
|
networks=[{"uuid": network.id}], key_name=keypair.name)
|
||||||
|
|
||||||
server = conn.compute.wait_for_server(server)
|
server = conn.compute.wait_for_server(server)
|
||||||
|
@@ -41,18 +41,14 @@ class Server(resource.Resource, metadata.MetadataMixin):
|
|||||||
addresses = resource.prop('addresses', type=dict)
|
addresses = resource.prop('addresses', type=dict)
|
||||||
#: Timestamp of when the server was created.
|
#: Timestamp of when the server was created.
|
||||||
created_at = resource.prop('created')
|
created_at = resource.prop('created')
|
||||||
#: A dictionary with details on the flavor this server is running.
|
#: The flavor reference, as a ID or full URL, for the flavor to use for
|
||||||
#: The dictionary includes a key for the ``id`` of the flavor, as well
|
#: this server.
|
||||||
#: as a ``links`` key, which includes a list of relevant links for this
|
flavor_id = resource.prop('flavorRef')
|
||||||
#: flavor. *Type: dict*
|
|
||||||
flavor_id = resource.prop('flavorRef', alias='flavor', type=dict)
|
|
||||||
#: An ID representing the host of this server.
|
#: An ID representing the host of this server.
|
||||||
host_id = resource.prop('hostId')
|
host_id = resource.prop('hostId')
|
||||||
#: A dictionary with details on the image this server is running.
|
#: The image reference, as a ID or full URL, for the image to use for
|
||||||
#: The dictionary includes a key for ``id`` of the image, as well
|
#: this server.
|
||||||
#: as a ``links`` key, which includes a list of relevant links for this
|
image_id = resource.prop('imageRef')
|
||||||
#: image. *Type: dict*
|
|
||||||
image_id = resource.prop('imageRef', alias='image', type=dict)
|
|
||||||
#: A list of dictionaries holding links relevant to this server.
|
#: A list of dictionaries holding links relevant to this server.
|
||||||
links = resource.prop('links')
|
links = resource.prop('links')
|
||||||
#: Metadata stored for this server. *Type: dict*
|
#: Metadata stored for this server. *Type: dict*
|
||||||
|
@@ -40,7 +40,7 @@ class TestServer(base.BaseFunctionalTest):
|
|||||||
else:
|
else:
|
||||||
args = {}
|
args = {}
|
||||||
sot = cls.conn.compute.create_server(
|
sot = cls.conn.compute.create_server(
|
||||||
name=cls.NAME, flavor=flavor.id, image=image.id, **args)
|
name=cls.NAME, flavor_id=flavor.id, image_id=image.id, **args)
|
||||||
cls.conn.compute.wait_for_server(sot)
|
cls.conn.compute.wait_for_server(sot)
|
||||||
assert isinstance(sot, server.Server)
|
assert isinstance(sot, server.Server)
|
||||||
cls.assertIs(cls.NAME, sot.name)
|
cls.assertIs(cls.NAME, sot.name)
|
||||||
|
@@ -23,10 +23,10 @@ EXAMPLE = {
|
|||||||
'accessIPv6': '2',
|
'accessIPv6': '2',
|
||||||
'addresses': {'region': '3'},
|
'addresses': {'region': '3'},
|
||||||
'created': '4',
|
'created': '4',
|
||||||
'flavorRef': {'id': 5},
|
'flavorRef': '5',
|
||||||
'hostId': '6',
|
'hostId': '6',
|
||||||
'id': IDENTIFIER,
|
'id': IDENTIFIER,
|
||||||
'imageRef': {'id': 8},
|
'imageRef': '8',
|
||||||
'links': '9',
|
'links': '9',
|
||||||
'metadata': {'key': '10'},
|
'metadata': {'key': '10'},
|
||||||
'name': '11',
|
'name': '11',
|
||||||
|
Reference in New Issue
Block a user