Skip to content

Commit

Permalink
robot: add mv/rename test
Browse files Browse the repository at this point in the history
  • Loading branch information
YunhuiChen committed Nov 19, 2021
1 parent f512e79 commit 2357752
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
30 changes: 27 additions & 3 deletions robot/Resources/keywords/fs_fault_inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def cp_check_data():
test_client = config.fs_test_client[0]
ssh = shell_operator.create_ssh_connect(test_client, 1046, config.abnormal_user)
test_dir = config.fs_mount_path
operator = ["cp","mv"]
operator = "cp"
for name in config.fs_mount_dir:
ori_cmd = random.choice(operator) + ' ' + test_dir + name + ".0.0" + ' ' + test_dir + name
ori_cmd = operator + ' ' + test_dir + name + ".0.0" + ' ' + test_dir + name
rs = shell_operator.ssh_exec(ssh, ori_cmd)
assert rs[3] == 0,"cp fail"
ssh.close()
Expand All @@ -108,6 +108,30 @@ def checksum_data():
logger.info("check file md5 is %s"%check_list)
assert check_list == config.md5_check,"md5 check fail,begin is %s,end is %s"%(config.md5_check,check_list)

def mv_data():
test_client = config.fs_test_client[0]
ssh = shell_operator.create_ssh_connect(test_client, 1046, config.abnormal_user)
operator = "mv"
for name in config.fs_mount_dir:
test_dir = os.path.join(config.fs_mount_path,name)
ori_cmd = operator + ' ' + test_dir + '/' + name + ".0.0" + ' ' + test_dir + '/' + name + ".0.0.bak"
rs = shell_operator.ssh_exec(ssh, ori_cmd)
assert rs[3] == 0,"mv fail"
ssh.close()

def checksum_mv_data():
test_client = config.fs_test_client[0]
ssh = shell_operator.create_ssh_connect(test_client, 1046, config.abnormal_user)
check_list = []
for name in config.fs_mount_dir:
test_dir = os.path.join(config.fs_mount_path,name)
ori_cmd = "md5sum " + test_dir + '/' + name + ".0.0.bak"
rs = shell_operator.ssh_exec(ssh, ori_cmd)
md5 = "".join(rs[1]).split(" ")[0]
check_list.append(md5)
logger.info("check mv file md5 is %s"%check_list)
assert check_list == config.md5_check,"mv data md5 check fail,begin is %s,end is %s"%(config.md5_check,check_list)

def start_fs_fio():
test_client = config.fs_test_client[0]
ssh = shell_operator.create_ssh_connect(test_client, 1046, config.abnormal_user)
Expand Down Expand Up @@ -216,7 +240,7 @@ def wait_op_finish():
def check_fs_io_error():
test_client = config.fs_test_client[0]
ssh = shell_operator.create_ssh_connect(test_client, 1046, config.abnormal_user)
ori_cmd = "sudo grep \'error\' /var/log/kern.log -R"
ori_cmd = "sudo grep \'error\' /var/log/kern.log -R | grep -v libpthread"
rs = shell_operator.ssh_exec(ssh, ori_cmd)
if rs[1] != []:
ori_cmd = "sudo logrotate -vf /etc/logrotate.d/rsyslog"
Expand Down
2 changes: 2 additions & 0 deletions robot/curve_fs_robot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ inject kill all etcd
check cp/mv data consistency
[Tags] P0 base first release failover
checksum data
mv data
checksum mv data
check fuse mount success
wait op finish

Expand Down
8 changes: 4 additions & 4 deletions ut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ set -e
ulimit -a
ulimit -c unlimited
ulimit -a
ps -ef | grep chunkserver | grep -v grep | awk '{print $2}' | sudo xargs kill -9 || true
ps -ef | grep mds | grep -v grep | awk '{print $2}' | sudo xargs kill -9 || true
ps -ef | grep etcd | grep -v grep | awk '{print $2}' | sudo xargs kill -9 || true
ps -ef | grep test | grep -v grep | awk '{print $2}' | sudo xargs kill -9 || true
ps -ef | grep chunkserver | grep -v grep | grep -v gcc | awk '{print $2}' | sudo xargs kill -9 || true
ps -ef | grep mds | grep -v grep | grep -v gcc | awk '{print $2}' | sudo xargs kill -9 || true
ps -ef | grep etcd | grep -v grep | grep -v gcc | awk '{print $2}' | sudo xargs kill -9 || true
ps -ef | grep test | grep -v grep | grep -v gcc | awk '{print $2}' | sudo xargs kill -9 || true

if [ -f /home/nbs/etcdclient/libetcdclient.h ] && [ -f /home/nbs/etcdclient/libetcdclient.so ]
then
Expand Down

0 comments on commit 2357752

Please sign in to comment.