Пример #1
0
def cloud_test(cloud=None, datastore=None, destroy_vm="True"):
    """
    Run the cloud tests. This defaults to running on local vagrant
    machines, but can also be pointed to an arbitrary host (e.g. amazon) by
    passing "address:port" as arguments

    cloud: The ssh address string of the machine to run the cloud
        on. Formatted as "host:port". If not specified, defaults to
        the `cloud` vagrant box.

    datastore: The ssh address string of the machine to run the datastore on
        on. Formatted as "host:port". If not specified, defaults to the
        `datastore` vagrant box.
    """
    destroy_vm = bool(strtobool(destroy_vm))

    # Setup the datastore: use the provided test machine if given, else default
    # to the vagrant machine
    if not datastore:
        datastore = vagrant_setup("datastore", destroy_vm)
    else:
        ansible_setup(datastore, "datastore", "datastore.dev.yml")

    # Setup the cloud: use the provided address if given, else default to the
    # vagrant machine
    if not cloud:
        cloud = vagrant_setup("cloud", destroy_vm)
    else:
        ansible_setup(cloud, "magma-cloud-dev", "cloud.dev.yml")
        env.host_string = cloud
        (env.user, _, _) = split_hoststring(cloud)

    with cd('~/magma/orc8r/cloud'):
        run('make cover')
Пример #2
0
def integ_test(gateway_host=None, test_host=None, destroy_vm="True"):
    """
    Run the integration tests. This defaults to running on local vagrant
    machines, but can also be pointed to an arbitrary host (e.g. amazon) by
    passing "address:port" as arguments

    gateway_host: The ssh address string of the machine to run the gateway
        services on. Formatted as "host:port". If not specified, defaults to
        the `cwag` vagrant box.

    test_host: The ssh address string of the machine to run the tests on
        on. Formatted as "host:port". If not specified, defaults to the
        `cwag_test` vagrant box.
    """

    destroy_vm = bool(strtobool(destroy_vm))

    # Setup the gateway: use the provided gateway if given, else default to the
    # vagrant machine
    if not gateway_host:
        vagrant_setup("cwag", destroy_vm)
    else:
        ansible_setup(gateway_host, "cwag", "cwag_dev.yml")

    execute(_copy_config)
    execute(_start_gateway)

    # Run the tests: use the provided test machine if given, else default to
    # the vagrant machine
    if not test_host:
        vagrant_setup("cwag_test", destroy_vm)
    else:
        ansible_setup(test_host, "cwag_test", "cwag_test.yml")

    execute(_start_ue_simulator)
    execute(_run_unit_tests)
    execute(_run_integ_tests)
Пример #3
0
def integ_test(gateway_host=None,
               test_host=None,
               trf_host=None,
               destroy_vm="True"):
    """
    Run the integration tests. This defaults to running on local vagrant
    machines, but can also be pointed to an arbitrary host (e.g. amazon) by
    passing "address:port" as arguments

    gateway_host: The ssh address string of the machine to run the gateway
        services on. Formatted as "host:port". If not specified, defaults to
        the `magma` vagrant box.

    test_host: The ssh address string of the machine to run the tests on
        on. Formatted as "host:port". If not specified, defaults to the
        `magma_test` vagrant box.

    trf_host: The ssh address string of the machine to run the TrafficServer
        on. Formatted as "host:port". If not specified, defaults to the
        `magma_trfserver` vagrant box.
    """

    destroy_vm = bool(strtobool(destroy_vm))

    # Setup the gateway: use the provided gateway if given, else default to the
    # vagrant machine
    gateway_ip = '192.168.60.142'
    if not gateway_host:
        gateway_host = vagrant_setup("magma", destroy_vm)
    else:
        ansible_setup(gateway_host, "dev", "magma_dev.yml")
        gateway_ip = gateway_host.split('@')[1].split(':')[0]

    execute(_dist_upgrade)
    execute(_build_magma)
    execute(_run_unit_tests)
    execute(_python_coverage)
    execute(_start_gateway)

    # Run suite of integ tests that are required to be run on the access gateway
    # instead of the test VM
    # TODO: fix the integration test T38069907
    # execute(_run_local_integ_tests)

    # Setup the trfserver: use the provided trfserver if given, else default to the
    # vagrant machine
    if not trf_host:
        trf_host = vagrant_setup("magma_trfserver", destroy_vm)
    else:
        ansible_setup(trf_host, "trfserver", "magma_trfserver.yml")
    execute(_start_trfserver)

    # Run the tests: use the provided test machine if given, else default to
    # the vagrant machine
    if not test_host:
        test_host = vagrant_setup("magma_test", destroy_vm)
    else:
        ansible_setup(test_host, "test", "magma_test.yml")

    execute(_make_integ_tests)
    execute(_run_integ_tests, gateway_ip)

    if not gateway_host:
        setup_env_vagrant()
    else:
        env.hosts = [gateway_host]
    execute(_oai_coverage)