def run_test(zip_package): """ main """ logging.getLogger().setLevel(logging.DEBUG) install_config = InstallerConfig('3.3.3', True, False, False, zip_package, Path("/tmp/"), Path("/"), "127.0.0.1", "", False, False) inst = make_installer(install_config) if inst.calc_config_file_name().is_file(): inst.load_config() inst.cfg.interactive = False inst.stop_service() kill_all_processes() kill_all_processes() starter_mode = [ RunnerType.LEADER_FOLLOWER, RunnerType.ACTIVE_FAILOVER, RunnerType.CLUSTER ] # , # RunnerType.DC2DC] here __init__ will create stuff, TODO. for runner_type in starter_mode: assert runner_type runner = make_runner(runner_type, 'none', [], inst.cfg, inst, None) runner.cleanup() if inst.calc_config_file_name().is_file(): try: inst.un_install_debug_package() except: print('nothing to uninstall') inst.un_install_package() else: print('Cannot uninstall package without config.yml!') inst.cleanup_system()
def main(**kwargs): """ main """ kwargs['stress_upgrade'] = False kwargs['package_dir'] = Path(kwargs['package_dir']) kwargs['test_data_dir'] = Path(kwargs['test_data_dir']) kwargs['alluredir'] = Path(kwargs['alluredir']) kwargs['hb_cli_cfg'] = HotBackupCliCfg("disabled", "", "", "", "", "", "") kwargs['base_config'] = InstallerBaseConfig.from_dict(**kwargs) do_install = kwargs['mode'] in ["all", "install"] do_uninstall = kwargs['mode'] in ["all", "uninstall"] launch_dir = Path.cwd() if "WORKSPACE" in os.environ: launch_dir = Path(os.environ["WORKSPACE"]) if not kwargs['test_data_dir'].is_absolute(): kwargs['test_data_dir'] = launch_dir / kwargs['test_data_dir'] if not kwargs['test_data_dir'].exists(): kwargs['test_data_dir'].mkdir(parents=True, exist_ok=True) os.chdir(kwargs['test_data_dir']) if not kwargs['package_dir'].is_absolute(): kwargs['package_dir'] = (launch_dir / kwargs['package_dir']).resolve() if not kwargs['package_dir'].exists(): kwargs['package_dir'].mkdir(parents=True, exist_ok=True) init_allure(results_dir=kwargs['alluredir'], clean=kwargs['clean_alluredir'], zip_package=kwargs['zip_package']) lh.section("startup") install_config = InstallerConfig( kwargs['new_version'], kwargs['verbose'], kwargs['enterprise'], kwargs['encryption_at_rest'], kwargs['zip_package'], kwargs['src_testing'], kwargs['hb_cli_cfg'], kwargs['package_dir'], kwargs['test_data_dir'], kwargs['mode'], kwargs['publicip'], kwargs['interactive'], False, False) install_config.source = True inst = make_installer(install_config) inst.cfg.scenario = Path(kwargs['scenario']) runner = Testing(RunnerType.TESTING, False, inst, kwargs['selenium'], kwargs['selenium_driver_args'], "bla", False, False) runner.do_install = do_install runner.do_uninstall = do_uninstall failed = False if not runner.starter_prepare_env_impl(): failed = True if len(kwargs['frontends']) == 0: kill_all_processes() return 0 if not failed else 1
def __init__(self, version, verbose, package_dir, enterprise, enterprise_magic, zip_package, source, httpuser, httppassvoid, remote_host): """ main """ lh.section("configuration") print("version: " + str(version)) print("using enterpise: " + str(enterprise)) print("using zip: " + str(zip_package)) print("package directory: " + str(package_dir)) print("verbose: " + str(verbose)) self.user = httpuser self.passvoid = httppassvoid self.enterprise_magic = enterprise_magic if remote_host != "": self.remote_host = remote_host else: # dns split horizon... if source in ["ftp:stage1", "ftp:stage2"]: self.remote_host = "Nas02.arangodb.biz" else: self.remote_host = "fileserver.arangodb.com" lh.section("startup") if verbose: logging.info("setting debug level to debug (verbose)") logging.getLogger().setLevel(logging.DEBUG) self.package_dir = Path(package_dir) self.cfg = InstallerConfig( version, verbose, enterprise, False, # don't care for enc at rest zip_package, self.package_dir, Path("/"), "", "127.0.0.1", False, False) self.inst = make_installer(self.cfg) self.is_nightly = self.inst.semver.prerelease == "nightly" self.calculate_package_names() self.packages = []
def run_upgrade(old_version, new_version, verbose, package_dir, test_data_dir, enterprise, encryption_at_rest, zip_package, interactive, starter_mode, stress_upgrade, publicip, selenium, selenium_driver_args): """ execute upgrade tests """ lh.section("configuration") print("old version: " + str(old_version)) print("version: " + str(new_version)) print("using enterpise: " + str(enterprise)) print("using zip: " + str(zip_package)) print("package directory: " + str(package_dir)) print("starter mode: " + str(starter_mode)) print("public ip: " + str(publicip)) print("interactive: " + str(interactive)) print("verbose: " + str(verbose)) lh.section("startup") if verbose: logging.info("setting debug level to debug (verbose)") logging.getLogger().setLevel(logging.DEBUG) if starter_mode == 'all': starter_mode = [ RunnerType.LEADER_FOLLOWER, RunnerType.ACTIVE_FAILOVER, RunnerType.CLUSTER ] if enterprise: starter_mode.append(RunnerType.DC2DC) elif starter_mode == 'LF': starter_mode = [RunnerType.LEADER_FOLLOWER] elif starter_mode == 'AFO': starter_mode = [RunnerType.ACTIVE_FAILOVER] elif starter_mode == 'CL': starter_mode = [RunnerType.CLUSTER] elif starter_mode == 'DC': if enterprise: starter_mode = [RunnerType.DC2DC] else: starter_mode = [None] elif starter_mode == 'none': starter_mode = [None] else: raise Exception("invalid starter mode: " + starter_mode) for runner_type in starter_mode: install_config_old = InstallerConfig(old_version, verbose, enterprise, encryption_at_rest, zip_package, Path(package_dir), Path(test_data_dir), 'all', publicip, interactive, stress_upgrade) old_inst = make_installer(install_config_old) install_config_new = InstallerConfig(new_version, verbose, enterprise, encryption_at_rest, zip_package, Path(package_dir), Path(test_data_dir), 'all', publicip, interactive, stress_upgrade) new_inst = make_installer(install_config_new) install_config_old.add_frontend("http", "127.0.0.1", "8529") runner = None if runner_type: runner = make_runner(runner_type, selenium, selenium_driver_args, install_config_old, old_inst, install_config_new, new_inst) if runner: runner.run_selenium()
def run_test(old_version, new_version, verbose, package_dir, test_data_dir, enterprise, encryption_at_rest, zip_package, interactive, mode, starter_mode, publicip, selenium, selenium_driver_args): """ main """ lh.section("configuration") print("version: " + str(new_version)) print("using enterpise: " + str(enterprise)) print("using encryption at rest: " + str(encryption_at_rest)) print("using zip: " + str(zip_package)) print("package directory: " + str(package_dir)) print("mode: " + str(mode)) print("starter mode: " + str(starter_mode)) print("public ip: " + str(publicip)) print("interactive: " + str(interactive)) print("verbose: " + str(verbose)) if mode not in ['all', 'install', 'system', 'tests', 'uninstall']: raise Exception("unsupported mode %s!" % mode) do_install = mode in ["all", "install"] do_uninstall = mode in ["all", "uninstall"] lh.section("startup") if verbose: logging.info("setting debug level to debug (verbose)") logging.getLogger().setLevel(logging.DEBUG) install_config = InstallerConfig(new_version, verbose, enterprise, encryption_at_rest, zip_package, Path(package_dir), Path(test_data_dir), mode, publicip, interactive, False) inst = make_installer(install_config) if starter_mode == 'all': starter_mode = [ RunnerType.LEADER_FOLLOWER, RunnerType.ACTIVE_FAILOVER, RunnerType.CLUSTER ] if enterprise: starter_mode.append(RunnerType.DC2DC) elif starter_mode == 'LF': starter_mode = [RunnerType.LEADER_FOLLOWER] elif starter_mode == 'AFO': starter_mode = [RunnerType.ACTIVE_FAILOVER] elif starter_mode == 'CL': starter_mode = [RunnerType.CLUSTER] elif starter_mode == 'DC': starter_mode = [RunnerType.DC2DC] elif starter_mode == 'DCendurance': starter_mode = [RunnerType.DC2DCENDURANCE] elif starter_mode == 'none': starter_mode = [RunnerType.NONE] else: raise Exception("invalid starter mode: " + starter_mode) count = 1 for runner_type in starter_mode: assert runner_type runner = make_runner(runner_type, selenium, selenium_driver_args, inst.cfg, inst, None) # install on first run: runner.do_install = (count == 1) and do_install # only uninstall after the last test: runner.do_uninstall = (count == len(starter_mode)) and do_uninstall failed = False if not runner.run(): failed = True kill_all_processes() count += 1 return 0 if not failed else 1
def run_test(old_version, new_version, verbose, package_dir, test_data_dir, enterprise, encryption_at_rest, zip_package, interactive, mode, starter_mode, publicip, scenario, frontends, selenium, selenium_driver_args): """ main """ lh.section("configuration") print("version: " + str(new_version)) print("using enterpise: " + str(enterprise)) print("using zip: " + str(zip_package)) print("package directory: " + str(package_dir)) print("mode: " + str(mode)) print("starter mode: " + str(starter_mode)) print("public ip: " + str(publicip)) print("interactive: " + str(interactive)) print("scenario: " + str(scenario)) print("verbose: " + str(verbose)) if mode not in ['all', 'install', 'system', 'tests', 'uninstall']: raise Exception("unsupported mode %s!" % mode) do_install = mode in ["all", "install"] do_uninstall = mode in ["all", "uninstall"] lh.section("startup") if verbose: logging.info("setting debug level to debug (verbose)") logging.getLogger().setLevel(logging.DEBUG) install_config = InstallerConfig(new_version, verbose, enterprise, encryption_at_rest, zip_package, Path(package_dir), Path(test_data_dir), mode, publicip, interactive, False) split_host = re.compile(r'([a-z]*)://([0-9.:]*):(\d*)') inst = make_installer(install_config) if len(frontends) > 0: for frontend in frontends: print('remote') host_parts = re.split(split_host, frontend) inst.cfg.add_frontend(host_parts[1], host_parts[2], host_parts[3]) inst.cfg.scenario = Path(scenario) runner = ClusterPerf(RunnerType.CLUSTER, inst.cfg, inst, None, None, selenium, selenium_driver_args) runner.do_install = do_install runner.do_uninstall = do_uninstall failed = False if not runner.run(): failed = True if len(frontends) == 0: kill_all_processes() return 0 if not failed else 1
def __init__( self, options: DownloadOptions, hb_cli_cfg: HotBackupCliCfg, version: str, enterprise: bool, zip_package: bool, src_testing: bool, source, existing_version_states={}, new_version_states={}, git_version="", ): """main""" lh.section("configuration") self.launch_dir = Path.cwd() if "WORKSPACE" in os.environ: self.launch_dir = Path(os.environ["WORKSPACE"]) if not options.package_dir.is_absolute(): options.package_dir = (self.launch_dir / options.package_dir).resolve() print("version: " + str(version)) print("using enterpise: " + str(enterprise)) print("using zip: " + str(zip_package)) print("package directory: " + str(options.package_dir)) print("verbose: " + str(options.verbose)) self.options = options self.is_nightly = semver.VersionInfo.parse( version).prerelease == "nightly" self.source = source if not self.is_nightly and self.source == 'nightlypublic': self.source = 'public' if options.remote_host != "": # external DNS to wuerg around docker dns issues... self.remote_host = options.remote_host else: # dns split horizon... if source in ["ftp:stage1", "ftp:stage2"]: self.remote_host = "nas01.arangodb.biz" elif source in ["http:stage2"]: self.remote_host = "download.arangodb.com" else: self.remote_host = "download.arangodb.com" lh.section("startup") self.cfg = InstallerConfig( version=version, verbose=options.verbose, enterprise=enterprise, encryption_at_rest=False, zip_package=zip_package, src_testing=src_testing, hb_cli_cfg=hb_cli_cfg, package_dir=options.package_dir, test_dir=Path("/"), deployment_mode="all", publicip="127.0.0.1", interactive=False, stress_upgrade=False, ssl=False, ) self.inst = make_installer(self.cfg) self.path_architecture = "" if self.is_nightly or self.cfg.semver > semver.VersionInfo.parse( "3.9.99"): machine = platform.machine() if machine == 'AMD64': machine = 'x86_64' self.path_architecture = machine + '/' self.calculate_package_names() self.packages = [] self.existing_version_states = existing_version_states self.new_version_states = new_version_states self.version_content = None self.version_content = None if version.find("-nightly") >= 0: self.version_state_id = version + "_sourceInfo.log" if self.version_state_id in self.existing_version_states: self.version_content = self.existing_version_states[ self.version_state_id] self.fresh_content = self.get_version_info(git_version) self.new_version_states[self.version_state_id] = self.fresh_content