def upgrade_package_test( dl_opts: DownloadOptions, new_version, old_version, new_dlstage, old_dlstage, git_version, editions, test_driver ): """process fetch & tests""" test_driver.set_r_limits() lh.configure_logging(test_driver.base_config.verbose) list_all_processes() test_dir = test_driver.base_config.test_data_dir versions = {} fresh_versions = {} version_state_tar = get_tar_file_path( test_driver.launch_dir, [old_version, new_version], test_driver.get_packaging_shorthand() ) read_versions_tar(version_state_tar, versions) print(versions) results = [] # do the actual work: for props in EXECUTION_PLAN: print("Cleaning up" + props.testrun_name) test_driver.run_cleanup(props) print("Cleanup done") for props in EXECUTION_PLAN: if props.directory_suffix not in editions: continue # pylint: disable=unused-variable dl_old = Download( dl_opts, test_driver.base_config.hb_cli_cfg, old_version, props.enterprise, test_driver.base_config.zip_package, test_driver.base_config.src_testing, old_dlstage, versions, fresh_versions, git_version, ) dl_new = Download( dl_opts, test_driver.base_config.hb_cli_cfg, new_version, props.enterprise, test_driver.base_config.zip_package, test_driver.base_config.src_testing, new_dlstage, versions, fresh_versions, git_version, ) if not dl_new.is_different() or not dl_old.is_different(): print("we already tested this version. bye.") return 0 dl_old.get_packages(dl_old.is_different()) dl_new.get_packages(dl_new.is_different()) this_test_dir = test_dir / props.directory_suffix test_driver.reset_test_data_dir(this_test_dir) results.append(test_driver.run_upgrade([dl_old.cfg.version, dl_new.cfg.version], props)) for use_enterprise in [True, False]: results.append( test_driver.run_conflict_tests( [dl_old.cfg.version, dl_new.cfg.version], enterprise=use_enterprise, ) ) results.append( test_driver.run_license_manager_tests( [semver.VersionInfo.parse(dl_old.cfg.version), semver.VersionInfo.parse(dl_new.cfg.version)] ) ) results.append( test_driver.run_debugger_tests( [semver.VersionInfo.parse(dl_old.cfg.version), semver.VersionInfo.parse(dl_new.cfg.version)], run_props=RunProperties(True, False, False), ) ) results.append( test_driver.run_debugger_tests( [semver.VersionInfo.parse(dl_old.cfg.version), semver.VersionInfo.parse(dl_new.cfg.version)], run_props=RunProperties(False, False, False), ) ) print("V" * 80) status = True table = BeautifulTable(maxwidth=140) for one_suite_result in results: if len(one_suite_result) > 0: for one_result in one_suite_result: if one_result["success"]: table.rows.append( [ one_result["testrun name"], one_result["testscenario"], # one_result['success'], "\n".join(one_result["messages"]), ] ) else: table.rows.append( [ one_result["testrun name"], one_result["testscenario"], # one_result['success'], "\n".join(one_result["messages"]) + "\n" + "H" * 40 + "\n" + one_result["progress"], ] ) status = status and one_result["success"] table.columns.header = [ "Testrun", "Test Scenario", # 'success', we also have this in message. "Message + Progress", ] table.columns.alignment["Message + Progress"] = ALIGN_LEFT tablestr = str(table) Path("testfailures.txt").write_text(tablestr, encoding="utf8") if not status: print("exiting with failure") sys.exit(1) if dl_opts.force: touch_all_tars_in_dir(version_state_tar) else: write_version_tar(version_state_tar, fresh_versions) print(tablestr) return 0
def upgrade_package_test( dl_opts: DownloadOptions, primary_version: str, primary_dlstage: str, upgrade_matrix: str, other_source, git_version, editions, test_driver, ): """process fetch & tests""" test_driver.set_r_limits() lh.configure_logging(test_driver.base_config.verbose) list_all_processes() test_dir = test_driver.base_config.test_data_dir versions = {} fresh_versions = {} results = [] new_versions = [] old_versions = [] old_dlstages = [] new_dlstages = [] for version_pair in upgrade_matrix.split(";"): print("Adding: '" + version_pair + "'") old, new = version_pair.split(":") old_versions.append(old) new_versions.append(new) if old == primary_version: old_dlstages.append(primary_dlstage) new_dlstages.append(other_source) else: old_dlstages.append(other_source) new_dlstages.append(primary_dlstage) for default_props in EXECUTION_PLAN: props = copy(default_props) props.testrun_name = "test_" + props.testrun_name props.directory_suffix = props.directory_suffix + "_t" test_driver.run_cleanup(props) print("Cleanup done") if props.directory_suffix not in editions: continue # pylint: disable=unused-variable dl_new = Download( dl_opts, test_driver.base_config.hb_cli_cfg, primary_version, props.enterprise, test_driver.base_config.zip_package, test_driver.base_config.src_testing, primary_dlstage, versions, fresh_versions, git_version, ) dl_new.get_packages(dl_opts.force) this_test_dir = test_dir / props.directory_suffix test_driver.reset_test_data_dir(this_test_dir) results.append(test_driver.run_test("all", [dl_new.cfg.version], props)) # pylint: disable=consider-using-enumerate for j in range(len(new_versions)): for props in EXECUTION_PLAN: print("Cleaning up" + props.testrun_name) test_driver.run_cleanup(props) print("Cleanup done now running upgrade: " + str(old_versions[j]) + " -> " + new_versions[j]) # Configure Chrome to accept self-signed SSL certs and certs signed by unknown CA. # FIXME: Add custom CA to Chrome to properly validate server cert. # if props.ssl: # selenium_driver_args += ("ignore-certificate-errors",) for props in EXECUTION_PLAN: if props.directory_suffix not in editions: print("skipping " + props.directory_suffix) continue # pylint: disable=unused-variable dl_old = Download( dl_opts, test_driver.base_config.hb_cli_cfg, old_versions[j], props.enterprise, test_driver.base_config.zip_package, test_driver.base_config.src_testing, old_dlstages[j], versions, fresh_versions, git_version, ) dl_new = Download( dl_opts, test_driver.base_config.hb_cli_cfg, new_versions[j], props.enterprise, test_driver.base_config.zip_package, test_driver.base_config.src_testing, new_dlstages[j], versions, fresh_versions, git_version, ) dl_old.get_packages(dl_opts.force) dl_new.get_packages(dl_opts.force) this_test_dir = test_dir / props.directory_suffix test_driver.reset_test_data_dir(this_test_dir) results.append(test_driver.run_upgrade([dl_old.cfg.version, dl_new.cfg.version], props)) for use_enterprise in [True, False]: results.append( test_driver.run_conflict_tests( [dl_old.cfg.version, dl_new.cfg.version], enterprise=use_enterprise, ) ) results.append( test_driver.run_license_manager_tests( [semver.VersionInfo.parse(dl_old.cfg.version), semver.VersionInfo.parse(dl_new.cfg.version)] ) ) results.append( test_driver.run_debugger_tests( [semver.VersionInfo.parse(dl_old.cfg.version), semver.VersionInfo.parse(dl_new.cfg.version)], run_props=RunProperties(True, False, False), ) ) results.append( test_driver.run_debugger_tests( [semver.VersionInfo.parse(dl_old.cfg.version), semver.VersionInfo.parse(dl_new.cfg.version)], run_props=RunProperties(False, False, False), ) ) print("V" * 80) status = True table = BeautifulTable(maxwidth=140) for one_suite_result in results: if len(one_suite_result) > 0: for one_result in one_suite_result: if one_result["success"]: table.rows.append( [ one_result["testrun name"], one_result["testscenario"], # one_result['success'], "\n".join(one_result["messages"]), ] ) else: # pylint: disable=broad-except try: table.rows.append( [ one_result["testrun name"], one_result["testscenario"], # one_result['success'], "\n".join(one_result["messages"]) + "\n" + "H" * 40 + "\n" + one_result["progress"], ] ) except Exception as ex: print("result error while syntesizing " + str(one_result)) print(ex) status = status and one_result["success"] table.columns.header = [ "Testrun", "Test Scenario", # 'success', we also have this in message. "Message + Progress", ] table.columns.alignment["Message + Progress"] = ALIGN_LEFT tablestr = str(table) Path("testfailures.txt").write_text(tablestr, encoding="utf8") if not status: print("exiting with failure") sys.exit(1) print(tablestr) return 0