Check only for added/deleted metadata entries
Utilize the same methodology as test_volume_metadata and only check
for presence or absence of metadata entries explicitily touched on
the snapshot.
Update_snapshot_metadata requires testing for exact match (it
replaces, not appends).
Change-Id: I2be45ff13997269b39de85d16ccaea3504e972cc
Closes-Bug: 1379460
diff --git a/tempest/api/volume/test_snapshot_metadata.py b/tempest/api/volume/test_snapshot_metadata.py
index b8e87f0..641317a 100644
--- a/tempest/api/volume/test_snapshot_metadata.py
+++ b/tempest/api/volume/test_snapshot_metadata.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from testtools import matchers
+
from tempest.api.volume import base
from tempest import test
@@ -50,12 +52,14 @@
metadata)
# Get the metadata of the snapshot
body = self.client.show_snapshot_metadata(self.snapshot_id)
- self.assertEqual(metadata, body)
+ self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
+
# Delete one item metadata of the snapshot
self.client.delete_snapshot_metadata_item(
self.snapshot_id, "key1")
body = self.client.show_snapshot_metadata(self.snapshot_id)
- self.assertEqual(expected, body)
+ self.assertThat(body.items(), matchers.ContainsAll(expected.items()))
+ self.assertNotIn("key1", body)
@test.idempotent_id('bd2363bc-de92-48a4-bc98-28943c6e4be1')
def test_update_snapshot_metadata(self):
@@ -70,7 +74,8 @@
metadata)
# Get the metadata of the snapshot
body = self.client.show_snapshot_metadata(self.snapshot_id)
- self.assertEqual(metadata, body)
+ self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
+
# Update metadata item
body = self.client.update_snapshot_metadata(
self.snapshot_id, update)
@@ -93,13 +98,13 @@
metadata)
# Get the metadata of the snapshot
body = self.client.show_snapshot_metadata(self.snapshot_id)
- self.assertEqual(metadata, body)
+ self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata item
body = self.client.update_snapshot_metadata_item(
self.snapshot_id, "key3", update_item)
# Get the metadata of the snapshot
body = self.client.show_snapshot_metadata(self.snapshot_id)
- self.assertEqual(expect, body)
+ self.assertThat(body.items(), matchers.ContainsAll(expect.items()))
class SnapshotV1MetadataTestJSON(SnapshotV2MetadataTestJSON):