Relax assertion in test_get_all_shards
when listing all shards, currently test expects to find only shards
that it has just created, but there could be other, pre-existing shards,
like default "None" one or shards created by other tests
running in parallel.
Instead, check that the created shards is a subset of all shards.
Change-Id: Ic35f9be232837922ae8ed857c7ea0bb58e064987
Signed-off-by: Pavlo Shchelokovskyy <shchelokovskyy@gmail.com>
diff --git a/ironic_tempest_plugin/tests/api/admin/test_shards.py b/ironic_tempest_plugin/tests/api/admin/test_shards.py
index 5a5e4ba..c2c83bb 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_shards.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_shards.py
@@ -137,7 +137,7 @@
def setUp(self):
super(TestGetAllShards, self).setUp()
_, self.chassis = self.create_chassis()
- self.shards = ["shard1", "shard2", "shard3"]
+ self.shards = {"shard1", "shard2", "shard3"}
self.node_ids = []
for shard in self.shards:
_, node = self.create_node(self.chassis['uuid'], shard=shard)
@@ -146,6 +146,6 @@
@decorators.idempotent_id('fc786196-63c7-4e0d-bd14-3e478d4d1e3e')
def test_get_all_shards(self):
_, fetched_shards = self.client.get_shards()
- fetched_shards = [shard['name'] for shard in fetched_shards['shards']]
+ fetched_shards = {shard['name'] for shard in fetched_shards['shards']}
- self.assertCountEqual(self.shards, fetched_shards)
+ self.assertTrue(self.shards.issubset(fetched_shards))