tests: Recover from server restart during installation

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2018-03-29 14:40:38 +05:30 committed by James Valleroy
parent 42e2995abc
commit c382df927a
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 16 additions and 4 deletions

View File

@ -66,10 +66,22 @@ def install(browser, app_name):
browser.is_element_present_by_css(selector)
for selector in selectors)
def is_server_restarting():
return browser.is_element_present_by_css('.neterror')
def wait_for_install():
if install_in_progress():
sleep(1)
elif is_server_restarting():
sleep(1)
browser.visit(browser.url)
else:
return
wait_for_install()
if install:
install.click()
while install_in_progress():
sleep(1)
wait_for_install()
sleep(2) # XXX This shouldn't be required.
@ -91,7 +103,7 @@ def disable(browser, app_name):
def wait_for_config_update(browser, app_name):
while len(browser.find_by_css('.running-status.loading')) != 0:
while browser.is_element_present_by_css('.running-status.loading'):
sleep(0.1)

View File

@ -42,7 +42,7 @@ def is_available(browser, site_name):
browser.visit(config['DEFAULT']['url'] + get_site_url(site_name))
sleep(3)
browser.reload()
return browser.title != '404 Not Found'
return '404' not in browser.title
def access_url(browser, site_name):