Skip to content

Instantly share code, notes, and snippets.

@peluse
Created April 14, 2015 03:53
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 peluse/54b2b266b2856075e2f6 to your computer and use it in GitHub Desktop.
Save peluse/54b2b266b2856075e2f6 to your computer and use it in GitHub Desktop.
diff --git a/test/probe/test_reconstructor_revert.py b/test/probe/test_reconstructor_revert.py
index 64fa3be..2d6fe43 100755
--- a/test/probe/test_reconstructor_revert.py
+++ b/test/probe/test_reconstructor_revert.py
@@ -61,10 +61,20 @@ class TestReconstructorRevert(ECProbeTest):
self.container_name = 'container-%s' % uuid.uuid4()
self.object_name = 'object-%s' % uuid.uuid4()
+ self.kill_method = 'renamer'
+
# sanity
self.assertEqual(self.policy.policy_type, EC_POLICY)
self.reconstructor = Manager(["object-reconstructor"])
+ def kill_drive(self, device):
+ if self.kill_method == 'renamer':
+ renamer(device, device + "X")
+
+ def revive_drive(self, device):
+ if self.kill_method == 'renamer':
+ renamer(device + "X", device)
+
def proxy_get(self):
# GET object
headers, body = client.get_object(self.url, self.token,
@@ -103,8 +113,8 @@ class TestReconstructorRevert(ECProbeTest):
# to induce 507
p_dev1 = self.device_dir('object', onodes[0])[:-1]
p_dev2 = self.device_dir('object', onodes[1])[:-1]
- renamer(p_dev1, p_dev1 + "X")
- renamer(p_dev2, p_dev2 + "X")
+ self.kill_drive(p_dev1)
+ self.kill_drive(p_dev2)
# PUT object
contents = Body()
@@ -130,7 +140,7 @@ class TestReconstructorRevert(ECProbeTest):
# now take out another primary
p_dev3 = self.device_dir('object', onodes[2])[:-1]
- renamer(p_dev3, p_dev3 + "X")
+ self.kill_drive(p_dev3)
# this node can't servce the data any more
try:
@@ -147,9 +157,9 @@ class TestReconstructorRevert(ECProbeTest):
self.assertEqual(etag, contents.etag)
# rename the dev dirs so they don't 507 anymore
- renamer(p_dev1 + "X", p_dev1)
- renamer(p_dev2 + "X", p_dev2)
- renamer(p_dev3 + "X", p_dev3)
+ self.revive_drive(p_dev1)
+ self.revive_drive(p_dev2)
+ self.revive_drive(p_dev3)
# fire up reconstructor on handoff nodes only
for hnode in hnodes:
@@ -196,7 +206,7 @@ class TestReconstructorRevert(ECProbeTest):
self.object_name, contents=contents)
# now lets shut one down
- renamer(p_dev2, p_dev2 + "X")
+ self.kill_drive(p_dev2)
# delete on the ones that are left
client.delete_object(self.url, self.token,
@@ -213,7 +223,7 @@ class TestReconstructorRevert(ECProbeTest):
(onodes[0],))
# enable the first node again
- renamer(p_dev2 + "X", p_dev2)
+ self.revive_drive(p_dev2)
# propogate the delete...
# fire up reconstructor on handoff nodes only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment