def test_ntp_server_check(request, appliance, ntp_servers_keys): request.addfinalizer(partial(clear_ntp_settings, appliance)) orig_date = appliance_date(appliance) past_date = orig_date - timedelta(days=10) logger.info("dates: orig_date - %s, past_date - %s", orig_date, past_date) status, result = appliance.ssh_client.run_command( "date +%Y%m%d -s \"{}\"".format(past_date.strftime('%Y%m%d'))) new_date = appliance_date(appliance) if new_date != orig_date: logger.info("Successfully modified the date in the appliance") # Configuring the ntp server and restarting the appliance # checking if ntp property is available, adding if it is not available appliance.server.settings.update_ntp_servers(dict(zip( ntp_servers_keys, [ntp_server for ntp_server in cfme_data['clock_servers']]))) yaml_config = appliance.get_yaml_config() ntp = yaml_config.get("ntp") if not ntp: yaml_config["ntp"] = {} # adding the ntp interval to 1 minute and updating the configuration yaml_config["ntp"]["interval"] = '1.minutes' appliance.set_yaml_config(yaml_config) # restarting the evmserverd for NTP to work appliance.restart_evm_service(rude=True) appliance.wait_for_web_ui(timeout=1200) # Incase if ntpd service is stopped appliance.ssh_client.run_command("service chronyd restart") # Providing two hour runtime for the test run to avoid day changing problem # (in case if the is triggerred in the midnight) wait_for( lambda: (orig_date - appliance_date(appliance)).total_seconds() <= 7200, num_sec=300) else: raise Exception("Failed modifying the system date") # Calling the browser quit() method to compensate the session after the evm service restart quit()
def step(self): # Can be either blank or logged in del self.view # In order to unbind the browser quit() ensure_browser_open(self.obj.appliance.server.address()) if not self.view.is_displayed: raise Exception('Could not open the login screen')
def test_ntp_server_check(request, appliance, ntp_servers_keys, empty_ntp_dict): request.addfinalizer(lambda: appliance.server.settings.update_ntp_servers(empty_ntp_dict)) orig_date = appliance_date(appliance) past_date = orig_date - timedelta(days=10) logger.info("dates: orig_date - %s, past_date - %s", orig_date, past_date) appliance.ssh_client.run_command("date +%Y%m%d -s \"{}\"" .format(past_date.strftime('%Y%m%d'))) new_date = appliance_date(appliance) if new_date != orig_date: logger.info("Successfully modified the date in the appliance") # Configuring the ntp server and restarting the appliance # checking if ntp property is available, adding if it is not available appliance.server.settings.update_ntp_servers(dict(zip( ntp_servers_keys, [ntp_server for ntp_server in cfme_data['clock_servers']]))) # adding the ntp interval to 1 minute and updating the configuration ntp_settings = appliance.advanced_settings.get('ntp', {}) # should have the servers in it ntp_settings['interval'] = '1.minutes' # just modify interval appliance.update_advanced_settings({'ntp': ntp_settings}) # restarting the evmserverd for NTP to work appliance.restart_evm_service(rude=True) appliance.wait_for_web_ui(timeout=1200) # Incase if ntpd service is stopped appliance.ssh_client.run_command("service chronyd restart") # Providing two hour runtime for the test run to avoid day changing problem # (in case if the is triggerred in the midnight) wait_for( lambda: (orig_date - appliance_date(appliance)).total_seconds() <= 7200, num_sec=300) else: raise Exception("Failed modifying the system date") # Calling the browser quit() method to compensate the session after the evm service restart quit()
def step(self): # Can be either blank or logged in del self.view # In order to unbind the browser quit() ensure_browser_open(self.obj.appliance.server.address()) if not self.view.is_displayed: raise Exception('Could not open the login screen')
def step(self): # Can be either blank or logged in from cfme.utils import browser logged_in_view = self.create_view(BaseLoggedInPage) if logged_in_view.logged_in: logged_in_view.logout() if not self.view.is_displayed: # Something is wrong del self.view # In order to unbind the browser browser.quit() browser.ensure_browser_open(self.obj.appliance.server.address()) if not self.view.is_displayed: raise Exception('Could not open the login screen')
def step(self): # Can be either blank or logged in from cfme.utils import browser logged_in_view = self.create_view(BaseLoggedInPage) if logged_in_view.logged_in: logged_in_view.logout() if not self.view.is_displayed: # Something is wrong del self.view # In order to unbind the browser browser.quit() browser.ensure_browser_open(self.obj.appliance.server.address()) if not self.view.is_displayed: raise Exception('Could not open the login screen')
def test_ntp_server_check(request, appliance, ntp_servers_keys, empty_ntp_dict): """ Polarion: assignee: tpapaioa initialEstimate: 1/4h casecomponent: Configuration """ request.addfinalizer( lambda: appliance.server.settings.update_ntp_servers(empty_ntp_dict)) orig_date = appliance_date(appliance) past_date = orig_date - timedelta(days=10) logger.info("dates: orig_date - %s, past_date - %s", orig_date, past_date) appliance.ssh_client.run_command("date +%Y%m%d -s \"{}\"".format( past_date.strftime('%Y%m%d'))) new_date = appliance_date(appliance) if new_date != orig_date: logger.info("Successfully modified the date in the appliance") # Configuring the ntp server and restarting the appliance # checking if ntp property is available, adding if it is not available appliance.server.settings.update_ntp_servers( dict( list( zip(ntp_servers_keys, [ ntp_server for ntp_server in cfme_data['clock_servers'] ])))) # adding the ntp interval to 1 minute and updating the configuration ntp_settings = appliance.advanced_settings.get( 'ntp', {}) # should have the servers in it ntp_settings['interval'] = '1.minutes' # just modify interval appliance.update_advanced_settings({'ntp': ntp_settings}) # restarting the evmserverd for NTP to work appliance.restart_evm_rude() appliance.wait_for_web_ui(timeout=1200) # Incase if ntpd service is stopped appliance.ssh_client.run_command("service chronyd restart") # Providing two hour runtime for the test run to avoid day changing problem # (in case if the is triggerred in the midnight) wait_for( lambda: (orig_date - appliance_date(appliance)).total_seconds() <= 7200, num_sec=300) else: raise Exception("Failed modifying the system date") # Calling the browser quit() method to compensate the session after the evm service restart quit()
def _finalize(): quit() ensure_browser_open() auth_settings.set_session_timeout(hours="24", minutes="0")
def pytest_runtest_teardown(item, nextitem): if item.config.getoption('sauce'): from cfme.utils.browser import ensure_browser_open, quit, browser ensure_browser_open() browser().execute_script(f"sauce:job-name={item.name}") quit()
def _finalize(): quit() ensure_browser_open() auth_settings.set_session_timeout(hours="24", minutes="0")
def pytest_runtest_teardown(item, nextitem): if item.config.getoption('sauce'): from cfme.utils.browser import ensure_browser_open, quit, browser ensure_browser_open() browser().execute_script("sauce:job-name={}".format(item.name)) quit()
def nuke_browser_after_test(): """Some more disruptive tests have to take this measure.""" yield browser_module.quit() ensure_browser_open()
def nuke_browser_after_test(): """Some more disruptive tests have to take this measure.""" yield browser_module.quit() ensure_browser_open()