Use correct policy when faking misplaced objects in probe test

Before, merge_objects() always used storage policy index of 0 when
inserting a fake misplaced object into a shard container. If the shard
broker had a different policy index then the misplaced object would
not show in listings causing test_misplaced_object_movement() to
fail. This test bug might be exposed by having policy index 0 be an EC
policy, since the probe test requires a replication policy and would
therefore choose a non-zero policy index.

The fix is simply to specify the shard's policy index when inserting
the fake object.

Change-Id: Iec3f8ec29950220bb1b2ead9abfdfb1a261517d6
This commit is contained in:
Alistair Coles 2018-05-18 22:42:18 +01:00
parent ea92e49980
commit c35285f14b

View File

@ -1758,7 +1758,8 @@ class TestContainerSharding(BaseTestContainerSharding):
shard_broker.merge_items(
[{'name': name, 'created_at': Timestamp.now().internal,
'size': 0, 'content_type': 'text/plain',
'etag': hashlib.md5().hexdigest(), 'deleted': deleted}])
'etag': hashlib.md5().hexdigest(), 'deleted': deleted,
'storage_policy_index': shard_broker.storage_policy_index}])
return shard_nodes[0]
all_obj_names = self._make_object_names(self.max_shard_size)