def gate_ostf_update(self): """ Update ostf start on deployed cluster Scenario: 1. Revert snapshot "gate_ostf_ceph_ha" 2. Update ostf 3. Check ceph cluster health 4. Run ostf Duration 35m """ if not settings.UPDATE_FUEL: raise exceptions.ConfigurationException( 'Variable "UPDATE_FUEL" was not set to true') self.show_step(1, initialize=True) if not self.env.revert_snapshot('gate_ostf_ceph_ha'): raise SkipTest('Snapshot gate_ostf_ceph_ha not found') self.show_step(2) update_ostf() cluster_id = self.fuel_web.get_last_created_cluster() self.show_step(3) self.fuel_web.check_ceph_status(cluster_id, recovery_timeout=500) self.show_step(4) all_test_suits = self.fuel_web.get_all_ostf_set_names(cluster_id) test_to_execute = [ suite for suite in all_test_suits if suite not in ['configuration'] ] self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=test_to_execute, should_fail=5, failed_test_name=self.tests_to_skip)
def gate_ostf_update(self): """ Update ostf start on deployed cluster Scenario: 1. Revert snapshot "gate_ostf_ceph_ha" 2. Update ostf 3. Run ostf Duration 35m """ if not settings.UPDATE_FUEL: raise exceptions.ConfigurationException( 'Variable "UPDATE_FUEL" was not set to true') self.show_step(1, initialize=True) if not self.env.revert_snapshot( 'gate_ostf_ceph_ha'): raise SkipTest() self.show_step(2) update_ostf() cluster_id = self.fuel_web.get_last_created_cluster() self.show_step(3) all_test_suits = self.fuel_web.get_all_ostf_set_names(cluster_id) # Temporary do not execute platform # test until https://bugs.launchpad.net/fuel/+bug/1544179 fixed # TODO(tleontovich) enable platform test after fix LP1544179 test_to_execute = [ suite for suite in all_test_suits if suite not in ['configuration', 'tests_platform']] self.fuel_web.run_ostf( cluster_id=cluster_id, test_sets=test_to_execute)
def update_ostf(environment): try: if not settings.UPDATE_FUEL: raise exceptions.ConfigurationException( 'Variable "UPDATE_FUEL" was not set to true') logger.info("Uploading new package from {0}" .format(settings.UPDATE_FUEL_PATH)) pack_path = '/var/www/nailgun/fuel-ostf/' container = 'ostf' full_pack_path = os.path.join(pack_path, '*.rpm') with environment.d_env.get_admin_remote() as remote: remote.upload(settings.UPDATE_FUEL_PATH.rstrip('/'), pack_path) cmd = "service ostf stop" environment.base_actions.execute_in_container( cmd, container) cmd = "service ostf status" helpers.wait( lambda: "dead" in environment.base_actions.execute_in_container( cmd, container), timeout=60) logger.info("OSTF status: inactive") cmd = "rpm -e fuel-ostf" environment.base_actions.execute_in_container( cmd, container, exit_code=0) cmd = "rpm -Uvh --oldpackage {0}".format( full_pack_path) environment.base_actions.execute_in_container( cmd, container, exit_code=0) cmd = "rpm -q fuel-ostf" installed_package = \ environment.base_actions.execute_in_container( cmd, container) cmd = "rpm -qp {0}".format(full_pack_path) new_package = \ environment.base_actions.execute_in_container( cmd, container) assert_equal(installed_package, new_package, "The new package {0} was not installed". format(new_package)) cmd = "service ostf start" environment.base_actions.execute_in_container( cmd, container) cmd = "service ostf status" helpers.wait( lambda: "running" in environment.base_actions.execute_in_container( cmd, container, exit_code=0), timeout=60) cmd = "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8777" helpers.wait( lambda: "401" in environment.base_actions.execute_in_container( cmd, container), timeout=60) logger.info("OSTF status: RUNNING") except Exception as e: logger.error("Could not update OSTF: {e}".format(e=e)) raise
def upload_package(remote, target_path, package_name): logger.info('Copy changes') try: remote.upload(UPDATE_FUEL_PATH.rstrip('/'), target_path) except OSError: logger.debug(traceback.format_exc()) raise exceptions.ConfigurationException( 'Can not find {0}, ' 'please check exported variables'.format(UPDATE_FUEL_PATH)) cmd = "ls -all {0} | grep {1}".format(target_path, package_name) remote.check_call( cmd, error_info='Can not upload changes to master node.')
def upload_package(remote, target_path, package_name): logger.info('Copy changes') try: remote.upload(UPDATE_FUEL_PATH.rstrip('/'), target_path) except OSError: logger.debug(traceback.format_exc()) raise exceptions.ConfigurationException( 'Can not find {0}, ' 'please check exported variables'.format(UPDATE_FUEL_PATH)) cmd = "ls -all {0} | grep {1}".format(target_path, package_name) result = remote.execute(cmd) asserts.assert_equal( 0, result['exit_code'], 'Can not upload changes to master node. ' 'Command {0} failed with {1}'.format(cmd, result))
def gate_ostf_update(self): """ Update ostf start on deployed cluster Scenario: 1. Revert snapshot "gate_ostf_ceph_ha" 2. Update ostf 3. Run ostf Duration 35m """ if not settings.UPDATE_FUEL: raise exceptions.ConfigurationException( 'Variable "UPDATE_FUEL" was not set to true') self.show_step(1, initialize=True) if not self.env.revert_snapshot('gate_ostf_ceph_ha'): raise SkipTest() self.show_step(2) update_ostf(self.env) cluster_id = self.fuel_web.get_last_created_cluster() self.show_step(3) self.fuel_web.run_ostf( cluster_id=cluster_id, test_sets=self.fuel_web.get_all_ostf_set_names(cluster_id))