def find_reviews(search): global open_tabs global total_tabs for line in search.split('\n'): if len(line) < 1: continue d = json.loads(line.rstrip()) if d.get('id'): print ' --> %s' % d['id'] if d['id'] in total_tabs: print ' (skipped, already open)' else: approvals = d['currentPatchSet'].get('approvals', []) for review in approvals: print (' %s: %s %s' %(review['by'].get('name'), review['type'], review['value'])) common.runcmd('chromium-browser ' 'https://review.openstack.org' '/#/q/%s,n,z' %(d['id'])) open_tabs += 1 total_tabs[d['id']] = True
def test_cat_file_exist(): cmd = "cat %s/data/urllist" % const.work_dir (ret1, out1, err1) = common.runcmd(cmd) assert (ret1 == 0) cmd = "%s/bfs_client cat /put_file_1" % const.bfs_client_dir (ret2, out2, err2) = common.runcmd(cmd) nose.tools.assert_equal(ret2, 0) nose.tools.assert_equal(out1, out2) '''
def test_move_file_samedir_diffname(): 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 mv /README.md /README.md.new" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) '''
def test_create_table(): common.print_debug_msg(2, "create table_test001 and create table_test002(kv), write and check") cmd = "./teracli createbyfile testcase/data/create_table_schema" common.runcmd(cmd) cmd = './teracli create "table_test002 <storage=flash, splitsize=2048, mergesize=128>"' common.runcmd(cmd) '''
def test_create_table(): common.print_debug_msg( 2, "create table_test001 and create table_test002(kv), write and check") cmd = "./teracli createbyfile testcase/data/create_table_schema" common.runcmd(cmd) cmd = './teracli create "table_test002 <storage=flash, splitsize=2048, mergesize=128>"' common.runcmd(cmd) '''
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_cat_file_exist(): cmd = "cat %s/data/urllist" % const.work_dir (ret1, out1, err1) = common.runcmd(cmd) assert(ret1 == 0) cmd = "%s/bfs_client cat /put_file_1" % const.bfs_client_dir (ret2, out2, err2) = common.runcmd(cmd) nose.tools.assert_equal(ret2, 0) nose.tools.assert_equal(out1, out2) '''
def test_move_file_samedir_diffname(): 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 mv /README.md /README.md.new" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 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_du_empty_file(): cmd = "%s/bfs_client mkdir /test_du_file_2" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client put %s/data/empty_file /test_du_file_2/empty_file" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client du /test_du_file_2/empty_file" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) nose.tools.assert_equal(out, "/test_du_file_2/empty_file\t0\nTotal:\t0\n")
def test_du_empty_file(): cmd = "%s/bfs_client mkdir /test_du_file_2" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client put %s/data/empty_file /test_du_file_2/empty_file" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client du /test_du_file_2/empty_file" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) nose.tools.assert_equal(out, "/test_du_file_2/empty_file\t0\nTotal:\t0\n")
def test_remove_file_exist(): cmd = "%s/bfs_client mkdir /test_remove_file/test_dir" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client put %s/data/binfile /test_remove_file/test_dir/binfile" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client rm /test_remove_file/test_dir/binfile" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) '''
def test_put_file_destpath_is_dir(): cmd = "%s/bfs_client mkdir /test_put_file" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client put %s/data/urllist /test_put_file" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) cmd = "%s/bfs_client ls /test_put_file/urllist" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) '''
def test_remove_file_exist(): cmd = "%s/bfs_client mkdir /test_remove_file/test_dir" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client put %s/data/binfile /test_remove_file/test_dir/binfile" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client rm /test_remove_file/test_dir/binfile" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) '''
def test_put_file_destpath_is_dir(): cmd = "%s/bfs_client mkdir /test_put_file" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client put %s/data/urllist /test_put_file" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) cmd = "%s/bfs_client ls /test_put_file/urllist" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) '''
def test_touch_new_file_2(): cmd = "%s/bfs_client touchz /new_dir/new_file_2" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) '''
def test_get_file_local_not_exist(): cmd = "rm -rf %s/data/put_file_1 && %s/bfs_client get /put_file_1 %s/data/put_file_1" % (const.work_dir, const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 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_put_file_dest_not_exist(): cmd = "%s/bfs_client put %s/data/urllist /put_file_1" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) '''
def test_get_file_local_not_exist(): cmd = "rm -rf %s/data/put_file_1 && %s/bfs_client get /put_file_1 %s/data/put_file_1" % ( const.work_dir, const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) '''
def test_put_file_dest_not_exist(): cmd = "%s/bfs_client put %s/data/urllist /put_file_1" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 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_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_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_list_file_exist(): cmd = "%s/bfs_client ls /new_file_1" % const.bfs_client_dir (ret1, out1, err1) = common.runcmd(cmd) nose.tools.assert_equal(ret1, 0) nose.tools.assert_equal(out1[0:14], "Found 1 items\n") cmd = "%s/bfs_client ls /new_dir/new_file_2" % const.bfs_client_dir (ret2, out2, err2) = common.runcmd(cmd) nose.tools.assert_equal(ret2, 0) nose.tools.assert_equal(out2[0:14], "Found 1 items\n") cmd = "%s/bfs_client ls /new_file_3" % const.bfs_client_dir (ret3, out3, err3) = common.runcmd(cmd) nose.tools.assert_equal(ret3, 0) nose.tools.assert_equal(out3[0:14], "Found 1 items\n") '''
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_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_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_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)
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_du_file_exist(): cmd = "%s/bfs_client mkdir /test_du_file_1" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client put %s/data/urllist /test_du_file_1/urllist" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client put %s/data/binfile /test_du_file_1/binfile" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client du /test_du_file_1/urllist" % const.bfs_client_dir (ret1, out1, err1) = common.runcmd(cmd) nose.tools.assert_equal(ret1, 0) nose.tools.assert_equal(out1, "/test_du_file_1/urllist\t40\nTotal:\t40\n") cmd = "%s/bfs_client du /test_du_file_2/binfile" % const.bfs_client_dir (ret2, out2, err2) = common.runcmd(cmd) nose.tools.assert_equal(ret2, 0) nose.tools.assert_equal(out2, "/test_du_file_1/binfile\t24\nTotal:\t24\n")
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_du_file_exist(): cmd = "%s/bfs_client mkdir /test_du_file_1" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client put %s/data/urllist /test_du_file_1/urllist" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client put %s/data/binfile /test_du_file_1/binfile" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client du /test_du_file_1/urllist" % const.bfs_client_dir (ret1, out1, err1) = common.runcmd(cmd) nose.tools.assert_equal(ret1, 0) nose.tools.assert_equal(out1, "/test_du_file_1/urllist\t40\nTotal:\t40\n") cmd = "%s/bfs_client du /test_du_file_2/binfile" % const.bfs_client_dir (ret2, out2, err2) = common.runcmd(cmd) nose.tools.assert_equal(ret2, 0) nose.tools.assert_equal(out2, "/test_du_file_1/binfile\t24\nTotal:\t24\n")
def test_move_file_samedir_samename(): cmd = "%s/bfs_client mkdir /test_move_file_4" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) cmd = "%s/bfs_client put %s/data/urllist /test_move_file_4/urllist" % ( const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert (ret == 0) cmd = "%s/bfs_client mv /test_move_file_4/urllist /test_move_file_4/urllist" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) cmd = "cat %s/data/urllist" % const.work_dir (ret1, out1, err1) = common.runcmd(cmd) assert (ret1 == 0) cmd = "%s/bfs_client cat /test_move_file_4/urllist" % const.bfs_client_dir (ret2, out2, err2) = common.runcmd(cmd) nose.tools.assert_equal(ret2, 0) nose.tools.assert_equal(out1, out2) '''
def test_move_file_samedir_samename(): cmd = "%s/bfs_client mkdir /test_move_file_4" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) cmd = "%s/bfs_client put %s/data/urllist /test_move_file_4/urllist" % (const.bfs_client_dir, const.work_dir) (ret, out, err) = common.runcmd(cmd) assert(ret == 0) cmd = "%s/bfs_client mv /test_move_file_4/urllist /test_move_file_4/urllist" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0) cmd = "cat %s/data/urllist" % const.work_dir (ret1, out1, err1) = common.runcmd(cmd) assert(ret1 == 0) cmd = "%s/bfs_client cat /test_move_file_4/urllist" % const.bfs_client_dir (ret2, out2, err2) = common.runcmd(cmd) nose.tools.assert_equal(ret2, 0) nose.tools.assert_equal(out1, out2) '''
def test_read_1G_file(): cmd = "%s/mark --mode=read --count=2 --thread=1 --seed=3 --file_size=1048576" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0)
def test_show_table(): common.print_debug_msg(3, "show and show(x) table") cmd = "./teracli show" common.runcmd(cmd) cmd = "./teracli showx" common.runcmd(cmd) cmd = "./teracli show table_test001" common.runcmd(cmd) cmd = "./teracli show table_test002" common.runcmd(cmd) cmd = "./teracli showx table_test001" common.runcmd(cmd) cmd = "./teracli showx table_test002" common.runcmd(cmd) cmd = "./teracli showschema table_test001" common.runcmd(cmd) cmd = "./teracli showschema table_test002" common.runcmd(cmd) cmd = "./teracli showschemax table_test001" common.runcmd(cmd) cmd = "./teracli showschemax table_test002" common.runcmd(cmd)
def setUp(): common.drop_table("filter_table") common.runcmd("./teracli create 'filter_table{lg0{cf0,cf1}}'")
def main(username, project): global open_tabs pyrax.set_setting('identity_type', 'rackspace') with open(os.path.expanduser('~/.bugminion'), 'r') as f: conf = json.loads(f.read()) pyrax.set_credentials(conf['access_key'], conf['secret_key'], region=conf['region'].upper()) conn = pyrax.connect_to_cloudfiles(region=conf['region'].upper()) container = conn.create_container(conf['container']) def find_reviews(search): global open_tabs for line in search.split('\n'): if len(line) < 1: continue d = json.loads(line.rstrip()) if d.get('id'): print ' --> %s' % d['id'] approvals = d['currentPatchSet'].get('approvals', []) for review in approvals: print (' %s: %s %s' %(review['by'].get('name'), review['type'], review['value'])) common.runcmd('chromium-browser ' 'https://review.openstack.org' '/#/q/%s,n,z' %(d['id'])) open_tabs += 1 # As a special case, always review things from the infra proposal bot # first search = common.runcmd('ssh review.openstack.org gerrit ' 'query --current-patch-set ' '--format=json \' ' 'owner:"OpenStack Proposal Bot" ' 'status:open project:openstack/%s\'' % project) find_reviews(search) # Read the most recent bug dump most_recent = common.get_most_recent_dump(container, project) most_recent_datestamp = most_recent.split('/')[1] print 'Using the dump from %s' % most_recent bug_list = json.loads(container.get_objects(prefix=most_recent)[0].get()) for priority in common.PRIORITIES: targets = bug_list.get(priority, []) for bug in targets: triages = common.triages(container, project, bug) if common.recently_triaged(triages): triage_data = json.loads( container.get_object(triages[-1]).get()) if triage_data['osic'] == 'y': bug_files = container.get_objects( prefix='%s-bug/%s' %(project, bug)) for f in bug_files: fname = f.name.split('/')[-1] if fname.find('-') != -1: continue else: bug_data = json.loads(f.get()) bug_data['date_created_dt'] = \ datetime.datetime.fromtimestamp( bug_data['date_created']) print BUG_REPORT % bug_data search = common.runcmd('ssh review.openstack.org gerrit ' 'query --current-patch-set ' '--format=json \'message:" %s" ' 'status:open project:openstack/%s\'' %(bug, project)) find_reviews(search) if open_tabs > 30: print print 'That\'s more than than thirty tabs!' print 'Press return for more...' sys.stdin.readline() open_tabs = 0 print print 'Done!'
def test_put_1M_file(): cmd = "%s/mark --mode=put --count=10 --thread=3 --seed=2 --file_size=1024" % const.bfs_client_dir (ret, out, err) = common.runcmd(cmd) nose.tools.assert_equal(ret, 0)