Skip to content

Instantly share code, notes, and snippets.

@clayg
Created October 29, 2016 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/5b8505e4130f137c2189994ddec691ff to your computer and use it in GitHub Desktop.
Save clayg/5b8505e4130f137c2189994ddec691ff to your computer and use it in GitHub Desktop.
diff --git a/test/unit/__init__.py b/test/unit/__init__.py
index 9068d84..5a63641 100644
--- a/test/unit/__init__.py
+++ b/test/unit/__init__.py
@@ -194,6 +194,7 @@ class PatchPolicies(object):
def __enter__(self):
self._orig_POLICIES = storage_policy._POLICIES
storage_policy._POLICIES = self.policies
+ self._setup_rings()
def __exit__(self, *args):
storage_policy._POLICIES = self._orig_POLICIES
diff --git a/test/unit/obj/test_reconstructor.py b/test/unit/obj/test_reconstructor.py
index 938b530..4c874e3 100755
--- a/test/unit/obj/test_reconstructor.py
+++ b/test/unit/obj/test_reconstructor.py
@@ -1266,6 +1266,21 @@ class TestObjectReconstructor(unittest.TestCase):
def ts(self):
return next(self.ts_iter)
+ def test_two_ec_policies(self):
+ with patch_policies([
+ StoragePolicy(0, name='zero', is_deprecated=True),
+ ECStoragePolicy(1, name='one', is_default=True,
+ ec_type=DEFAULT_TEST_EC_TYPE,
+ ec_ndata=4, ec_nparity=3),
+ ECStoragePolicy(2, name='two',
+ ec_type=DEFAULT_TEST_EC_TYPE,
+ ec_ndata=8, ec_nparity=2)],
+ fake_ring_args=[
+ {}, {'replicas': 7}, {'replicas': 10}]):
+ self._configure_reconstructor()
+ os.makedirs(os.path.join(self.devices, 'sda', 'objects-1', '0'))
+ self.reconstructor.run_once()
+
def test_collect_parts_skips_non_ec_policy_and_device(self):
stub_parts = (371, 78, 419, 834)
for policy in POLICIES:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment