Commit bcb094e6 authored by Ivan Tyagov's avatar Ivan Tyagov

do quit browser asap as we have results. this is required in case

of timeout of remote appium service which will close test session
if no command received within  usually 90s and thus fail this
script. And it costs processing time as well to keep test session needlessly opened.
parent 8930583d
...@@ -118,6 +118,7 @@ def main(): ...@@ -118,6 +118,7 @@ def main():
appium_url = "http://%s@ondemand.saucelabs.com/wd/hub" % (args.appium_server_auth) appium_url = "http://%s@ondemand.saucelabs.com/wd/hub" % (args.appium_server_auth)
browser = webdriver.Remote(appium_url, capabilities) browser = webdriver.Remote(appium_url, capabilities)
is_browser_running = True
full_path = '$${runTestSuite-instance:buildout-directory}/software_release/parts/%s' % parsed_parameters['test-url'] full_path = '$${runTestSuite-instance:buildout-directory}/software_release/parts/%s' % parsed_parameters['test-url']
full_path = full_path.split('srv')[-1] full_path = full_path.split('srv')[-1]
url = "%s%s" % (args.frontend_url, full_path) url = "%s%s" % (args.frontend_url, full_path)
...@@ -158,6 +159,13 @@ def main(): ...@@ -158,6 +159,13 @@ def main():
'html_test_result': etree.tostring(elt.xpath('.//ol')[0]) 'html_test_result': etree.tostring(elt.xpath('.//ol')[0])
} }
# do quit browser asap as we have results. this is required in case of timeout of
# remote appium service which will close test session of no command received within
# usually 90s and thus fail this script. And it costs processing time as well
# to keep test session needlessly opened.
browser.quit()
is_browser_running = False
tool = taskdistribution.TaskDistributionTool(portal_url=args.master_url) tool = taskdistribution.TaskDistributionTool(portal_url=args.master_url)
test_result = tool.createTestResult(revision = revision, test_result = tool.createTestResult(revision = revision,
test_name_list = test_line_dict.keys(), test_name_list = test_line_dict.keys(),
...@@ -189,7 +197,8 @@ def main(): ...@@ -189,7 +197,8 @@ def main():
raise EnvironmentError(result) raise EnvironmentError(result)
finally: finally:
browser.quit() if is_browser_running:
browser.quit()
if __name__ == "__main__": if __name__ == "__main__":
main() main()
...@@ -107,7 +107,7 @@ mode = 0644 ...@@ -107,7 +107,7 @@ mode = 0644
[template-runTestSuite] [template-runTestSuite]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/runTestSuite.in url = ${:_profile_base_location_}/runTestSuite.in
md5sum = 777751601384344984c2759155d9bf99 md5sum = 020f67ccfdf51a529579ab629cd9afe4
output = ${buildout:directory}/runTestSuite.in output = ${buildout:directory}/runTestSuite.in
mode = 0644 mode = 0644
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment