Beispiel #1
0
def test_destroy_not_started(profile, docker_client):
    sandbox = create(profile.name)
    assert docker_client.inspect_container(sandbox)

    destroy(sandbox)

    with pytest.raises(docker.errors.NotFound):
        docker_client.inspect_container(sandbox)
Beispiel #2
0
def test_destroy_exited(profile, docker_client):
    sandbox = create(profile.name, 'true')
    result = start(sandbox)
    assert result['exit_code'] == 0
    assert docker_client.inspect_container(sandbox)

    destroy(sandbox)

    with pytest.raises(docker.errors.NotFound):
        docker_client.inspect_container(sandbox)
Beispiel #3
0
def test_destroy_running(profile, docker_client):
    sandbox = create(profile.name, 'sleep 10', limits={'realtime': 1})
    result = start(sandbox)
    assert result['timeout'] is True
    container_info = docker_client.inspect_container(sandbox)
    assert container_info['State']['Running'] is True

    destroy(sandbox)

    with pytest.raises(docker.errors.NotFound):
        docker_client.inspect_container(sandbox)
def test_destroy_running(profile, docker_client):
    sandbox = create(profile.name, 'sleep 10', limits={'realtime': 1})
    result = start(sandbox)
    assert result['timeout'] is True
    container = docker_client.containers.get(sandbox.container.id)
    assert container.status == 'running'

    destroy(sandbox)

    with pytest.raises(docker.errors.NotFound):
        docker_client.containers.get(sandbox.container.id)