mirror of
https://github.com/containers/podman.git
synced 2025-06-02 02:26:52 +08:00
stats: list all running containers unless specified otherwise
Unless specified otherwise by --all, --latest or via arguments, list all running containers. This matches the behaviour of Docker and is also illustrated in the man pages where containers and options are marked to be optional. Fixes: #4274 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
@ -11,6 +11,8 @@ import (
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
// TODO: we need to check the output. Currently, we only check the exit codes
|
||||
// which is not enough.
|
||||
var _ = Describe("Podman stats", func() {
|
||||
var (
|
||||
tempdir string
|
||||
@ -61,6 +63,15 @@ var _ = Describe("Podman stats", func() {
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman stats on all running containers", func() {
|
||||
session := podmanTest.RunTopContainer("")
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
session = podmanTest.Podman([]string{"stats", "--no-stream"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman stats only output cids", func() {
|
||||
session := podmanTest.RunTopContainer("")
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
@ -55,9 +55,11 @@ function check_help() {
|
||||
|
||||
# If usage has required arguments, try running without them
|
||||
if expr "$usage" : '.*\[flags\] [A-Z]' >/dev/null; then
|
||||
dprint "podman $@ $cmd (without required args)"
|
||||
run_podman 125 "$@" $cmd
|
||||
is "$output" "Error:"
|
||||
if [ "$cmd" != "stats"]; then
|
||||
dprint "podman $@ $cmd (without required args)"
|
||||
run_podman 125 "$@" $cmd
|
||||
is "$output" "Error:"
|
||||
fi
|
||||
fi
|
||||
|
||||
count=$(expr $count + 1)
|
||||
|
Reference in New Issue
Block a user