summaryrefslogtreecommitdiffstats
path: root/TestUnits
diff options
context:
space:
mode:
Diffstat (limited to 'TestUnits')
-rw-r--r--TestUnits/xlators/cluster/afr/self_heal/testcases.py2408
-rw-r--r--TestUnits/xlators/cluster/afr/self_heal/testcaseslist30
-rw-r--r--TestUnits/xlators/cluster/afr/self_heal/testenv.cfg71
-rw-r--r--TestUnits/xlators/cluster/afr/self_heal/testunit.py62
4 files changed, 2421 insertions, 150 deletions
diff --git a/TestUnits/xlators/cluster/afr/self_heal/testcases.py b/TestUnits/xlators/cluster/afr/self_heal/testcases.py
index e175ba7..6efff62 100644
--- a/TestUnits/xlators/cluster/afr/self_heal/testcases.py
+++ b/TestUnits/xlators/cluster/afr/self_heal/testcases.py
@@ -1,21 +1,41 @@
"""testcases for replicate/self-heal
"""
-
+import re
+import os
import sys
import time
-import hostutils
-import managerutils
-import glusterutils
+import afrutils
import atfutils
import clientutils
+import glusterutils
+import hostutils
import serverutils
-import parser
-import pdb
+import validate
+from atfglobals import GlobalObj
+from atfutils import commands
+
+urandom = "/dev/urandom"
+write_op = ">"
+append_op = ">>"
+mounts = ['mount1']
+bricks = ['brick1', 'brick2']
+brick_reboot_time = 15
def reset_testenv():
- return_status = 1
- if clientutils.umountall():
- return return_status
+ """
+ Description:
+ * Unmount all mounts specified in the testenv file.
+ * Stop the Volume (Active Volume)
+ * Delete the Volume
+ * Stop Glusterd on all servers
+ * Remove the glusterd dir (/etc/glusterd)
+ * Remove all glusterd logs from all servers
+ """
+ output = clientutils.umountall()
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
glusterutils.volume_stop("server1", force=True)
glusterutils.volume_delete("server1")
glusterutils.glusterd_stop_allservers()
@@ -25,73 +45,2325 @@ def reset_testenv():
def setup_testenv():
"""
+ Description:
+ * Start glusterd on all servers
+ * Peer Probe all servers in the storage pool
+ * Create Bricks on the servers
+ * Create Volume
+ * Start Volume
+ * Mount to the Volume from all mounts specified in testenv
"""
- return_status = 1
- if glusterutils.glusterd_start_allservers(force=True):
+ output = glusterutils.glusterd_start_allservers(force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = glusterutils.create_brick_allservers()
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = glusterutils.peer_probe("server1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = glusterutils.volume_create("server1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = glusterutils.volume_set("server1", key="self-heal-daemon",
+ value="off")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = glusterutils.volume_set("server1",
+ key="diagnostics.client-log-level",
+ value="DEBUG")
+
+ output = glusterutils.volume_set("server1",
+ key="diagnostics.brick-log-level",
+ value="DEBUG")
+
+ output = glusterutils.volume_start("server1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = clientutils.mountall()
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ return 0
+
+def test001():
+ """
+ Description:
+ Testing if the source is selected based on
+ entry transaction for directory
+ """
+ return_status = reset_testenv()
+ if return_status is not 0:
return return_status
- if glusterutils.peer_probe("server1"):
+
+ return_status = setup_testenv()
+ if return_status is not 0:
return return_status
- if glusterutils.create_brick_allservers():
+
+ dirname = "test1/d1"
+ command = ' '.join([commands['mkdir'], dirname])
+ expected_output = ""
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = afrutils.set_read_subvolume("server1", "client-0")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = afrutils.disable_self_heal("server1", 'data', 'entry', 'metadata')
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ filename = "f1"
+ abs_path = os.path.join(dirname, filename)
+ command = ' '.join([commands['touch'], abs_path])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['ls'], abs_path])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = abs_path
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test002():
+ """
+ Description:
+ Test if the source is selected based on data transaction for reg file
+ """
+ filename = "file1"
+ input_file = urandom
+ output_file = filename
+
+ return_status = reset_testenv()
+ if return_status is not 0:
return return_status
- if glusterutils.volume_create("server1"):
- return 1
- glusterutils.volume_set("server1", key="diagnostics.client-log-level", value="DEBUG")
- if glusterutils.volume_start("server1"):
- return 1
- if clientutils.mountall():
- return 1
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ output = afrutils.set_read_subvolume("server1", "client-0")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = afrutils.disable_self_heal("server1", 'data', 'entry', 'metadata')
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=10"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "10485760"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['ls'], "-l", filename ])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "10485760"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
return 0
-def test001():
+def test003():
"""
- Description: Test for failure when the entry does not exist
+ Description:
+ Test if the source is selected based on metadata transaction
+ for linkfile
"""
- return_status = 1
- if reset_testenv():
- return return_status
- if setup_testenv():
+ filename1 = "testsymlink.txt"
+ filename2 = "symlink_to_testsymlink.txt"
+ input_file = urandom
+
+ return_status = reset_testenv()
+ if return_status is not 0:
return return_status
- return_status = clientutils.execute_on_mount("mount1", "ls abcd")
-
- if return_status:
- test_status = 0
- else:
- test_status = 1
-
- return test_status
-def test002():
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ output = afrutils.set_read_subvolume("server1", "client-0")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = afrutils.disable_self_heal("server1", 'data', 'entry', 'metadata')
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ """ Create a file
+ """
+ command = ' '.join([commands['touch'], filename1])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ """ Create a symlink to the file created above
+ """
+ command = ' '.join([commands['symlink'], filename1, filename2])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ """ Stop brick2
+ """
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ """ execute dd on the symlink
+ provide rwx permissions to all
+ """
+ output_file = filename2
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=10"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "10485760"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['chmod'], "777", filename2])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ """ Restart the brick2
+ """
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['ls'], "-l", filename1])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "10485760"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-l", filename1])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "-rwxrwxrwx"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test004():
+ """
+ Description:
+ Self-Heal: Enoent + Success
+ """
+ input_file = urandom
+ dir1 = "d1"
+ dir2 = "d2"
+ file1 = "f1"
+ file2 = "f2"
+ testdir1 = "testdir1"
+ testdir2 = "testdir2"
+ t1_d1 = os.path.join(testdir1, dir1)
+ t1_d2 = os.path.join(testdir1, dir2)
+ t2_d1 = os.path.join(testdir2, dir1)
+ t2_d2 = os.path.join(testdir2, dir2)
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['mkdir'], t1_d1, t1_d2])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ t1_f1 = os.path.join(testdir1, file1)
+ output_file = t1_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d1_f1= os.path.join(t1_d1, file1)
+ output_file = t1_d1_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d1_f2 = os.path.join(t1_d1, file2)
+ output_file = t1_d1_f2
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=2"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "2097152"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d2_f1 = os.path.join(t1_d2, file1)
+ output_file = t1_d2_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d2_f2 = os.path.join(t1_d2, file2)
+ output_file = t1_d2_f2
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=2"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "2097152"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ """ Stop brick2
+ """
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['unlink_dir_force'], t1_d2])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['truncate'], "-s 0", t1_d1_f1])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['chmod'], "777", t1_d1_f2])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['mkdir'], t2_d1, t2_d2])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ t2_f1 = os.path.join(testdir2, file1)
+ output_file = t2_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t2_d1_f1= os.path.join(t2_d1, file1)
+ output_file = t2_d1_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t2_d1_f2 = os.path.join(t2_d1, file2)
+ output_file = t2_d1_f2
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=2"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "2097152"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t2_d2_f1 = os.path.join(t2_d2, file1)
+ output_file = t2_d2_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t2_d2_f2 = os.path.join(t2_d2, file2)
+ output_file = t2_d2_f2
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=2"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "2097152"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['chmod'], "777", t2_d1_f2])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ """ Restart the brick2
+ """
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = "find . | xargs stat"
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ selfheal_completion_status = afrutils.wait_till_selfheal_completes(30)
+ if selfheal_completion_status is not 0:
+ return selfheal_completion_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test005():
+ """
+ Description:
+ Self-heal: Success + File type differs
+ """
+ data = "Hello World. TestCase : Self-heal - Success + File type differs "
+ filename = dirname = "test"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['echo'], data, write_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['stat'], filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "regular file"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ """ Stop Brick2 """
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['unlink_force'], filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['mkdir'], dirname])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ """ Force Start the Volume. This will restart the brick2 """
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = ' '.join([commands['stat'], dirname])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "directory"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test006():
+ """
+ Description:
+ Self-heal: Success + Permission differs
+ """
+ data = "Hello World. TestCase: Self-heal - Success + Permission differs"
+ filename = "test"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['echo'], data, write_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['chmod'], "666", filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['chmod'], "777", filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = ' '.join([commands['ls'], "-l", filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "-rwxrwxrwx"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test007():
+ """
+ Description:
+ Self-heal: Success + Ownership differs
+ """
+ user = "qa"
+ data = "Hello World. testcase: Self-heal - Success Ownership differs"
+ filename = "test"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['echo'], data, write_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ user_group = ':'.join([user, user])
+ command = ' '.join([commands['chown'], user_group, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = ' '.join([commands['ls'], "-l", filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ' '.join([user, user])
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test008():
+ """
+ Description:
+ Self-Heal: Success + Size Differs
+ """
+ data1 = "Hello World. TestCase: Self-Heal - Success + Size Differs"
+ data2 = "Appending data to file."
+ filename = "test"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['echo'], data1, write_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['echo'], data2, append_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = "find . | xargs stat"
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['truncate'], "-s 0", filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = ' '.join([commands['stat'], filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "regular empty file"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test009():
+ """
+ Description:
+ Self-Heal: Success + gfid differs
+ """
+ data = "Hello World. TestCase : Self-heal - Success + GFID differs"
+ filename = "test"
+ file_gfids = {}
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['echo'], data, write_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['unlink_force'], filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['echo'], data, write_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = ' '.join([commands['cat'], filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ validation_status = validate.validate_gfids(bricks, filename)
+ if validation_status is not 0:
+ return validation_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test010a():
+ """
+ Description:
+ Self-Heal: xattr data pending
+ """
+ data1 = "Hello World. TestCase: Self-Heal - Success + Size Differs"
+ data2 = data1 * 50
+ filename = "test"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['echo'], data1, write_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['echo'], data2, append_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = "find . | xargs stat"
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test010b():
+ """
+ Description:
+ Self-heal: xattr metadata pending
+ """
+ user1 = "qa"
+ user2 = "root"
+ data = "Hello World. testcase: Self-heal - Success Ownership differs"
+ filename = "test"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['echo'], data, write_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['chown'], user1, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['chown'], user2, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['chmod'], "777", filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = ' '.join([commands['ls'], "-l", filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ' '.join(["-rwxrwxrwx.", "1", user2])
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test010c():
+ """
+ Description:
+ Self-heal: xattr entry pending
+ """
+ input_file = urandom
+ dir1 = "d1"
+ dir2 = "d2"
+ file1 = "f1"
+ file2 = "f2"
+ testdir1 = "testdir1"
+ testdir2 = "testdir2"
+ t1_d1 = os.path.join(testdir1, dir1)
+ t1_d2 = os.path.join(testdir1, dir2)
+ t2_d1 = os.path.join(testdir2, dir1)
+ t2_d2 = os.path.join(testdir2, dir2)
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['mkdir'], t1_d1, t1_d2])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d1_f1= os.path.join(t1_d1, file1)
+ output_file = t1_d1_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d2_f1 = os.path.join(t1_d2, file1)
+ output_file = t1_d2_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d2_f2 = os.path.join(t1_d2, file2)
+ output_file = t1_d2_f2
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=2"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "2097152"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ """ Stop brick2
+ """
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['unlink_dir_force'], t1_d2])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['mkdir'], t2_d1, t2_d2])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ t2_f1 = os.path.join(testdir2, file1)
+ output_file = t2_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t2_d1_f1= os.path.join(t2_d1, file1)
+ output_file = t2_d1_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t2_d2_f2 = os.path.join(t2_d2, file2)
+ output_file = t2_d2_f2
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=2"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "2097152"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ """ Restart the brick2
+ """
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = "find . | xargs stat"
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ selfheal_completion_status = afrutils.wait_till_selfheal_completes(30)
+ if selfheal_completion_status is not 0:
+ return selfheal_completion_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test011():
+ """
+ Description:
+ Mark source with the lowest uid
+ """
+ user1 = "qa"
+ user2 = "root"
+ data = "Hello World. testcase: Self-heal - Source with the Lowest UID"
+ filename = "test"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['echo'], data, write_op, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ user_group = ':'.join([user1, user1])
+ command = ' '.join([commands['chown'], user_group, filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ # Change the user, group ownership to root on one of the brick from backend
+ user_group = ':'.join([user2, user2])
+ command = ' '.join([commands['chown'], user_group, filename])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-l", filename])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ' '.join([user2, user2])
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test012():
+ """
+ Description:
+ Forced merge of directory test
+ """
+ input_file = urandom
+ file1 = "f1"
+ file2 = "f2"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = afrutils.setup_testenv_gfid_heal()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+file1,
+ "bs=1M", "count=1"])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ name = "trusted.gfid"
+ value = "0s+wqm/34LQnm8Ec8tCmoHEg=="
+ command = ' '.join([commands['setattr'],"-n", name, "-v", value, file1])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+file2,
+ "bs=1M", "count=1"])
+ output = serverutils.execute_on_brick("brick2", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ name = "trusted.gfid"
+ value = "0sQTi1LjUkQwOhek4Oqx+daA=="
+ command = ' '.join([commands['setattr'],"-n", name, "-v", value, file2])
+ output = serverutils.execute_on_brick("brick2", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ return_status = afrutils.create_volume_gfid_heal("server1")
+ if return_status is not 0:
+ return return_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = clientutils.mount("mount1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['ls'], "-l"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ base_command = "getfattr -d -m . -e hex"
+ for _file in (file1, file2):
+ command = ' '.join([base_command, _file])
+ outputs = serverutils.execute_on_bricks(bricks, command)
+ assert_success_status = atfutils.assert_success_of_outputs(outputs)
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ selfheal_completion_status = afrutils.wait_till_selfheal_completes(15)
+ if selfheal_completion_status is not 0:
+ return selfheal_completion_status
+
+ for _file in (file1, file2):
+ command = ' '.join([commands['ls'], "-l", _file])
+ expected_output = "1048576"
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test013():
+ """
+ Description:
+ Do not selfheal files without gfid's, when path to the files to be
+ self-heal is not specified
+
+ Ex:- Execution of find . | xargs stat on mount point will not self heal
+ files if the files doesn't have gfid
+ """
+ input_file = urandom
+ file1 = "f1"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = afrutils.setup_testenv_gfid_heal()
+ if return_status is not 0:
+ return return_status
+
+ output_file = file1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], output_file])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = output_file
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ return_status = afrutils.create_volume_gfid_heal("server1")
+ if return_status is not 0:
+ return return_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = clientutils.mount("mount1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = "find . | xargs stat"
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], output_file])
+ output = serverutils.execute_on_brick("brick2", command)
+ expected_output = "No such file or directory"
+ validation_status = atfutils.validate_output(output, 1, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test014():
+ """
+ Description:
+ Selfheal files without gfid's when path to the files to be
+ self-heal is specified
+
+ Ex:- Execution of ls <files_to_be_selfhealed> on mount point
+ will self heal files even if the files doesn't have gfid
"""
- Description: Test for estale when the fs is stale
- """
- return_status = 1
- if reset_testenv():
- return return_status
- if setup_testenv():
- return return_status
-
- clientutils.execute_on_mount("mount1", "touch file")
- serverutils.execute_on_brick("brick1",
- "setfattr -n trusted.gfid -v 0sBfz5vAdHTEK1GZ99qjqTIg== file")
- return_status = clientutils.execute_on_mount("mount1", "find file | xargs stat")
-
- if return_status:
- test_status = 0
- else:
- test_status = 1
-
- return test_status
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ input_file = urandom
+ file1 = "f1"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = afrutils.setup_testenv_gfid_heal()
+ if return_status is not 0:
+ return return_status
+
+ output_file = file1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], output_file])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = output_file
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], output_file])
+ output = serverutils.execute_on_brick("brick2", command)
+ expected_output = "No such file or directory"
+ validation_status = atfutils.validate_output(output, 1, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ return_status = afrutils.create_volume_gfid_heal("server1")
+ if return_status is not 0:
+ return return_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = clientutils.mount("mount1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['ls'], "-l", output_file])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test015():
+ """
+ Description:
+ * Birck1 has data without GFID
+ * Brick2 doesn't have data
+ * Create Volume
+ * Start volume
+ * execute 'ls -lR <DIRNAME>'
+ * Triggers Self-Heal.
+ """
+ input_file = urandom
+ dir1 = "d1"
+ dir2 = "d2"
+ file1 = "f1"
+ file2 = "f2"
+ testdir1 = "testdir1"
+ t1_d1 = os.path.join(testdir1, dir1)
+ t1_d2 = os.path.join(testdir1, dir2)
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = afrutils.setup_testenv_gfid_heal()
+ if return_status is not 0:
+ return return_status
+
+ command = ' '.join([commands['mkdir'], t1_d1, t1_d2])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ t1_f1 = os.path.join(testdir1, file1)
+ output_file = t1_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d1_f1= os.path.join(t1_d1, file1)
+ output_file = t1_d1_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d1_f2 = os.path.join(t1_d1, file2)
+ output_file = t1_d1_f2
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=2"])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = "2097152"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d2_f1 = os.path.join(t1_d2, file1)
+ output_file = t1_d2_f1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ t1_d2_f2 = os.path.join(t1_d2, file2)
+ output_file = t1_d2_f2
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=2"])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = "2097152"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ return_status = afrutils.create_volume_gfid_heal("server1")
+ if return_status is not 0:
+ return return_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = clientutils.mount("mount1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['ls'], "-Rl", testdir1])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ selfheal_completion_status = afrutils.wait_till_selfheal_completes(30)
+ if selfheal_completion_status is not 0:
+ return selfheal_completion_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test016():
+ """
+ Description:
+ Self-Heal of files without GFID should return I/O Error
+ when some childern are down
+ """
+ input_file = urandom
+ file1 = "f1"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = afrutils.setup_testenv_gfid_heal()
+ if return_status is not 0:
+ return return_status
+
+ output_file = file1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], output_file])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = output_file
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], output_file])
+ output = serverutils.execute_on_brick("brick2", command)
+ expected_output = "No such file or directory"
+ validation_status = atfutils.validate_output(output, 1, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ return_status = afrutils.create_volume_gfid_heal("server1")
+ if return_status is not 0:
+ return return_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = clientutils.mount("mount1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = "find . | xargs stat"
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "Input/output error"
+ validation_status = atfutils.validate_output(output, 1, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-Rl"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "Input/output error"
+ validation_status = atfutils.validate_output(output, 1, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-Rl", output_file])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "Input/output error"
+ validation_status = atfutils.validate_output(output, 1, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], output_file])
+ output = serverutils.execute_on_brick("brick2", command)
+ expected_output = "No such file or directory"
+ validation_status = atfutils.validate_output(output, 1, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test017():
+ """
+ Description:
+ * create a <file1> on brick1 from the backend
+ * create a replicate volume with brick1, brick2
+ * brick down brick1
+ * from the mount, dd <file1>
+ * bring back brick1
+ * ls <file1>
+ * The file <file1> on brick1 has to be replaced by new file <file1>
+ """
+ input_file = urandom
+ file1 = "f1"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = afrutils.setup_testenv_gfid_heal()
+ if return_status is not 0:
+ return return_status
+
+ output_file = file1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], output_file])
+ output = serverutils.execute_on_brick("brick1", command)
+ expected_output = output_file
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], output_file])
+ output = serverutils.execute_on_brick("brick2", command)
+ expected_output = "No such file or directory"
+ validation_status = atfutils.validate_output(output, 1, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ return_status = afrutils.create_volume_gfid_heal("server1")
+ if return_status is not 0:
+ return return_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = glusterutils.volume_stop_brick("brick1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = clientutils.mount("mount1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['ls'], "|", commands['wc'], "-l"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "0"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output_file = file1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=10"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "10485760"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = ' '.join([commands['ls'], "-l", output_file])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "10485760"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ selfheal_completion_status = afrutils.wait_till_selfheal_completes(15)
+ if selfheal_completion_status is not 0:
+ return selfheal_completion_status
+
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test018():
+ """
+ Testing split-brain
+ """
+ input_file = urandom
+ file1 = "f1"
+ file2 = "f2"
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = afrutils.setup_testenv_gfid_heal()
+ if return_status is not 0:
+ return return_status
+
+ return_status = afrutils.create_volume_gfid_heal("server1")
+ if return_status is not 0:
+ return return_status
+
+ output = glusterutils.volume_start("server1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output = clientutils.mount("mount1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output_file = file1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=10"])
+ expected_output = "10485760"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-l", output_file])
+ expected_output = "10485760"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ output = glusterutils.volume_stop_brick("brick1")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output_file = file2
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=10"])
+ expected_output = "10485760"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-l", output_file])
+ expected_output = "10485760"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick2", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = ""
+ expected_output = "Input/output error"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 1, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def bug2840():
+ """
+ Description:
+ Device Files not getting self-healed
+ """
+ file1 = "file1"
+ device_file = "devicefile"
+ input_file = urandom
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ output_file = file1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ expected_output = "1048576"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+
+ command = ' '.join([commands['ls'], "-l", output_file])
+ expected_output = "1048576"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = "mknod -m 0600 %s b 2 0" % device_file
+ expected_output = ""
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-l", device_file])
+ expected_output = "brw-------."
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ expected_output = "No such file or directory"
+ output = serverutils.execute_on_brick("brick2", command)
+ validation_status = atfutils.validate_output(output, 1, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = "find . | xargs stat"
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-l", device_file])
+ expected_output = device_file
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ validation_status = validate.validate_md5sums(mounts, bricks)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def bug3503():
+ """
+ Description:
+ open should trigger data self-heal instead of lookup
+ """
+ file1 = "file1"
+ input_file = urandom
+
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ output = glusterutils.volume_set("server1", key="data-self-heal",
+ value="open")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ output_file = file1
+ command = ' '.join([commands['dd'], "if="+input_file, "of="+output_file,
+ "bs=1M", "count=1"])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output,
+ stream="stderr")
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-l", output_file])
+ expected_output = "1048576"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['truncate'], "-s 0", output_file])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-l", output_file])
+ expected_output = "0"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick2", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ # Do not data self heal when ls <filename> is executed
+ command = ' '.join([commands['ls'], "-l", output_file])
+ expected_output = "0"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick2", command)
+ expected_output = "1048576"
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ # Self heal with open or fd based fop
+ command = ' '.join([commands['cat'], output_file])
+ output = clientutils.execute_on_mount("mount1", command)
+ expected_output = ""
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ command = ' '.join([commands['ls'], "-l", output_file])
+ expected_output = "0"
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
+
+def test019():
+ """
+ Self-Heal of Special Files
+ """
+ return_status = reset_testenv()
+ if return_status is not 0:
+ return return_status
+
+ return_status = setup_testenv()
+ if return_status is not 0:
+ return return_status
+
+ fifo_file = "fifo"
+ block_file = "block"
+ char_file = "char"
+ user = "qa"
+ root = "root"
+
+ # Create a FIFO file
+ command = "mkfifo -m 0600 %s" % fifo_file
+ output = clientutils.execute_on_mount("mount1", command)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['ls'], "-l", fifo_file])
+ expected_output = "prw-------."
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ # Create a Block File
+ command = "mknod -m 0600 %s b 2 0" % block_file
+ output = clientutils.execute_on_mount("mount1", command)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['ls'], "-l", block_file])
+ expected_output = "brw-------."
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ # Create a Char File
+ command = "mknod -m 0600 %s c 2 0" % char_file
+ output = clientutils.execute_on_mount("mount1", command)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ command = ' '.join([commands['ls'], "-l", char_file])
+ expected_output = "crw-------."
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_stop_brick("brick2")
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ # Change the User and Group of FIFO, Block, Char Files
+ user_group = ':'.join([user, user])
+ for _file in (fifo_file, block_file, char_file):
+ command = ' '.join([commands['chown'], user_group, _file])
+ output = clientutils.execute_on_mount("mount1", command)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ # Validate the changes made to FIFO, Block, Char Files
+ for _file in (fifo_file, block_file, char_file):
+ command = ' '.join([commands['ls'], "-l", _file])
+ expected_output = ' '.join([user, user])
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ expected_output = ' '.join([root, root])
+ output = serverutils.execute_on_brick("brick2", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ # Change the Permissions for FIFO, Block, Char Files
+ for _file in (fifo_file, block_file, char_file):
+ command = ' '.join([commands['chmod'], "0644", _file])
+ output = clientutils.execute_on_mount("mount1", command)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ # Validate the Permission changes performed on FIFO File
+ command = ' '.join([commands['ls'], "-l", fifo_file])
+ expected_output = "prw-r--r--."
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ expected_output = "prw-------."
+ output = serverutils.execute_on_brick("brick2", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ # Validate the Permission changes performed on Block File
+ command = ' '.join([commands['ls'], "-l", block_file])
+ expected_output = "brw-r--r--."
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ expected_output = "brw-------."
+ output = serverutils.execute_on_brick("brick2", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ # Validate the Permission changes performed on Char File
+ command = ' '.join([commands['ls'], "-l", char_file])
+ expected_output = "crw-r--r--."
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ output = serverutils.execute_on_brick("brick1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ expected_output = "crw-------."
+ output = serverutils.execute_on_brick("brick2", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ output = glusterutils.volume_start("server1", force=True)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ brick_reboot_status = afrutils.wait_till_brick_reboot(brick_reboot_time)
+ if brick_reboot_status is not 0:
+ return brick_reboot_status
+
+ command = "find . | xargs stat"
+ output = clientutils.execute_on_mount("mount1", command)
+ assert_success_status = atfutils.assert_success(output["exitstatus"])
+ if assert_success_status is not 0:
+ return assert_success_status
+
+ # Validate the changes made to FIFO, Block, Char Files
+ for _file in (fifo_file, block_file, char_file):
+ command = ' '.join([commands['ls'], "-l", _file])
+ expected_output = ' '.join([user, user])
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ # Validate the Permission changes performed on FIFO File
+ command = ' '.join([commands['ls'], "-l", fifo_file])
+ expected_output = "prw-r--r--."
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ # Validate the Permission changes performed on Block File
+ command = ' '.join([commands['ls'], "-l", block_file])
+ expected_output = "brw-r--r--."
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ # Validate the Permission changes performed on Char File
+ command = ' '.join([commands['ls'], "-l", char_file])
+ expected_output = "crw-r--r--."
+ output = clientutils.execute_on_mount("mount1", command)
+ validation_status = atfutils.validate_output(output, 0, expected_output)
+ if validation_status is not 0:
+ return validation_status
+ validation_status = validate.validate_on_bricks(bricks, command, 0,
+ expected_output)
+ if validation_status is not 0:
+ return validation_status
+
+ return 0
diff --git a/TestUnits/xlators/cluster/afr/self_heal/testcaseslist b/TestUnits/xlators/cluster/afr/self_heal/testcaseslist
index ba90492..04e03ca 100644
--- a/TestUnits/xlators/cluster/afr/self_heal/testcaseslist
+++ b/TestUnits/xlators/cluster/afr/self_heal/testcaseslist
@@ -1,9 +1,27 @@
#################################################################
# List of testcases for the self-heal feature of afr.
-# TestCaseId : Version : Keyword
+# TestCaseId : Version : Keyword
##################################################################
-test001 : >= 3.2 : art
-test002 : >= 3.2 : art
-
-
-
+test001 : >= 3.2 : art
+test002 : >= 3.2 : art
+test003 : >= 3.2 : art
+test004 : >= 3.2 : art
+test005 : >= 3.2 : art
+test006 : >= 3.2 : art
+test007 : >= 3.2 : art
+test008 : >= 3.2 : art
+test009 : >= 3.2 : art
+test010a : >= 3.2 : art
+test010b : >= 3.2 : art
+test010c : >= 3.2 : art
+test011 : >= 3.2 : art
+test012 : >= 3.2 : art
+test013 : >= 3.2 : art
+test014 : >= 3.2 : art
+test015 : >= 3.2 : art
+test016 : >= 3.2 : art
+test017 : >= 3.2 : art
+test018 : >= 3.2 : art
+test019 : >= 3.2 : art
+bug2840 : >= 3.2 : art
+bug3503 : >= 3.2 : art
diff --git a/TestUnits/xlators/cluster/afr/self_heal/testenv.cfg b/TestUnits/xlators/cluster/afr/self_heal/testenv.cfg
index 991756f..a38571e 100644
--- a/TestUnits/xlators/cluster/afr/self_heal/testenv.cfg
+++ b/TestUnits/xlators/cluster/afr/self_heal/testenv.cfg
@@ -1,23 +1,23 @@
[DEFAULT]
-user = root
-password = syst3m
-glusterversion = 3.2.5
+user =
+password =
+glusterversion =
installpath =
-downloadpath =
+downloadpath =
# ExportDir Section.
# Necessary Options: dir
# Optional: fstype, device
[export1]
-dir = /export
-fstype = xfs
-device = /dev/sdb1
-options =
+dir =
+fstype =
+device =
+options =
[export2]
-dir = /export
-fstype = xfs
-device = /dev/sda1
+dir =
+fstype =
+device =
# Server Section
# Necessary Options: hostname, username, password, glusterversion.
@@ -25,10 +25,10 @@ device = /dev/sda1
# can be overridden
# Optional: installpath
[server1]
-hostname = 10.1.11.110
+hostname =
[server2]
-hostname = 10.1.11.111
+hostname =
# Brick Section
# Necessary Options: hostname, path
@@ -40,21 +40,13 @@ path = export1
hostname = server2.hostname
path = export2
-[brick3]
-hostname = server1.hostname
-path = /opt/export1
-
-[brick4]
-hostname = server2.hostname
-path = /opt/export1
-
# Volume Section
# Necessary Options: volumename, bricks
# Optional replica=<Count>, stripe=<Count>
-#
+#
[volume1]
volumename = replicate
-replica=
+replica=2
stripe=
transporttype = tcp
bricks = brick1, brick2
@@ -65,15 +57,15 @@ bricks = brick1, brick2
# can be overridden
# Optional: installpath
[client1]
-hostname = 10.1.11.109
+hostname =
# MountDevice Section
-# Necessary Options: hostname, volume
+# Necessary Options: hostname, volume
# The Server1.hostname could be a VIP also. Need not be a server hostname
# IN a general case,(without NFS) we keep the 1st server from serverpool
# The volume specified in this section is the "active_volume" onto which all
# clients will be mounting to. This active volume and hostname can be changed
-# during testrun.
+# during testrun.
[mountdevice1]
hostname = server1.hostname
volumename = volume1.volumename
@@ -81,28 +73,9 @@ volumename = volume1.volumename
# Mount Section
# addMount(dir, type, client, device=master.volume, logfile=None)
[mount1]
-dir = /mnt/replicate1
-client = client1
-device = mountdevice1
-type = glusterfs
+dir =
+client =
+device =
+type =
logfile =
options =
-
-[mount2]
-dir = /mnt/replicate2
-client = client1
-device = mountdevice1
-type = glusterfs
-
-[mount3]
-dir = /mnt/replicate3
-client = client1
-device = mountdevice1
-type = glusterfs
-
-
-
-
-
-
-
diff --git a/TestUnits/xlators/cluster/afr/self_heal/testunit.py b/TestUnits/xlators/cluster/afr/self_heal/testunit.py
index 840889b..4a6e2bb 100644
--- a/TestUnits/xlators/cluster/afr/self_heal/testunit.py
+++ b/TestUnits/xlators/cluster/afr/self_heal/testunit.py
@@ -18,40 +18,42 @@ def initialize():
"""
"""
logger = GlobalObj.getLoggerObj()
- return_status = 1
testenv_file = GlobalObj.testenv_file
testenv_abspath = os.path.join(dir_path, testenv_file)
if not (os.path.isfile(testenv_abspath)):
logger.error("%s not found in %s" % (testenv_file, dir_path))
-
- if parser.parse_testenv_configfile(testenv_abspath):
+
+ return_status = parser.parse_testenv_configfile(testenv_abspath)
+ if return_status is not 0:
return return_status
- if managerutils.ssh_connect_allhosts():
+
+ return_status = managerutils.ssh_connect_allhosts()
+ if return_status is not 0:
return return_status
-
+
return 0
def setup():
"""
"""
- return_status = 1
- if atfutils.set_active_volume("volume1"):
+ return_status = atfutils.set_active_volume("volume1")
+ if return_status is not 0:
return return_status
+
return 0
def execute():
"""
"""
logger = GlobalObj.getLoggerObj()
- return_status = 1
testcaseslist_file = GlobalObj.testcaseslist_file
testcaseslist_abspath = os.path.join(dir_path, testcaseslist_file)
-
+
if not (os.path.isfile(testcaseslist_abspath)):
logger.error("%s not found in %s" % (testcaseslist_file, dir_path))
- return return_status
-
+ return 1
+
else:
testcaseslist = []
testcaseslist = parser.parse_testcaseslist_file(testcaseslist_abspath)
@@ -63,52 +65,58 @@ def execute():
passedtestcases = 0
failedtestcases = 0
selectedtestcases = len(testcaseslist)
-
+
logger.info("Starting TestUnit: '%s' test execution" % dir_path)
for testcase in testcaseslist:
function_obj = getattr(testcases, testcase)
if function_obj:
- logger.debug("Starting Test: ' %s '" % testcase)
+ logger.info("Starting Test: %s" % testcase)
return_status = function_obj()
- if return_status:
- logger.debug("TestCase '%s' Failed" % testcase)
+ if return_status is not 0:
+ logger.info("TestCase %s Failed" % testcase)
failedtestcases += 1
else:
- logger.debug("TestCase '%s' Passed" % testcase)
+ logger.info("TestCase %s Passed" % testcase)
passedtestcases += 1
-
- logger.debug("Ending Test: '%s'" % testcase)
+
+ logger.info("Ending Test: %s" % testcase)
else:
logger.info("TestCase %s not defined in 'testcases' module"
% testcase)
- continue
+
logger.info("Selected %d : Passed %d, Failed %d"
% (selectedtestcases,
passedtestcases,
failedtestcases))
logger.info("Ending TestUnit: '%s' test execution" % dir_path)
-
+
return 0
def cleanup():
"""
"""
pass
-
+
def main():
"""
"""
- return_status = 1
- if initialize():
+ return_status = initialize()
+ if return_status is not 0:
return return_status
- if setup():
+
+ return_status = setup()
+ if return_status is not 0:
return return_status
- if execute():
+
+ return_status = execute()
+ if return_status is not 0:
return return_status
- if cleanup():
+
+ return_status = cleanup()
+ if return_status is not 0:
return return_status
-
+
return 0