Example #1
0
def run_testing():
    """Entry point for testing test runner."""
    options = [
        "--with-resources",
        "--with-scenarios",
        "--with-select",
        "--select-dir=src/maastesting",
        "--cover-package=maastesting",
        "--cover-branches",
    ]
    inject_test_options(options)
    update_environ()
    init_asyncio_reactor()
    test_main()
Example #2
0
def run_cli():
    """Entry point for CLI test runner."""
    options = [
        "--with-resources",
        "--with-scenarios",
        "--with-select",
        "--select-dir=src/apiclient",
        "--select-dir=src/maascli",
        "--cover-package=apiclient,maascli",
        "--cover-branches",
    ]
    inject_test_options(options)
    update_environ()
    test_main()
Example #3
0
def run_rack():
    """Entry point for rack test runner."""
    options = [
        "--with-crochet",
        "--crochet-no-setup",
        "--with-resources",
        "--with-scenarios",
        "--with-select",
        "--select-dir=src/provisioningserver",
        "--cover-package=provisioningserver",
        "--cover-branches",
    ]
    inject_test_options(options)
    update_environ()
    init_asyncio_reactor()
    test_main()
Example #4
0
def run_region():
    """Entry point for region test runner."""
    options = [
        "--with-crochet",
        "--with-resources",
        "--with-scenarios",
        "--with-select",
        "--select-dir=src/maasserver",
        "--select-dir=src/metadataserver",
        "--cover-package=maas,maasserver,metadataserver",
        "--cover-branches",
        # Reduce the logging level to INFO here as
        # DebuggingLoggerMiddleware logs the content of all the
        # requests at DEBUG level: we don't want this in the
        # tests as it's too verbose.
        "--logging-level=INFO",
        "--logging-clear-handlers",
        # Do not run tests tagged "legacy".
        "-a",
        "!legacy",
    ]
    inject_test_options(options)
    update_environ()
    init_asyncio_reactor()

    logger.configure(mode=logger.LoggingMode.COMMAND)
    # Limit concurrency in all thread-pools to ONE.
    threads.install_default_pool(maxthreads=1)
    threads.install_database_unpool(maxthreads=1)

    # Disable all database connections in the reactor.
    assert not reactor.running, "The reactor has been started too early."
    reactor.callFromThread(orm.disable_all_database_connections)

    # Configure Django
    import django

    django.setup()
    test_main()