Esempio n. 1
0
def multitenancy_setup_without_client_with_smtp(request):
    if not conftest.run_tenant_tests:
        pytest.skip("Tenant tests disabled")

    stop_docker_compose()
    reset_mender_api()

    host_ip = get_host_ip()

    docker_compose_cmd("-f ../docker-compose.yml \
                        -f ../docker-compose.storage.minio.yml \
                        -f ../docker-compose.testing.yml \
                        -f ../docker-compose.tenant.yml \
                        %s \
                        -f ../extra/smtp-testing/conductor-workers-smtp-test.yml \
                        -f ../extra/recaptcha-testing/tenantadm-test-recaptcha-conf.yml \
                        up -d" % (conftest.mt_docker_compose_file),
                       use_common_files=False,
                       env={"HOST_IP": host_ip})

    # wait a bit for the backend to start
    wait_for_containers(21, [
        "../docker-compose.yml", "../docker-compose.tenant.yml",
        "../docker-compose.storage.minio.yml"
    ])

    def fin():
        stop_docker_compose()

    request.addfinalizer(fin)
    set_setup_type(ST_MultiTenancyNoClientWithSmtp)
Esempio n. 2
0
def multitenancy_setup_without_client(request):
    if not conftest.run_tenant_tests:
        pytest.skip("Tenant tests disabled")

    stop_docker_compose()
    reset_mender_api()

    docker_compose_cmd("-f ../docker-compose.yml \
                        -f ../docker-compose.storage.minio.yml \
                        -f ../docker-compose.testing.yml \
                        -f ../docker-compose.tenant.yml \
                        %s up -d" % (conftest.mt_docker_compose_file),
                       use_common_files=False)

    # wait a bit for the backend to start
    wait_for_containers(21, [
        "../docker-compose.yml", "../docker-compose.tenant.yml",
        "../docker-compose.storage.minio.yml"
    ])

    def fin():
        stop_docker_compose()

    request.addfinalizer(fin)
    set_setup_type(ST_MultiTenancyNoClient)
Esempio n. 3
0
def standard_setup_one_client_bootstrapped_with_s3_and_mt(request):
    if not conftest.run_tenant_tests:
        pytest.skip("Tenant tests disabled")

    stop_docker_compose()
    reset_mender_api()

    docker_compose_cmd("-f ../docker-compose.yml \
                        -f ../docker-compose.testing.yml \
                        -f ../docker-compose.storage.minio.yml \
                        -f ../docker-compose.storage.s3.yml \
                        -f ../docker-compose.tenant.yml \
                        %s up -d" % (conftest.mt_docker_compose_file),
                       use_common_files=False)

    wait_for_containers(21, [
        "../docker-compose.yml", "../docker-compose.testing.yml ",
        "../docker-compose.tenant.yml", "../docker-compose.storage.minio.yml",
        "../docker-compose.storage.s3.yml"
    ])

    def fin():
        stop_docker_compose()

    request.addfinalizer(fin)
    set_setup_type(ST_OneClientsBootstrapped_AWS_S3_MT)
Esempio n. 4
0
def standard_setup_one_client(request):
    if getattr(request, 'param', False) and request.param != "force_new" and setup_type() == ST_OneClient:
        return

    restart_docker_compose()
    reset_mender_api()

    set_setup_type(ST_OneClient)
Esempio n. 5
0
def standard_setup_two_clients_bootstrapped():
    if setup_type() == ST_TwoClientsBootstrapped:
        return

    restart_docker_compose(2)
    reset_mender_api()
    adm.accept_devices(2)

    set_setup_type(ST_TwoClientsBootstrapped)
Esempio n. 6
0
def standard_setup_one_client_bootstrapped():
    if setup_type() == ST_OneClientBootstrapped:
        return

    restart_docker_compose()
    reset_mender_api()
    adm.accept_devices(1)

    set_setup_type(ST_OneClientBootstrapped)
Esempio n. 7
0
def standard_setup_without_client():
    stop_docker_compose()
    reset_mender_api()

    docker_compose_cmd("-f ../docker-compose.yml \
                        -f ../docker-compose.storage.minio.yml \
                        -f ../docker-compose.testing.yml up -d",
                       use_common_files=False)

    set_setup_type(ST_NoClient)
