aboutsummaryrefslogtreecommitdiff
path: root/test/podman_exec.bats
blob: f62da59a3e6d847132b38050bcedef56121008b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bats

load helpers

function teardown() {
    cleanup_test
}

function setup() {
    copy_images
}

@test "exec into a bogus container" {
    run ${PODMAN_BINARY} ${PODMAN_OPTIONS} exec foobar ls
    echo "$output"
    [ "$status" -eq 125 ]
}

@test "exec without command should fail" {
    run ${PODMAN_BINARY} ${PODMAN_OPTIONS} exec foobar
    echo "$output"
    [ "$status" -eq 125 ]
}

@test "exec simple command" {
    ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d -t --name foobar1 ${ALPINE} sleep 60
    run ${PODMAN_BINARY} ${PODMAN_OPTIONS} exec foobar1 ls
    echo "$output"
    [ "$status" -eq 0 ]
}

@test "exec simple command using latest" {
    ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d -t ${ALPINE} sleep 60
    run ${PODMAN_BINARY} ${PODMAN_OPTIONS} exec -l ls
    echo "$output"
    [ "$status" -eq 0 ]
}