def main() -> int: parser = argparse.ArgumentParser() parser.add_argument('test_name', type=str) parser.add_argument('--clean-up-first', action='store_true', default=False) parser.add_argument('--bless', action='store_true', default=False) if 'PLZ_HOST' in os.environ: plz_host = os.environ['PLZ_HOST'] if 'PLZ_PORT' not in os.environ: raise ValueError('PLZ_HOST is defined but PLZ_PORT is not!') plz_port = int(os.environ['PLZ_PORT']) network = get_network() else: plz_host = 'localhost' plz_port = 5123 network = 'host' test_utils.print_warning( f'Using default controller host and port: {plz_host}:{plz_port} ' '(outside docker)') options = parser.parse_args(sys.argv[1:]) if options.clean_up_first: test_utils.cleanup(interrupted=False) signal.signal(signal.SIGTERM, test_utils.sig_cleanup) with test_utils.DoCleanupContextManager() as cleanup_context: try: success = run_end_to_end_test(network, plz_host, plz_port, options.test_name, options.bless) return 0 if success else 1 except InterruptedError: cleanup_context.interrupted = True raise
def print_test_summary(succeed_playbooks, failed_playbooks, skipped_tests, skipped_integration): succeed_count = len(succeed_playbooks) failed_count = len(failed_playbooks) skipped_count = len(skipped_tests) print('\nTEST RESULTS:') print('\t Number of playbooks tested - ' + str(succeed_count + failed_count)) print_color('\t Number of succeeded tests - ' + str(succeed_count), LOG_COLORS.GREEN) if len(skipped_integration) > 0: print_warning('\t Number of skipped integration - ' + str(len(skipped_integration)) + ':') for playbook_id in skipped_integration: print_warning('\t - ' + playbook_id) if skipped_count > 0: print_warning('\t Number of skipped tests - ' + str(skipped_count) + ':') for playbook_id in skipped_tests: print_warning('\t - ' + playbook_id) if failed_count > 0: print_error('\t Number of failed tests - ' + str(failed_count) + ':') for playbook_id in failed_playbooks: print_error('\t - ' + playbook_id)