Return appropriate data on share create
With the introduction of share instances in the Liberty
release, some attributes of the share model were moved
to the share_instance model. The create API has since
been returning merely the share data which makes
for a bad user experience with some attributes
being set to null.
Fix this issue by retrieving the share from the database
after the instance has been created; so that the status
field reflects the pre-scheduler acceptable status of
'creating'.
Change-Id: I63955e1a60e7ced3ad126829521cd43e0b914c17
Closes-Bug: #1534161
diff --git a/manila_tempest_tests/tests/api/test_shares.py b/manila_tempest_tests/tests/api/test_shares.py
index 1cf081e..84b3f97 100644
--- a/manila_tempest_tests/tests/api/test_shares.py
+++ b/manila_tempest_tests/tests/api/test_shares.py
@@ -55,6 +55,10 @@
self.assertTrue(detailed_elements.issubset(share.keys()), msg)
self.assertFalse(share['is_public'])
+ # The 'status' of the share returned by the create API must be
+ # the default value - 'creating'.
+ self.assertEqual('creating', share['status'])
+
# Get share using v 2.1 - we expect key 'snapshot_support' to be absent
share_get = self.shares_v2_client.get_share(share['id'], version='2.1')
self.assertTrue(detailed_elements.issubset(share_get.keys()), msg)
@@ -107,6 +111,10 @@
s2 = self.create_share(
self.protocol, snapshot_id=snap["id"], cleanup_in_class=False)
+ # The 'status' of the share returned by the create API must be
+ # the default value - 'creating'.
+ self.assertEqual('creating', s2['status'])
+
# verify share, created from snapshot
get = self.shares_client.get_share(s2["id"])
msg = "Expected snapshot_id %s as "\
@@ -133,6 +141,10 @@
child = self.create_share(
self.protocol, snapshot_id=snap["id"], cleanup_in_class=False)
+ # The 'status' of the share returned by the create API must be
+ # the default value - 'creating'.
+ self.assertEqual('creating', child['status'])
+
# verify share, created from snapshot
get = self.shares_client.get_share(child["id"])
keys = {