Esempio n. 1
0
def run_headless(ctx, spec_tests_directory, workload_executor, db_username,
                 db_password, org_name, project_name, cluster_name_salt,
                 polling_timeout, polling_frequency, xunit_output, no_delete,
                 startup_time):
    """
    Run multiple APM tests in serial.
    This command runs all tests found in the SPEC_TESTS_DIRECTORY sequentially
    on an Atlas cluster.
    """
    # Step-0: construct test configuration object and log configuration.
    config = TestCaseConfiguration(organization_name=org_name,
                                   project_name=project_name,
                                   name_salt=cluster_name_salt,
                                   polling_timeout=polling_timeout,
                                   polling_frequency=polling_frequency,
                                   database_username=unquote_plus(db_username),
                                   database_password=unquote_plus(db_password),
                                   workload_executor=workload_executor)
    LOGGER.info(tabulate_astrolabe_configuration(config))

    # Step-1: create the Test-Runner.
    runner = MultiTestRunner(client=ctx.obj,
                             test_locator_token=spec_tests_directory,
                             configuration=config,
                             xunit_output=xunit_output,
                             persist_clusters=no_delete,
                             workload_startup_time=startup_time)

    # Step-2: run the tests.
    failed = runner.run()

    if failed:
        exit(1)
    else:
        exit(0)
Esempio n. 2
0
def run_single_test(ctx, spec_test_file, workload_executor, db_username,
                    db_password, org_name, project_name, cluster_name_salt,
                    polling_timeout, polling_frequency, xunit_output,
                    no_delete, startup_time):
    """
    Runs one APM test.
    This is the main entry point for running APM tests in headless environments.
    This command runs the test found in the SPEC_TEST_FILE.
    """
    # Step-0: construct test configuration object and log configuration.
    config = TestCaseConfiguration(organization_name=org_name,
                                   project_name=project_name,
                                   name_salt=cluster_name_salt,
                                   polling_timeout=polling_timeout,
                                   polling_frequency=polling_frequency,
                                   database_username=unquote_plus(db_username),
                                   database_password=unquote_plus(db_password),
                                   workload_executor=workload_executor)
    LOGGER.info(tabulate_astrolabe_configuration(config))

    # Step-1: create the Test-Runner.
    runner = SingleTestRunner(client=ctx.obj,
                              test_locator_token=spec_test_file,
                              configuration=config,
                              xunit_output=xunit_output,
                              persist_clusters=no_delete,
                              workload_startup_time=startup_time)

    # Step-2: run the tests.
    failed = runner.run()

    if failed:
        exit(1)
    else:
        exit(0)