Skip to content

Commit

Permalink
BATS tests - get working again
Browse files Browse the repository at this point in the history
Various small fixes to get BATS tests working again.
Split from containers#2947 because that one keeps getting stalled,
and I'm hoping these separate changes get approved.

I consider these changes urgent because RHEL8 gating
tests are failing, and will fail even more if/when containers#2272
gets picked up and packaged for RHEL8, and I consider
it important to have clean passing tests for RHEL8.

  * info test: 'insecure registries' is gone. A recent
    commit (d1a7378) changed the format of 'podman info',
    removing the 'insecure registries' key. Deal with it.

  * info test: remove check for .host.{Conmon,OCIRuntime}.package;
    the value on f28 and f29 is 'Unknown' (instead of an NVR).
    We can live without this check.

  * 'load' test: skip when running in CI, because stdin
    is not a tty.

  * container restore: fix arg processing. containers#2272 broke argument
    processing: 'podman container restore', with no args, should
    exit with 'argument required' error. Root cause is that the
    new --import option takes the place of an argument, so the
    checkAllAndLatest() call had to be changed to not exit on error.
    Workaround is (sigh) to copy/paste the skipped checkAllAndLatest()
    code, with minor tweaks to accommodate --import.

Signed-off-by: Ed Santiago <santiago@redhat.com>
  • Loading branch information
edsantiago committed Jun 11, 2019
1 parent c93b8d6 commit bd0582d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
9 changes: 9 additions & 0 deletions cmd/podman/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,14 @@ func restoreCmd(c *cliconfig.RestoreValues, cmd *cobra.Command) error {
if (c.Import != "") && (c.All || c.Latest) {
return errors.Errorf("Cannot use --import and --all or --latest at the same time")
}

argLen := len(c.InputArgs)
if (c.All || c.Latest) && argLen > 0 {
return errors.Errorf("no arguments are needed with --all or --latest")
}
if argLen < 1 && !c.All && !c.Latest && c.Import == "" {
return errors.Errorf("you must provide at least one name or id")
}

return runtime.Restore(getContext(), c, options)
}
4 changes: 1 addition & 3 deletions test/system/005-info.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Distribution:
OCIRuntime:\\\s\\\+package:
os:
rootless:
insecure registries:
registries:
store:
GraphDriverName:
GraphRoot:
Expand All @@ -37,9 +37,7 @@ RunRoot:

tests="
host.BuildahVersion | [0-9.]
host.Conmon.package | $expr_nvr
host.Conmon.path | $expr_path
host.OCIRuntime.package | $expr_nvr
host.OCIRuntime.path | $expr_path
store.ConfigFile | $expr_path
store.GraphDriverName | [a-z0-9]\\\+\\\$
Expand Down
4 changes: 4 additions & 0 deletions test/system/120-load.bats
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ verify_iid_and_name() {


@test "podman load - will not read from tty" {
if [ ! -t 0 ]; then
skip "STDIN is not a tty"
fi

run_podman 125 load
is "$output" \
"Error: cannot read from terminal. Use command-line redirection" \
Expand Down

0 comments on commit bd0582d

Please sign in to comment.