Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MB-100: fix indentation, line breaks and white spaces in testrunner

Change-Id: Ib0e92f25c623a8fb71a5c373667c75223551e76a
Reviewed-on: http://review.couchbase.org/22763
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
  • Loading branch information...
commit 0d6b0558f7993d8eddcd99d09fd0bb7b9a60391d 1 parent 79ab269
@pavel-paulau pavel-paulau authored
Showing with 20 additions and 11 deletions.
  1. +20 −11 testrunner
View
31 testrunner
@@ -83,7 +83,8 @@ def parse_args(argv):
print("\n".join(tests))
sys.exit(0)
- return tests, test_params, options.ini, options.params , options
+ return tests, test_params, options.ini, options.params, options
+
def create_log_file(log_config_file_name, log_file_name, level):
tmpl_log_file = open("logging.conf.sample")
@@ -96,6 +97,7 @@ def create_log_file(log_config_file_name, log_file_name, level):
log_file.close()
tmpl_log_file.close()
+
def append_test(tests, name):
prefix = ".".join(name.split(".")[0:-1])
if name.find('*') > 0:
@@ -104,6 +106,7 @@ def append_test(tests, name):
else:
tests.append(name)
+
def locate_conf_file(filename):
print "filename:%s" % filename
if filename:
@@ -113,6 +116,7 @@ def locate_conf_file(filename):
return file("conf/" + filename)
return None
+
def parse_conf_file(filename, tests, params):
"""
Parse a configuration file.
@@ -166,12 +170,14 @@ def parse_conf_file(filename, tests, params):
params['conf_file'] = filename
+
def create_headers(username, password):
authorization = base64.encodestring('%s:%s' % (username, password))
return {'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic %s' % authorization,
'Accept': '*/*'}
+
def get_server_logs(input, path):
diag_name = uuid.uuid4()
@@ -183,7 +189,7 @@ def get_server_logs(input, path):
try:
req = urllib2.Request(diag_url)
req.headers = create_headers(input.membase_settings.rest_username,
- input.membase_settings.rest_password)
+ input.membase_settings.rest_password)
filename = "{0}/{1}-{2}-diag.txt".format(path, diag_name, server.ip)
page = urllib2.urlopen(req)
with open(filename, 'wb') as output:
@@ -209,6 +215,7 @@ def get_server_logs(input, path):
except Exception as e:
print "unable to obtain diags from %s %s" % (diag_url, e)
+
def get_cbcollect_info(input, path):
for server in input.servers:
print "grabbing cbcollect from {0}".format(server.ip)
@@ -218,6 +225,7 @@ def get_cbcollect_info(input, path):
except:
print "IMPOSSIBLE TO GRAB CBCOLLECT FROM {0}".format(server.ip)
+
# This little code snippet is from
# http://greenteapress.com/semaphores/threading_cleanup.py (2012-07-31)
# It's now possible to interrupt the testrunner via ctrl-c at any time
@@ -237,7 +245,7 @@ def watcher():
if __name__ == "__main__":
watcher()
- names, test_params, arg_i, arg_p , options = parse_args(sys.argv)
+ names, test_params, arg_i, arg_p, options = parse_args(sys.argv)
TestInputSingleton.input = TestInputParser.get_test_input(sys.argv) # get params from command line
test_params.update(TestInputSingleton.input.test_params) # ensure command line params get higher priority
TestInputSingleton.input.test_params = test_params
@@ -273,9 +281,9 @@ if __name__ == "__main__":
if ("GROUP" or "EXCLUDE_GROUP") in test_params:
#determine if the test relates to the specified group(can be separated by ';')
if not ("GROUP" in params and len(set(test_params["GROUP"].split(";")) & set(params["GROUP"].split(";")))) or \
- "EXCLUDE_GROUP" in params and len(set(test_params["EXCLUDE_GROUP"].split(";")) & set(params["EXCLUDE_GROUP"].split(";"))) :
- print "test '{0}' was skipped".format(name)
- continue
+ "EXCLUDE_GROUP" in params and len(set(test_params["EXCLUDE_GROUP"].split(";")) & set(params["EXCLUDE_GROUP"].split(";"))):
+ print "test '{0}' was skipped".format(name)
+ continue
log_config_filename = ""
if params:
@@ -327,7 +335,8 @@ if __name__ == "__main__":
errors.append(error_string)
break
xunit.add_test(name=name, status='fail', time=time_taken,
- errorType='membase.error', errorMessage=str(errors), params=params)
+ errorType='membase.error', errorMessage=str(errors),
+ params=params)
results.append({"result": "fail", "name": name})
else:
xunit.add_test(name=name, time=time_taken, params=params)
@@ -337,9 +346,9 @@ if __name__ == "__main__":
print "testrunner logs, diags and results are available under {0}".format(logs_folder)
case_number += 1
if (result.failures or result.errors) and \
- TestInputSingleton.input.param("stop-on-failure", False):
- print "test fails, all of the following tests will be skipped!!!"
- break
+ TestInputSingleton.input.param("stop-on-failure", False):
+ print "test fails, all of the following tests will be skipped!!!"
+ break
if "makefile" in TestInputSingleton.input.test_params:
#print out fail for those tests which failed and do sys.exit() error code
@@ -349,6 +358,6 @@ if __name__ == "__main__":
print result["name"], " fail "
fail_count += 1
else:
- print result["name"], " pass"
+ print result["name"], " pass"
if fail_count > 0:
sys.exit(1)
Please sign in to comment.
Something went wrong with that request. Please try again.