Skip to content

Commit

Permalink
image load: no args required
Browse files Browse the repository at this point in the history
Disable the args requirement of `image load`.  Instead of requiring a
lower bound, we really need an upper one with at most 1 argument.
Extend the system tests to prevent future regressions.

Fixes: containers#6718
Signed-off-by: Valentin Rothberg <[email protected]>
  • Loading branch information
vrothberg authored and mheon committed Jun 24, 2020
1 parent 8fbfffc commit cd0b18c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/podman/images/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
}

imageLoadCommand = &cobra.Command{
Args: cobra.MinimumNArgs(1),
Args: loadCommand.Args,
Use: loadCommand.Use,
Short: loadCommand.Short,
Long: loadCommand.Long,
Expand Down
18 changes: 17 additions & 1 deletion test/system/120-load.bats
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ verify_iid_and_name() {
run_podman load < $archive
verify_iid_and_name "<none>:<none>"

# Same as above, using stdin but with `podman image load`
run_podman rmi $iid
run_podman image load < $archive
verify_iid_and_name "<none>:<none>"

# Cleanup: since load-by-iid doesn't preserve name, re-tag it;
# otherwise our global teardown will rmi and re-pull our standard image.
run_podman tag $iid $img_name
Expand All @@ -57,9 +62,14 @@ verify_iid_and_name() {
# Load using -i; this time the image should be tagged.
run_podman load -i $archive
verify_iid_and_name $img_name
run_podman rmi $iid

# Same as above, using stdin
# Also make sure that `image load` behaves the same.
run_podman image load -i $archive
verify_iid_and_name $img_name
run_podman rmi $iid

# Same as above, using stdin
run_podman load < $archive
verify_iid_and_name $img_name
}
Expand Down Expand Up @@ -97,4 +107,10 @@ verify_iid_and_name() {
"Diagnostic from 'podman load' without redirection or -i"
}

@test "podman load - at most 1 arg(s)" {
run_podman 125 load 1 2 3
is "$output" \
"Error: accepts at most 1 arg(s), received 3"
}

# vim: filetype=sh

0 comments on commit cd0b18c

Please sign in to comment.