Commit graph

107 commits

Author SHA1 Message Date
Valentin Rothberg 43714cac21 systemd system test: run auto-update
Run `podman auto-update` in the systemd system tests.  Note that this is
a first step to at least exercise parts of `auto-update` in the CI.  The
service won't get updated just yet as we need to set up a local
registry, and push a new image.  I do not have enough time at the moment
to do that but consider this change already as an improvement.

We are experiencing some issues in #6793 w.r.t. to auto-updates but
couldn't track down the root cause yet.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-29 15:36:34 +02:00
OpenShift Merge Robot f8036c548c
Merge pull request #6754 from edsantiago/man_page_xref
Docs: consistency between man / --help
2020-06-25 08:33:39 -04:00
OpenShift Merge Robot cd36499d10
Merge pull request #6751 from vrothberg/fix-6744
podman run/create: support all transports
2020-06-25 06:16:54 -04:00
Ed Santiago cf7222172e Friendly amendment for pr 6751
More robust system test for podman run/create docker-archive

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-24 11:10:50 -06:00
Ed Santiago c6090c290e Docs: consistency between man / --help
New functionality in hack/man-page-checker: start cross-
referencing the man page 'Synopsis' line against the
output of 'podman foo --help'. This is part 1, flag/option
consistency. Part 2 (arg consistency) is too big and will
have to wait for later.

flag/option consistency means: if 'podman foo --help'
includes the string '[flags]' in the Usage message,
make sure the man page includes '[*options*]' in its
Synopsis line, and vice-versa. This found several
inconsistencies, which I've fixed.

While doing this I realized that Cobra automatically
includes a 'Flags:' subsection in its --help output
for all subcommands that have defined flags. This
is great - it lets us cross-check against the
usage synopsis, and make sure that '[flags]' is
present or absent as needed, without fear of
human screwups. If a flag-less subcommand ever
gets extended with flags, but the developer forgets
to add '[flags]' and remove DisableFlagsInUseLine,
we now have a test that will catch that. (This,
too, caught two instances which I fixed).

I don't actually know if the new man-page-checker
functionality will work in CI: I vaguely recall that
it might run before 'make podman' does; and also
vaguely recall that some steps were taken to remedy
that.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-24 10:39:10 -06:00
OpenShift Merge Robot 988fd27541
Merge pull request #6746 from vrothberg/untag
podman untag: error if tag doesn't exist
2020-06-24 12:19:42 -04:00
Valentin Rothberg f80461078e podman run/create: support all transports
Support all image transports in podman run/create.  It seems we
regressed with v2 on that.  Also add tests to make sure we're
not regressing again.

Fixes: #6744
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-24 17:20:04 +02:00
Valentin Rothberg 1c6c12581c podman untag: error if tag doesn't exist
Throw an error if a specified tag does not exist.  Also make sure that
the user input is normalized as we already do for `podman tag`.

To prevent regressions, add a set of end-to-end and systemd tests.

Last but not least, update the docs and add bash completions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-24 15:34:46 +02:00
Ed Santiago 6864a5547a BATS tests: new too-many-arguments test
...plus a few others. And fixes to actual parsing.

If a command's usage message includes '...' in the
argument list, assume it can take unlimited arguments.
Nothing we can check.

For all others, though, the ALL-CAPS part on the
right-hand side of the usage message will define
an upper bound on the number of arguments accepted
by the command. So in our 'podman --help' test,
generate N+1 args and run that command. We expect
a 125 exit status and a suitably helpful error message.

Not all podman commands or subcommands were checking,
so I fixed that. And, fixed some broken usage messages
(all-caps FLAGS, and '[flags]' at the end of 'ARGS').
Add new checks to the help test to prevent those in
the future.

Plus a little refactoring/cleanup where necessary.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-23 14:17:48 -06:00
OpenShift Merge Robot 0d961a40ba
Merge pull request #6726 from edsantiago/bats
system tests: invoke with abs path to podman
2020-06-23 15:31:02 -04:00
OpenShift Merge Robot 73514b1465
Merge pull request #6722 from vrothberg/fix-6718
image load: no args required
2020-06-23 16:47:42 +02:00
Ed Santiago aa16a0aab1 system tests: invoke with abs path to podman
Reversion of one part of #6679: my handling of 'realpath'
would not work when $PODMAN is 'podman-remote --url etc'.
Trying to handle that case got unmaintainable; so instead
let's just force 'make {local,remote}system' to invoke
with a full PODMAN path. This breaks down if someone
runs the tests with a manual 'bats' invocation, but I
think I'm the only one who ever does that.

Since podman path will now be very long in the logs,
add code to logformatter to abbreviate it like we do
for the ginkgo logs.

And, one thing that has bugged me for a long time:
in the error logs, show a different prompt ('#' vs '$')
to distinguish root vs rootless. This should make it
much easier to see at-a-glance whether a log file
is root or not. Add tests for it.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-23 08:10:57 -06:00
Valentin Rothberg 138d447eb4 image load: no args required
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: #6718
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-23 14:53:29 +02:00
OpenShift Merge Robot bbaba9fb86
Merge pull request #6679 from edsantiago/bats
system tests: new rm, build tests
2020-06-23 12:21:49 +02:00
Ed Santiago d4504e6f53 system tests: new rm, build tests
- rm: confirm 'rm' and 'rm -f' on running container

 - build: shotgun test of workdir, cmd, env, labels

