def test_cthon(pnfs=True, delegations=True): """Run cthon with protod configured for the given values for pnfs and delegations""" print "Starting to run cthon: pnfs = " + str(pnfs) + ", delegations = " + str(delegations) test_dir = "test_d" if delegations: test_dir += "y" else: test_dir += "n" test_dir += "_p" if pnfs: test_dir += "y" else: test_dir += "n" # Remove it if it exists! shares.share_remove(test_dir, False) testit.test_pass("Running Test shares.test_create_share " + test_dir, shares.test_create_share, test_dir) testit.test_pass("Running Test mount.root - should mount", testrig.test_mount_root) testit.test_pass("Make sure normal users can write on " + test_dir, testrig.test_open_up_share, test_dir) testit.test_pass("Running Test umount.root", testrig.test_umount_root) testrig.reset_protod(delegations, pnfs) retval = testit.test_pass("Running cthon " + test_dir, test_run_cthon, test_dir) return retval
def main(argv): '''Run the Protocol Regression Test Suite''' do_setup = False env_yaml = 'environment.yaml' try: opts, args = getopt.getopt(argv, 'hse:', ['setup', 'env=']) except getopt.GetoptError: print 'testrig.py -s <do setup> -e <environment_file>' sys.exit(2) for opt, args in opts: if opt == '-h': print 'testrig.py -s <do setup> -e <environment_file>' sys.exit(0) elif opt in ('-e', '--env'): env_yaml = args elif opt in ('-s', '--setup'): do_setup = True env.load(env_yaml) if do_setup: test_pass('Setting up the dd, ds, and client with necessary software and directories', setup.init) else: print 'Skipping setting up the dd, ds, and client with necessary software and directories' ''' log_times('starting up') reset_protod(True, True) share_tests() mtime_test() cthon_tests() fstest_tests() xfstests_tests() reset_protod(True, True) log_times('wrapping up') ''' xfstests_tests() return 0
def test_fstest(pnfs=True, delegations=True): '''Run fstest with protod configured for the given values for pnfs and delegations''' print 'Starting to run fstest: pnfs = ' + str(pnfs) + ', delegations = ' + str(delegations) test_dir = 'test_d' if delegations: test_dir += 'y' else: test_dir += 'n' test_dir += '_p' if pnfs: test_dir += 'y' else: test_dir += 'n' # Remove it if it exists! shares.share_remove(test_dir, False) testit.test_pass('Running Test shares.test_create_share ' + test_dir, shares.test_create_share, test_dir) testit.test_pass('Running Test mount.root - should mount', testrig.test_mount_root) testit.test_pass('Make sure normal users can write on ' + test_dir, testrig.test_open_up_share, test_dir) testit.test_pass('Running Test umount.root', testrig.test_umount_root) testrig.reset_protod(delegations, pnfs) testit.test_pass('Running Test mount.root - should mount', testrig.test_mount_root) retval = testit.test_pass('Running fstest ' + test_dir, test_run_fstest, test_dir) testit.test_pass('Running Test umount.root', testrig.test_umount_root) return retval
def reset_protod(delegations, pnfs): '''Test wrapper over stopping protod, modifying the config, and restarting protod on the dd''' test_pass('Shutting down protod', test_pcs_protod, 'disable') test_pass('Reset protod configuration', test_reload_protod, delegations, pnfs) test_pass('Starting up protod', test_pcs_protod, 'enable')
def mtime_test(): '''Run the mtime test''' test_pass('Running Test mount.root - should mount', test_mount_root) test_pass('Running Test mtime - should mtime', test_run_mtime) test_pass('Running Test umount.root', test_umount_root)
def share_tests(): '''Run the namespace regression tests''' test_pass('Running Test shares.delete_all_shares', shares.delete_all_shares) test_fail('Running Test mount.root - should fail to mount', test_mount_root) test_fail('Running Test shares.test_create_share alpo - should fail to create', shares.test_create_share, 'alpo') test_fail('Running Test shares.test_create_invalid_shareid - should fail to create', shares.test_create_invalid_shareid) test_pass('Running Test shares.test_create_share root', shares.test_create_share, 'root') test_pass('Running Test shares.test_create_share alpo', shares.test_create_share, 'alpo') test_pass('Running Test shares.share_remove alpo', shares.share_remove, 'alpo') test_pass('Running Test recreate shares.test_create_share alpo', shares.test_create_share, 'alpo') test_fail('Running Test shares.test_create_existing_shareid - should fail to create', shares.test_create_existing_shareid) test_fail('Running Test shares.test_create_existing_name - should fail to create', shares.test_create_existing_name) test_fail('Running Test shares.test_create_existing_path - should fail to create', shares.test_create_existing_path) test_fail('Running Test shares.test_create_existing_share - should fail to create', shares.test_create_existing_share) test_fail('Running Test shares.test_create_existing_uuid - should fail to create', shares.test_create_existing_uuid) test_fail('Running Test shares.test_create_invalid_path - should fail to create', shares.test_create_invalid_path) test_fail('Running Test shares.test_reuse_root - should fail to create', shares.test_reuse_root) test_fail('Running Test shares.test_mount_over - should fail to create', shares.test_mount_over) test_fail('Running Test shares.test_create_existing_share - should fail to create', shares.test_create_existing_share) test_pass('Running Test shares.test_create_share matic', shares.test_create_share, 'matic') test_pass('Running Test mount.root - should mount', test_mount_root) test_pass('Running Test shares.test_create_share deep1', shares.test_create_share, 'deep1') test_pass('Checking to see if deep1 exists', test_share_loaded, 'deep1') test_pass('Running Test shares.test_create_share deep2', shares.test_create_share, 'deep2') test_pass('Checking to see if deep1 exists', test_share_loaded, 'deep2') test_pass('Running Test shares.test_create_share deep3', shares.test_create_share, 'deep3') test_pass('Checking to see if deep1 exists', test_share_loaded, 'deep3') test_pass('Running Test shares.test_create_share deep4', shares.test_create_share, 'deep4') test_pass('Checking to see if deep1 exists', test_share_loaded, 'deep4') cover_base = shares.find_share('cover_base') cover_base_path = cover_base['path'].split('/') if len(cover_base_path) < 4: print cover_base_path + ' must be at least 3 deep' sys.exit(1) test_pass('Checking to see if we can load cover_base', shares.test_create_share, 'cover_base') new_path = '/'.join(cover_base_path[0:2]) test_fail('Checking to see if we can load cover as ' + new_path, shares.share_create_path, 'cover', new_path) new_path = '/'.join(cover_base_path[0:3]) test_fail('Checking to see if we can load cover as ' + new_path, shares.share_create_path, 'cover', new_path) new_path = '/'.join(cover_base_path[0:4]) test_fail('Checking to see if we can load cover as ' + new_path, shares.share_create_path, 'cover', new_path) new_path = '/'.join(cover_base_path[0:3]) new_path = new_path[:-1] test_pass('Checking to see if we can load cover as ' + new_path, shares.share_create_path, 'cover', new_path) test_pass('Can we chmod the root?', test_open_up_share, 'root') mount_dir = env.env['paths']['mount'] src = env.env['paths']['rgr'] + '/' + env.env['files']['test1'] dst = mount_dir + '/' + env.env['files']['test1'] test_pass('Copying ' + src + ' to ' + dst, test_copy_file, src, dst) # FIXME: Refactor! test_pass('Can we mkdir /a.dir?', test_client_mkdir, 'root', 'a.dir') dst_a = mount_dir + '/a.dir' + '/' + env.env['files']['test1'] test_pass('Copying ' + src + ' to ' + dst_a, test_copy_file, src, dst_a) test_pass('Can we mkdir /b.dir?', test_client_mkdir, 'root', 'b.dir') dst_b = mount_dir + '/b.dir' + '/' + env.env['files']['test1'] test_pass('Copying ' + src + ' to ' + dst_b, test_copy_file, src, dst_b) test_pass('Can we mkdir /c.dir?', test_client_mkdir, 'root', 'c.dir') dst_c = mount_dir + '/c.dir' + '/' + env.env['files']['test1'] test_pass('Copying ' + src + ' to ' + dst_c, test_copy_file, src, dst_c) test_pass('Comparing ' + dst_a + ' to ' + dst_b, test_cmp_file, dst_a, dst_b) test_pass('Comparing ' + dst_a + ' to ' + dst_c, test_cmp_file, dst_a, dst_c) test_pass('Comparing ' + dst_b + ' to ' + dst_c, test_cmp_file, dst_b, dst_c) test_pass('Try a hard link', test_ln_file, dst_c, dst_c + '.lnk') mknod_file = mount_dir + '/dev_null' test_pass('Try a mknod', test_mknod_file, mknod_file) test_pass('Try a directory mv of a.dir to b.dir', test_mv_obj, mount_dir + '/a.dir', mount_dir + '/b.dir') test_pass('Try a soft link on directories', test_ln_s_file, mount_dir + '/b.dir/a.dir', mount_dir + '/c.dir/d.dir') test_pass('Can we mkdir /rookie?', test_client_mkdir, 'root', 'rookie') test_pass('Can we echo to /rookie/surprise?', test_client_echo, 'root', 'Test the rookie share', 'rookie/surprise') test_pass('Can we echo to /surprise?', test_client_echo, 'root', 'Test the rookie share', 'surprise') test_pass('Running Test shares.test_create_share rookie', shares.test_create_share, 'rookie') path = client_mounted_path('root') sup1 = path + '/rookie/surprise' sup2 = path + '/surprise' test_pass('Comparing ' + sup1 + ' to ' + sup2 + ', which should work because the client has the FH for the directory cached', test_cmp_file, sup1, sup2) test_pass('Does ' + sup1 + ' exist?', test_check_file, sup1) test_pass('Does ' + sup2 + ' exist?', test_check_file, sup2) test_pass('List the contents of root', test_client_ls, 'root') test_pass('Running Test umount.root', test_umount_root) test_pass('Running Test mount.root - should mount', test_mount_root) test_fail('Does ' + sup1 + ' exist?', test_check_file, sup1) test_pass('Does ' + sup2 + ' exist?', test_check_file, sup2) test_fail('Comparing ' + sup1 + ' to ' + sup2 + ', which should fail because /rookie is covered', test_cmp_file, sup1, sup2) test_fail('Test if we can see it at all', test_client_cat, 'root', 'rookie/surprise') test_pass('Running Test shares.share_remove rookie', shares.share_remove, 'rookie') test_fail('Comparing ' + sup1 + ' to ' + sup2 + ', which should fail because /rookie is still covered', test_cmp_file, sup1, sup2) test_fail('Test if we can see it at all', test_client_cat, 'root', 'rookie/surprise') test_pass('Test if we can see it at all', test_client_cat, 'root', 'surprise') test_pass('Running Test umount.root', test_umount_root) test_pass('Running Test mount.root - should mount', test_mount_root) test_pass('Does ' + sup1 + ' exist?', test_check_file, sup1) test_pass('Does ' + sup2 + ' exist?', test_check_file, sup2) test_pass('List the contents of root', test_client_ls, 'root') test_pass('Comparing ' + sup1 + ' to ' + sup2 + ', which should work because the client has the FH for the directory cached', test_cmp_file, sup1, sup2) test_pass('Running Test umount.root', test_umount_root)