github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/test/system/040-ps.bats (about)

     1  #!/usr/bin/env bats
     2  
     3  load helpers
     4  
     5  @test "podman ps - basic tests" {
     6      rand_name=$(random_string 30)
     7  
     8      run_podman run -d --name $rand_name $IMAGE sleep 5
     9      cid=$output
    10      is "$cid" "[0-9a-f]\{64\}$"
    11  
    12      # Special case: formatted ps
    13      run_podman ps --no-trunc \
    14                 --format '{{.ID}} {{.Image}} {{.Command}} {{.Names}}'
    15      is "$output" "$cid $IMAGE sleep 5 $rand_name" "podman ps"
    16  
    17  
    18      # Plain old regular ps
    19      run_podman ps
    20      is "${lines[1]}" \
    21         "${cid:0:12} \+$IMAGE \+sleep [0-9]\+ .*second.* $cname"\
    22         "output from podman ps"
    23  
    24      # OK. Wait for sleep to finish...
    25      run_podman wait $cid
    26  
    27      # ...then make sure container shows up as stopped
    28      run_podman ps -a
    29      is "${lines[1]}" \
    30         "${cid:0:12} \+$IMAGE *sleep .* Exited .* $rand_name" \
    31         "podman ps -a"
    32  
    33  
    34  
    35      run_podman rm $cid
    36  }
    37  
    38  # vim: filetype=sh