Commit graph

340 commits

Author SHA1 Message Date
OpenShift Merge Robot 86c8650c23
Merge pull request #4174 from cevich/use_bash_not_sh
System-tests: Use bash explicitly
2019-10-03 11:28:58 -07:00
Ed Santiago 0ed9763b72 system tests: info: deal with hyphen in username
...e.g. cloud-user. 9822f54ac was intended to fix this,
but it doesn't. Simple and standard solution is to
move the dash to the end of the character class.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-10-03 07:55:41 -06:00
Chris Evich c091374d77
System-tests: Use bash explicitly
On Ubuntu, /bin/sh != /bin/bash.  Update system-tests to only use
bash for testing consistency across platforms.

Signed-off-by: Chris Evich <cevich@redhat.com>
2019-10-02 14:32:31 -04:00
Ed Santiago 6c0b5a2fab system tests: reenable skipped tests
Issue #3829 (cp symlinks) has been fixed: enable tests for it

And, it looks like podman-remote is now handling exit status
of a force-rm'ed container. Enable that test too.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-10-02 06:22:36 -06:00
Qi Wang 0144c3796b fix cp none exists dest path ends with '/'
close #3894
This patch let podman cp return 'no such file or directory' error if DEST_PATH does not exist and ends with / when copying file.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-09-25 12:48:05 -04:00
Ed Santiago c146f8d7d2 system tests: run test: reenable and fix
Test had incorrectly been disabled for all podman; it
should've been disabled only for podman-remote. Fixed
that, and fixed the problem that was causing failures:
podman-remote is gobbling up stdin (#4095), so no
tests were actually being run at all, or only one.
Fixed by redirecting input on the run_podman invocation.
Added, as backup, a confirmation mechanism to ensure
that all expected tests are being run.

Note that test is reenabled, but the output check is
disabled for podman-remote due to #4096; this at least
lets us check exit status.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-09-24 08:46:40 -06:00
Chris Evich 52c4df0f9a
System-test: Temporarily disable 030-run
While investigating issue
https://github.com/containers/libpod/issues/4044 there is no sense
subjecting forward progress elsewhere.  Skip the test with a note
temporarily, until a resolution to 4044 and any other related issues
is found and fix implemented.

Signed-off-by: Chris Evich <cevich@redhat.com>
2019-09-17 12:54:49 -04:00
OpenShift Merge Robot 7875e00c66
Merge pull request #3934 from rhatdan/wait
Podman-remote run should wait for exit code
2019-09-13 18:12:25 +02:00
Jhon Honce a6836eae52 Do not support wildcards on cp
* symlink processing and wildcarding led to unexpected files
  being copied

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-09-12 16:56:38 -07:00
Daniel J Walsh 82ac0d8925
Podman-remote run should wait for exit code
This change matches what is happening on the podman local side
and should eliminate a race condition.

Also exit commands on the server side should start to return to client.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-09-12 16:20:01 -04:00
Ed Santiago acf55e1f87 System tests: support for crun on f31/rawhide
crun emits wildly different error messages than runc in
two cases:

    podman run ... /no/such/path   (enoent)
    podman run ... /etc            (trying to exec a directory)

Deal with it by getting the runtime from 'podman info' and,
if crun, changing what we expect.

There may be more tweaks needed to get system tests working
with crun, but right now podman rawhide is too broken to
have any hope of finding them all.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-09-04 14:03:55 -06:00
Ed Santiago 4e2cccd9af podman cp: big set of system tests
podman cp has had some unexpected bugs, and still has
some surprising behavior. It looks like this part of
the code is fragile. Add tests to try to prevent
future breakages.

Note that two of the new tests are disabled (skipped)
until #3829 gets fixed.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-08-26 15:33:38 -06:00
Ed Santiago cb4804de38 Flake fix: build test timeout
The priv test added to the build test in June runs an 'apk'
command which, unavoidably, has to fetch stuff from the net.
This is slow and unreliable, and periodically leads to
timeout failures. Worse, when this happens, some sort of
invisible buildah-only container gets left behind that leads
to failures in subsequent tests when trying to reset to
known state.

Imperfect workaround: try a 240-second timeout (up from 60)
when running apk. As backup, add a custom teardown() which
attempts to force-remove all containers and any new images.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-08-19 08:05:33 -06:00
Ed Santiago 4fb7036ca1 tests for exit status on podman run --rm
...and on a container killed by 'podman rm -f'. See #3795

Disable when testing podman-remote; see #3808

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-08-14 15:14:55 -06:00
Ed Santiago 5c108cdab4 implement 'make remotesystem'
podman-remote rm now works; that's the only thing we were
waiting for to enable podman-remote (varlink) system tests.

Add a (too-complicated, sorry) Makefile target that will
define a random socket path, start the podman varlink server,
and run the test suite using podman-remote.

Also: add two convenience functions, is_rootless and is_remote,
and use those in skip_if_rootless/if_remote and elsewhere

Also: workarounds for broken tests:
 - basic version test: podman-remote emits an empty 'Client'
   line. Just ignore it.
 - looks like 'podman-remote pod' doesn't work; skip test.

Also: minor documentation update

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-08-08 11:44:55 -06:00
Ed Santiago 8922dfcc76 pod top test: reenable
It looks like #2780 is fixed: an overnight run yielded no
instances of 'pod top' returning incomplete output.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-08-06 11:46:51 -06:00
Ed Santiago 6eee9ab080 System tests: resolve hang in rawhide rootless
Fedora CI tests are failing on rawhide under kernel
5.3.0-0.rc1.git3.1.fc31 (rhbz#1736758). But there's
another insidious failure, a 4-hour hang in the
rootless tests on the same CI system. The culprit
line is in the podman build test, but it's actually
BATS itself that hangs, not the build command -- which
suggests that it's the usual FD 3 problem (see BATS README).
It would seem that podman is forking a process that
inherits fd 3 but that process is not getting cleaned
up when podman crashes upon encountering the kernel bug.

Today it's podman build, tomorrow it might be something
else. Let's just run all podman invocations in run_podman
with a non-bats FD 3.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-08-01 20:19:54 -06:00
Major Hayden 9822f54ac3
Allow info test to work with usernames w/dash
The regular expression used in the `info` test does not allow for
usernames that have a dash, such as `test-user`. This patch adjusts
the regex to allow for a dash.

Fixes #3666.

Signed-off-by: Major Hayden <major@redhat.com>
2019-07-29 16:08:51 -05:00
OpenShift Merge Robot fce2e6577e
Merge pull request #3497 from QazerLab/bugfix/systemd-generate-pidfile
Use conmon pidfile in generated systemd unit as PIDFile.
2019-07-08 23:39:42 +02:00
Danila Kiver 8fde4194b6 Move skipping systemd tests to early setup.
There is no meaning of performing setup/teardown for these tests
when we even can not work with systemd.

Signed-off-by: Danila Kiver <danila.kiver@mail.ru>
2019-07-06 20:45:26 +03:00
Danila Kiver 1f435bf92c Reload systemd daemon on creation of units location dir in tests.
Systemd manager drops non-existent directories from the units search
path during initialization, thus, creation of UNIT_DIR, if it did not
exist before, requres reloading the daemon.

Signed-off-by: Danila Kiver <danila.kiver@mail.ru>
2019-07-06 17:41:29 +03:00
Danila Kiver c490754ff7 Add debug information to "generate systemd" test.
Signed-off-by: Danila Kiver <danila.kiver@mail.ru>
2019-07-06 01:35:46 +03:00
Danila Kiver a54429cf87 Use conmon pidfile in generated systemd unit as PIDFile.
By default, podman points PIDFile in generated unit file to non-existent
location. As a result, the unit file, generated by podman, is broken:
an attempt to start this unit without prior modification results in a crash,
because systemd can not find the pidfile of service's main process.

Fix the value of "PIDFile" and add a system test for this case.

Signed-off-by: Danila Kiver <danila.kiver@mail.ru>
2019-07-04 03:58:37 +03:00
TomSweeneyRedHat 19ddcf9251 Add RUN priv'd test for build
Podman 1.4.1 had problems with builds with a
RUN command that tried to to a privliged command.

This adds a gating test for that situation.

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2019-06-28 12:27:45 -04:00
Ed Santiago d6f436204f run BATS tests in Cirrus
I'm running the BATS tests manually once in a while, and
catching several problems each week that make it past
the rest of CI. Since the BATS tests run at RPM gating
time, we need to catch problems earlier. Try running
the tests from Cirrus.

Tests will be skipped on Ubuntu due to a too-ancient
version of coreutils (8.28; the 'timeout -v' we use
requires 8.29).

Tests are run *after* integration tests, even though
these take three minutes and would be nice to have
fail quickly, because running before causes bizarre
CI failures. Shrug.

UPDATE: also fix run test, broken by #3311.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-06-17 13:41:14 -06:00
Ed Santiago bd0582dd34 BATS tests - get working again
Various small fixes to get BATS tests working again.
Split from #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 #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 (d1a7378aa) 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. #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>
2019-06-11 06:53:03 -06:00
Ed Santiago 78bd2eac06 bats - various small updates
- podman-remote:
  - enable log, run and build tests, they're working now
    - well, except build + rootless. Skip that one.
  - add explanation of why info test is skipped

- Giuseppe's permission test:
  - validate GraphRoot and RunRoot values
  - add verbose logging, to enable seeing full directory tree
    permissions on error

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-04-18 15:39:21 -06:00
OpenShift Merge Robot 6ddc67c694
Merge pull request #2907 from edsantiago/uidmap_test_fix
new uidmap BATS test: fix
2019-04-12 07:17:32 -07:00
OpenShift Merge Robot e197cb2ff4
Merge pull request #2889 from edsantiago/bats
BATS tests: start supporting podman-remote
2019-04-11 19:19:23 -07:00
Ed Santiago 859bda1936 new uidmap BATS test: fix
Various problems, one of which was causing the test to fail
completely (otherwise I wouldn't have caught the others):

- option is --uidmap, not --uidmapping
- run_podman cannot be piped (| grep /sys/kernel). That's
  an unfortunate limitation of BATS. Any invocation of 'run'
  saves results to $output, which then has to be tested
  in a separate step.
  - do so, using 'run' and 'grep' and 'is' to produce
    readable messages on failure
- remove "$expected_rc", that looks like a copy/paste bug
  from a few lines above.

Skip entire test if rootless. (The one without --net=host
passes, but it also passes with older podman as both root
and rootless. I don't think it's actually testing anything,
but agree with leaving it in to catch weird regressions).

We really need to get these tests running in CI.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-04-11 20:08:27 -06:00
Giuseppe Scrivano b7800889fb
userns: prevent /sys/kernel/* paths in the container
when we run in a user namespace, there are cases where we have not
enough privileges to mount a fresh sysfs on /sys.  To circumvent this
limitation, we rbind /sys from the host.  This carries inside of the
container also some mounts we probably don't want to.  We are also
limited by the kernel to use rbind instead of bind, as allowing a bind
would uncover paths that were not previously visible.

This is a slimmed down version of the intermediate mount namespace
logic we had before, where we only set /sys to slave, so the umounts
done to the storage by the cleanup process are propagated back to the
host.  We also don't setup any new directory, so there is no
additional cleanup to do.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-04-11 15:40:00 +02:00
Ed Santiago 7220c166d4 BATS tests: start supporting podman-remote
podman-remote now supports rm! That's what we needed to start
running BATS tests.

Although most tests don't actually work, some do, and maybe
the rest will start working over time. For now, disable them.

The only significant difference found is that podman-remote
strips fractional seconds from timestamps in JSON output.
Probably not something worth caring about.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-04-10 08:19:09 -06:00
Ed Santiago 1ae8a5b285
test: test that an unprivileged user cannot access the storage
Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-29 14:04:45 +01:00
Ed Santiago 67444db3b1 Sigh; disable pod-top test, it's unreliable (#2780)
Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-03-27 10:14:00 -06:00
Ed Santiago 58d2e589fb BATS: new tests, and improvements to existing ones
New:
 - podman exec
 - podman load (requires #2674)
 - CLI parsing (regression test for #2574)

Improved:
 - help: test "podman NoSuchCommand", and subcommands
 - help: test "podman cmd" without required args
 - pod: start with --infra=false; this allows running rootless
 - log: also run 'logs' after container is run
 - log: test -f with two containers

Also, use helpful descriptions for skip_if_rootless

Tested on f29, root and rootless. As soon as podman-remote
supports rm, I'll start testing that too.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-03-18 15:21:52 -06:00
OpenShift Merge Robot 5fdb8bfcb3
Merge pull request #2257 from cevich/system_test_beginning
[ci skip] System-test: Begin list of needed high-level tests
2019-03-08 09:13:07 -08:00
Ed Santiago 589248d2f3 Implement review feedback
- document a recommended convention for fail-fast tests

- document the requirement for jq. (And, add a fail-fast
  test for its presence; remove the duplicated checks
  in subtests)

- add further sanity checks to 'help' test. Add missing
  documentation. Remove a no-longer-needed workaround for
  usage-message bug fixed in #2486

- add a documented TEMPLATE

- and, since we're at 1.1, enable 'Remote API' check in
  version test

- better diagnostics in setup/teardown; add vim filetype hint;
  better formatting of actual-vs-expect errors

- new pod-top, logs, build tests

- improve error messages

- add $IMAGE alias for ridiculous $PODMAN_TEST_IMAGE_FQN

- final cleanup, in prep for merge

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-03-07 14:09:00 -07:00
Ed Santiago 681eae9bcc new system tests under BATS
Initial attempt at writing a framework for podman system tests.
The idea is to define a useful set of primitives that will
make it easy to write actual tests and to interpret results
of failing ones.

This is a proof-of-concept right now; only a small number of
tests, by no means comprehensive. I am requesting review in
order to find showstopper problems: reasons why this approach
cannot work. Should there be none, we can work toward running
these as gating tests for Fedora and RHEL8.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-03-07 13:09:54 -07:00
Chris Evich 53cd9bed95
System-test: Documentation and TODO list
Signed-off-by: Chris Evich <cevich@redhat.com>
2019-03-06 12:14:49 -05:00
Yiqiao Pu a7122d68de The system test write with ginkgo
The tests can be filter by --focus and --skip to fit different test
target. Also be able to set global options and cmd options by export
it to ENV to fit different test matrix.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
2018-11-16 10:49:12 +08:00