def test_move_file_srcpath_not_exist(): cmd = "%s/bfs_client mv /file_not_exist /file_not_exist.new" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_not_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_read_file_not_exist(): cmd = "%s/mark --mode=read --count=10 --thread=3 --seed=1 --file_size=1024" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) ret1 = common.check_process() nose.tools.assert_not_equal(ret, 0) nose.tools.assert_equal(ret1, 0) '''
def test_cat_empty_file(): cmd = "%s/bfs_client cat /empty_file" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_list_file_not_exist(): cmd = "%s/bfs_client ls /new_file_not_exist" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_not_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_put_empty_file(): cmd = "%s/bfs_client put %s/data/empty_file /empty_file" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_get_file_bfsfile_not_exist(): cmd = "%s/bfs_client get /not_exist_file %s/data/not_exist_file" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_not_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_put_file_localfile_not_exist(): cmd = "%s/bfs_client put %s/data/file_not_exist /file_not_exist" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_not_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_put_file_localfile_not_exist(): cmd = "%s/bfs_client put %s/data/file_not_exist /file_not_exist" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_not_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_put_empty_file(): cmd = "%s/bfs_client put %s/data/empty_file /empty_file" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_get_file_bfsfile_not_exist(): cmd = "%s/bfs_client get /not_exist_file %s/data/not_exist_file" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_not_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_nameserver_stop_normal(): cmd = "killall -9 nameserver" print time.strftime("%Y%m%d-%H%M%S") + " command: " + cmd (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) time.sleep(3) ret1 = common.check_process(type="nameserver") nose.tools.assert_equal(ret1, 1) '''
def test_nameserver_restart_normal(): common.bfs_stop_all() cmd = "cd %s/nameserver0 && ./bin/nameserver 1>nlog 2>&1 &" % const.work_dir print time.strftime("%Y%m%d-%H%M%S") + " command: " + cmd ret = os.system(cmd) nose.tools.assert_equal(ret, 0) time.sleep(3) ret1 = common.check_process(type="nameserver") '''
def test_touch_file_exist(): cmd = "%s/bfs_client touchz /new_file_3" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client touchz /new_file_3" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_not_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_nameserver_start_twice(): cmd = "cd %s/nameserver0 && ./bin/nameserver 1>nlog 2>&1 &" % const.work_dir print time.strftime("%Y%m%d-%H%M%S") + " command: " + cmd ret = os.system(cmd) nose.tools.assert_not_equal(ret, 0) time.sleep(3) cmd = "%s/bfs_client touchz /test_nameserver_start_twice" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) ret1 = common.check_process(type="nameserver") nose.tools.assert_equal(ret1, 0) '''
def test_touch_file_exist(): cmd = "%s/bfs_client touchz /new_file_3" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client touchz /new_file_3" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_not_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_move_file_destfile_is_exist(): cmd = "%s/bfs_client put %s/data/README.md /README.md" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client touchz /README.md.1" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client mv /README.md /README.md.1" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_not_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_move_file_destfile_is_exist(): cmd = "%s/bfs_client put %s/data/README.md /README.md" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client touchz /README.md.1" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client mv /README.md /README.md.1" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_not_equal(ret, 0) ret1 = common.check_process() nose.tools.assert_equal(ret1, 0) '''
def test_nameserver_start_conf_not_exist(): common.bfs_stop_all() (ret, out, err) = common.runcmd("cd nameserver0 && mv bfs.flag bfs.flag.bak") assert (ret == 0) cmd = "cd %s/nameserver0 && ./bin/nameserver 1>nlog 2>&1 &" % const.work_dir print time.strftime("%Y%m%d-%H%M%S") + " command: " + cmd ret = os.system(cmd) nose.tools.assert_not_equal(ret, 0) time.sleep(3) ret1 = common.check_process(type="nameserver") nose.tools.assert_equal(ret1, 1) (ret, out, err) = common.runcmd("cd nameserver0 && mv bfs.flag.bak bfs.flag") assert (ret == 0)