Exemple #1
0
def _ignore_test_host_from_host_template(docker_client):  # NOQA
    for i in docker_client.list_host_template():
        docker_client.delete(i)

    ht = docker_client.create_host_template(
        publicValues={
            'digitaloceanConfig': {
                'region': 'sfo1',
                'size': '1gb',
            },
        },
        secretValues={
            'digitaloceanConfig': {
                'accessToken': 'XXXXX',
            },
        },
    )
    ht = docker_client.wait_success(ht)
    assert ht.state == 'active'

    host = docker_client.create_host(hostname='lala',
                                     digitaloceanConfig={},
                                     hostTemplateId=ht.id)
    host = docker_client.wait_success(host)
    assert host.state == 'active'
def _ignore_test_host_from_host_template(docker_client):  # NOQA
    for i in docker_client.list_host_template():
        docker_client.delete(i)

    ht = docker_client.create_host_template(
        publicValues={
            'digitaloceanConfig': {
                'region': 'sfo1',
                'size': '1gb',
            },
        },
        secretValues={
            'digitaloceanConfig': {
                'accessToken': 'XXXXX',
            },
        },
    )
    ht = docker_client.wait_success(ht)
    assert ht.state == 'active'

    host = docker_client.create_host(hostname='lala',
                                     digitaloceanConfig={},
                                     hostTemplateId=ht.id)
    host = docker_client.wait_success(host)
    assert host.state == 'active'
def test_logs_container(docker_client, cattle_url):
    uuid = TEST_IMAGE_UUID
    container = docker_client.create_container(name='test', imageUuid=uuid)
    container = docker_client.wait_success(container)

    assert len(container.hosts()) == 1

    logs_access = container.logs()

    assert logs_access.token.index('.') > 0
    assert '/v1/logs/' in logs_access.url
Exemple #4
0
def test_stats_service(docker_client, context, cattle_url):
    env = docker_client.create_environment(name=random_str())
    env = docker_client.wait_success(env)
    assert env.state == "active"

    image_uuid = context.image_uuid
    launch_config = {"imageUuid": image_uuid}

    service = docker_client.create_service(name=random_str(),
                                           environmentId=env.id,
                                           launchConfig=launch_config)
    service = docker_client.wait_success(service)
    assert service.state == "inactive"
    stats_access = service.containerStats()

    try:
        payload = jwt.decode(stats_access.token, verify=False)

        assert 'service' in payload
    except jwt.InvalidTokenError:
        assert False
Exemple #5
0
def test_stats_container(docker_client):
    uuid = TEST_IMAGE_UUID
    container = docker_client.create_container(name='test', imageUuid=uuid)
    container = docker_client.wait_success(container)

    assert container.state == 'running'
    assert len(container.hosts()) == 1

    stats_access = container.stats()

    assert stats_access.token.index('.') > 0

    assert '/v1/stats/%s' % container.externalId in stats_access.url
Exemple #6
0
def test_stats_container(docker_client):
    uuid = TEST_IMAGE_UUID
    container = docker_client.create_container(imageUuid=uuid)
    container = docker_client.wait_success(container)

    assert container.state == 'running'
    assert len(container.hosts()) == 1

    stats_access = container.stats()

    assert stats_access.token.index('.') > 0

    assert '/v1/stats/%s' % container.externalId in stats_access.url
Exemple #7
0
def test_stats_container(docker_client):
    uuid = TEST_IMAGE_UUID
    container = docker_client.create_container(name="test", imageUuid=uuid)
    container = docker_client.wait_success(container)

    assert container.state == "running"
    assert len(container.hosts()) == 1

    stats_access = container.stats()

    assert stats_access.token.index(".") > 0

    assert "/v1/stats/%s" % container.externalId in stats_access.url
Exemple #8
0
def test_stats_container(docker_client, cattle_url):
    uuid = TEST_IMAGE_UUID
    container = docker_client.create_container(name='test', imageUuid=uuid)
    container = docker_client.wait_success(container)

    assert len(container.hosts()) == 1

    stats_access = container.containerStats()

    assert stats_access.token.index('.') > 0
    assert '/v1/containerstats/' in stats_access.url
    try:
        payload = jwt.decode(stats_access.token, verify=False)
        assert 'containerIds' in payload
        containerIds = payload['containerIds']
        assert len(containerIds) == 1
    except jwt.InvalidTokenError:
        assert False