The new build test cd's to a temporary directory, which broke
test invocations using a relative path (./bin/podman). Added
code to detect relative paths and convert them to absolute.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-22 15:57:18 -06:00
Qi Wang f61a7f25a8 Add --preservefds to podman run
Add --preservefds to podman run. close https://github.com/containers/libpod/issues/6458

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-06-19 09:40:13 -04:00
Valentin Rothberg 334d3b1ef3 CI: force registry:2.6
For using the `registry:2.6` image. 2.7 and beyond dropped the
`htpasswd` binary from the rootfs which parts of our CI depends
on.

While this is not a sustainable solution (assuming `htpasswd` is gone
for ever), it unblocks the CI for now.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-19 12:58:02 +02:00
Daniel J Walsh fe69aa9ba3
Handle dropping capabilties correctly when running as non root user
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-17 17:20:53 -04:00
Ed Santiago 2d5a2a7640 BATS and APIv2: more tests and tweaks
- (minor): apiv2 tests: check for full ID

   Observation made while reviewing #6461: tests were checking
   only for a 12-character container/image ID in return value.
   It's actually 64, and we should test for that. This should
   also minimize confusion in a future maintainer.

 - podman pause/unpause: new test

   Runs a 'date/sleep' loop, pauses container, sleeps 3s,
   restarts, then confirms that there's a 3- to 6-second
   gap in the logs for the container.

 - podman healthcheck: new test

   run a container with healthcheck, test both healthy
   and unhealthy conditions

 - podman pod: check '{{.Pod}}' field in podman ps

   Hey, as long as we have a pod with two running
   containers, might as well confirm that 'podman ps'
   returns the expected pod ID.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-03 16:13:33 -06:00
Ed Santiago 03d32d05ac system tests : more tests
- exec: add test for #5046, in which conmon swallowed chars
  on a large byte transfer

- pod: add 'pod exists' tests, both positive and negative;
  consolidate tests; add '--label', and check in 'pod inspect'
  add 'pod ps' tests

- networking: add test for #5466, in which detached run
  with --userns=keep-id would not forward a port

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-01 12:00:47 -06:00
OpenShift Merge Robot 9037908b78
Merge pull request #5594 from edsantiago/bats
system tests: enable skopeo REGISTRY_AUTH_FILE
2020-05-30 05:17:18 -04:00
Jhon Honce 5626c2163b V2 verify JSON output is consistent and doesn't drift
$ cd test/apiv2
$ python -m unittest -v test_rest_v1_0_0.TestApi

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-05-28 16:20:29 -07:00
Boaz Shuster 1f8a78747a Add --format to pod inspect
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
2020-05-27 09:48:38 +03:00
OpenShift Merge Robot 3f2ab6bc2e
Merge pull request #6331 from sujil02/iidfile-battest
Enables iidfile test as issue fixed now
2020-05-22 12:09:18 +02:00
Sujil02 9f5e661cfe Enables iidfile test as issue fixed now
Signed-off-by: Sujil02 <sushah@redhat.com>
2020-05-21 18:37:31 -04:00
Daniel J Walsh 7b188f7b5b
podman version --format ... was not working
This patch fixes the podman --version --format command.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-21 16:31:34 -04:00
OpenShift Merge Robot 835d2644b8
Merge pull request #6280 from mheon/switch_off_noexec
Turn off 'noexec' option by default for named volumes
2020-05-21 16:26:20 +02:00
Matthew Heon cc65430145 Turn off 'noexec' option by default for named volumes
We previously enforced this for security reasons, but as Dan has
explained on several occasions, it's not very valuable there
(it's trivially easy to bypass) and it does seriously annoy folks
trying to use named volumes. Flip the default from 'on' to 'off'.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-05-20 16:48:20 -04:00
Ed Santiago a4bfcd75aa system tests: more podman-pod tests
* rename pod-top.bats to pod.bats
* add test for TCP port communication between pods
* add test for various podman-pod-create options

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-05-20 11:04:54 -06:00
Ed Santiago cd85ba196d system tests: small fixes for rawhide+cgroups v1
Three small fixes for breaking tests on rawhide:

  1) run test: looks like runc changed the format of
     an error message, adding a colon in one place.
     runc is used on rawhide when booted in cgroups v1

  2) volumes test: difference in exit status and error
     message between runc and crun.

  3) systemd test: define XDG_RUNTIME_DIR if unset.
     podman helpfully sets this to a reasonable default,
     but the 'systemctl' commands used in this test do not.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-05-14 09:55:25 -06:00
Ed Santiago 3ec335bc9f system tests: add volume tests
Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-05-12 14:43:17 -06:00
Ed Santiago a82de0e3a0 Some BATS cleanup: run and systemd tests
run test: run positive test before negative; and actually
implement real negative tests. Also, add confirmation tests for
cidfile/pidfile, not just 'exit status is good'.