Esempio n. 8
0
def standard_setup_with_signed_artifact_client(request):
    stop_docker_compose()
    reset_mender_api()

    docker_compose_cmd("-f ../extra/signed-artifact-client-testing/docker-compose.signed-client.yml up -d")

    ssh_is_opened()
    auth.reset_auth_token()
    auth_v2.accept_devices(1)
    set_setup_type(ST_SignedClient)
Esempio n. 9
0
def running_custom_production_setup(request):
    conftest.production_setup_lock.acquire()

    stop_docker_compose()
    reset_mender_api()

    def fin():
        conftest.production_setup_lock.release()
        stop_docker_compose()

    request.addfinalizer(fin)

    set_setup_type(ST_CustomSetup)
Esempio n. 10
0
def standard_setup_with_signed_artifact_client(request):
    if getattr(request, 'param', False) and request.param != "force_new" and setup_type() == ST_SignedClient:
        return

    stop_docker_compose()
    reset_mender_api()

    docker_compose_cmd("-f ../extra/signed-artifact-client-testing/docker-compose.signed-client.yml up -d")

    ssh_is_opened()
    auth.reset_auth_token()
    adm.accept_devices(1)
    set_setup_type(ST_SignedClient)
Esempio n. 11
0
def multitenancy_setup_without_client():
    if setup_type() == ST_MultiTenancyNoClient:
        return

    stop_docker_compose()
    reset_mender_api()

    docker_compose_cmd("-f ../docker-compose.yml \
                        -f ../docker-compose.storage.minio.yml \
                        -f ../docker-compose.testing.yml \
                        -f ../docker-compose.tenant.yml \
                        -f %s up -d" % (conftest.mt_docker_compose_file),
                       use_common_files=False)

    set_setup_type(ST_MultiTenancyNoClient)
Esempio n. 12
0
def standard_setup_with_short_lived_token():
    stop_docker_compose()
    reset_mender_api()

    docker_compose_cmd("-f ../docker-compose.yml \
                        -f ../docker-compose.client.yml \
                        -f ../docker-compose.storage.minio.yml  \
                        -f ../docker-compose.testing.yml \
                        -f ../extra/expired-token-testing/docker-compose.short-token.yml up -d",
                       use_common_files=False)

    ssh_is_opened()
    auth.reset_auth_token()
    adm.accept_devices(1)
    set_setup_type(ST_ShortLivedAuthToken)
Esempio n. 13
0
def running_custom_production_setup(request):
    conftest.production_setup_lock.acquire()

    reset_mender_api()

    # since we are starting a manual instance of the backend,
    # let the script know the instance is called "testprod"
    # so that is cleaned up correctly on test failure/error

    def fin():
        conftest.production_setup_lock.release()
        stop_docker_compose()

    conftest.docker_compose_instance = "testprod"
    request.addfinalizer(fin)

    set_setup_type(ST_CustomSetup)
Esempio n. 14
0
def standard_setup_one_client_bootstrapped_with_s3():
    stop_docker_compose()
    reset_mender_api()

    docker_compose_cmd("-f ../docker-compose.yml \
                        -f ../docker-compose.client.yml \
                        -f ../docker-compose.testing.yml \
                        -f ../docker-compose.storage.minio.yml \
                        -f ../docker-compose.storage.s3.yml up -d",
                       use_common_files=False)

    docker_compose_cmd("logs -f &")
    ssh_is_opened()

    auth.reset_auth_token()
    adm.accept_devices(1)

    set_setup_type(ST_OneClientsBootstrapped_AWS_S3)
Esempio n. 15
0
def setup_failover():
    """
    Setup with two servers and one client.
    First server (A) behaves as usual, whereas the second server (B) should
    not expect any clients. Client is initially set up against server A.
    In docker all microservices for B has a suffix "-2"
    """
    stop_docker_compose()
    reset_mender_api()

    docker_compose_cmd("-f ../docker-compose.yml \
                        -f ../docker-compose.client.yml \
                        -f ../docker-compose.storage.minio.yml  \
                        -f ../docker-compose.testing.yml \
                        -f ../extra/failover-testing/docker-compose.failover-server.yml up -d",
                       use_common_files=False)

    ssh_is_opened()
    auth.reset_auth_token()
    adm.accept_devices(1)
    set_setup_type(ST_Failover)
Esempio n. 16
0
def standard_setup_one_client(request):
    restart_docker_compose()
    reset_mender_api()

    set_setup_type(ST_OneClient)