systemd test: enable rootless, and again add actual content
testing.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-05-11 09:30:09 -06:00
Valentin Rothberg 42c6aa1a42 fix and enable systemd system tests
The systemd unit test never ran in CI and was broken for various
reasons.  Fix the test to execute Podman in systemd units and to also
run generated units files.

Note: more tests will be added in the future.  The simple check for now
will prevent regressions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-05-08 13:05:25 +02:00
Valentin Rothberg 676efd89d5 set --conmon-pidfile
The --conmon-pidfile was not set in the spec leading to failing systemd
units.  Also add a system test to prevent future regressions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-05-08 10:53:11 +02:00
Ed Santiago 29d39e35e4 BATS help test: check usage string
Now that we've agreed that usage messages should match
what the user typed, confirm it. IOW 'podman foo --help'
should not issue a usage message for 'podman container foo'.

Fix one broken instance, 'unpause'.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-05-05 07:19:58 -06:00
baude 52371057cd fix commands without input
in cases where commands require input and we dont provide it, we often would segv.  This can be attributed in many cases to the subcommand not picked up the cobra Args attribute or neither had them.

Signed-off-by: baude <bbaude@redhat.com>
2020-04-30 15:10:49 -05:00
Ed Santiago 91a42fefcb System tests: help messages: check required-arg
If a usage message is of the form '... [flags] ARGNAME',
where ARGNAME is all-caps and not in brackets, it must
be a required argument. Try running podman subcommand
without ARGNAME, and make sure that podman bails out
with an informative message. (Since this message is
freeform in each subcommand, not Cobra-generated,
we have a lot of possible variations to check for).

Fix podman login/logout Use messages to indicate that
REGISTRY is now optional (as of #5233).

This test has actually been in place for over a year but
due to a typo on my part -- a missing space -- it was
not being run. "For want of a space, much testing was lost".

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-04-30 14:55:10 -05:00
baude e1f1dee006 enable final system test
Signed-off-by: baude <bbaude@redhat.com>
2020-04-29 12:01:18 -05:00
Valentin Rothberg 5c108f75eb login system test: enable "push ok"
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-04-29 15:23:30 +02:00
Ed Santiago daeb6f00b2 system tests: enable skopeo REGISTRY_AUTH_FILE
skopeo pr #829 adds REGISTRY_AUTH_FILE support; this lets us
enable the following test:

  podman login - shares credentials with skopeo - via envariable

(I seriously doubt that the CI VMs have been updated with the
new skopeo, but I can leave this PR in limbo until that happens.
Otherwise I'll forget to enable the test).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-04-29 05:45:11 -06:00
Valentin Rothberg b2414b580e generate systemd
Implement `podman generate systemd` for Podman v2 and enable associated
tests.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-04-29 07:22:18 +02:00
Brent Baude 517bc28360 system tests must pass
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-28 15:17:00 -05:00
Brent Baude 44a8cf8676 Fixes for system tests
Various fixes to protect against regressions in system tests

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-17 13:22:06 -05:00
Brent Baude 90ead05903 Fixes for load and other system tests
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-13 13:08:04 -05:00
Brent Baude e20ecc733c refactor info
the current implementation of info, while typed, is very loosely done so.  we need stronger types for our apiv2 implmentation and bindings.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-06 12:45:42 -05:00
Kunal Kushwaha 19bf7adedb Improved readability in image json output
Changes made in json output to improve readability of
podman images output.

Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
2020-03-22 21:38:07 +09:00
Ed Santiago 3585780876 run --rmi test: make it work
The recently-added 'run --rmi' test was not actually doing
what it thinks it was doing: for one, 'run_podman | grep'
is never going to work; also, the test was leaving behind
stray images.

Rework to do what I believe the intention was; and, combine
into one test (down from two) for readability.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-12 07:57:11 -06:00
Boaz Shuster 11e5c53d11 Add the rmi flag to podman-run to delete container image
The --rmi flag will delete the container image after its execution
unless that image is already been used by another container(s).

This is useful when one wants to execute a container once and remove
any resources attached to it.

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
2020-03-03 14:27:11 +02:00
Ed Santiago 40470b45d3 kill test: clean up warnings; document better
9f69c4eca (part of the f31 pr, #3091) semi-broke the kill test,
there's now an ugly warning:

    setup(): removing stray images quay.io/libpod/fedora-minimal:latest 7bb5a60e8a78

The comments also didn't actually explain the problem
being addressed, and included a misleading reference
to busybox.

Here we switch to using fedora-minimal only with podman-remote,
clean it up (rmi) when finished, and include an explanation in
the comments about why this is needed; making it clear that
this workaround can be removed once we get rid of podman-remote.
We also reformat back to 80 columns.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-26 11:01:38 -07:00
Chris Evich 4511e15f8c
Fix kill test obtaining CID
It's possible/likely the container image for the test will need to be
pulled as part of the `run` command.  Due to the way BATS handles
output, messages regarding image-pull could be misinterpreted as the
container's CID.  Force the CID to be obtained by only the last line of
output.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-25 12:34:26 -05:00