18 Commits

Author SHA1 Message Date
d072de6efc APIv2 tests: Add some tests for podman pods
Add some tests for podman pods subcommand:
  restart
  rm
  start
  stas
  stop
  top
  unpause

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
2020-06-16 11:53:48 +08:00
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
382342a0b0 test.apiv2: add test cases for committing an image from a container
Testing query parameters: container, repo, tag, comment, author, changes
and pause.

Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
2020-06-03 05:33:56 +00:00
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
7e03d277f7 test.apiv2: add testing for image and deal with API returning binary
Add testing for displaying image history and exporting image

Deal with API returning binary (Content-Type =~ 'octet').
When so, set $output to the output of 'file'.

Bug fix: in 't' helper, declare loop var $i as local
to avoid contaminating caller

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
2020-05-28 10:00:13 +00:00
e41089244b Attempt to turn on build_without_cgo tests
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-22 12:56:19 -04:00
f9c392f50a V2 API Version Support
* Update blang/semver to allow ParseTolerant() support
* Provide helper functions for API handlers to obtain client's 'version'
  path variable focused on API endpoint tree: libpod vs. compat
* Introduce new errors:
  * version not given in path, endpoints may determine if this is a hard
    error (ErrVersionNotGiven)
  * given version not supported (ErrVersionNotSupported), only a soft
    error if the handler is going to hijack the connection
* Added unit tests for version parsing
* bindings check version on connect:
  * client <= Server API version connection is continued
  * client >= Server API version connection fails

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-05-20 10:21:30 -07:00
517bc28360 system tests must pass
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-28 15:17:00 -05:00
ba430bfe5e podman v2 remove bloat v2
rid ourseleves of libpod references in v2 client

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-16 12:04:46 -05:00
55eea9127a logformat: handle apiv2 results, add anchor links
apiv2 tests emit TAP-compliant output; recognize it and
highlight it the same way we do BATS tests.

Add anchor links to TAP output, so other tools (e.g.
cirrus-flake-summarize) can link to particular lines

And, remove a "-f" from "wait" in test-apiv2; looks
like there's some version of bash used in some CI VM
that doesn't grok it.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-04-08 12:10:24 -06:00
46e434e2cb API v2 tests: usability improvements
* Allow for descriptive comment in 't' invocations, making it
  easier to distinguish similar requests
* Include test file basename (eg 40-pods) in 'ok/not ok' line
* Always symlink $TMPDIR/test-apiv2.log to latest YYMMDDetc file
* Include test result ('ok', 'not ok') in said log
* When curl results are JSON, filter them through jq into log

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-27 12:25:59 -06:00
e56d529561 podmanv2 pod create using podspecgen
using the factory approach similar to container, we now create pods based on a pod spec generator.  wired up the podmanv2 pod create command, podcreatewithspec binding, simple binding test, and apiv2 endpoint.

also included some code refactoring as it introduced as easy circular import.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-27 09:04:10 -05:00
c5ce210f7d podmanv2 pod subcommands
add pod kill, pause, restart, rm, start, stop, and unpause

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-26 14:14:05 -05:00
88cd648816 APIv2 tests: add tests for stop
...and allow status 'stopped' in addition to 'exited'.

Fixes: #5336

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-03 06:40:27 -07:00
5612089412 CI: add API v2 tests
API v2 has been quiet for a few days, and the test script is
actually passing. Let's take advantage of this opportunity
to get them running in CI.

Requires adding a check for cgroupsv2

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-02 13:19:42 -07:00
f25c595cb8 apiv2 tests: add more pod tests, timing check
Looks like /libpod/pods/create has been fixed to return an
actual pod ID. Extend those tests.

Also, update timeout in the server command: it's now seconds,
not milliseconds.

Also, update FIXME comments in /pods/prune . Still doesn't
work, but clarify what we're seeing.

Also, add a new test that runs ten /info requests and
barfs if it takes more than 5 seconds.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-25 06:42:27 -07:00
0af16eb15b API v2 tests: catch up to moving target
Lots has changed since I first checked this in:

 * Switch to new podman system service invocation
 * /containers API has changed drastically
 * /pods API has some fixes; check for them (e.g.
   container-exists is now 409 Conflict, not 500)
 * One test ('?invalidparam=x') still doesn't work;
   comment it out so we can get everything passing.

Also, some work on the test framework itself:

 * Cleaner port-open testing (the bash /dev/tcp check).
 * Add a 'podman' function to invoke local podman and
   log its output.

The above two allow us to:

 * Get rid of stderr special-casing

Furthermore:

 * t() no longer needs leading '.'; this allows jq
   features such as 'length' and perhaps other filters
 * special-case handling of 204 and 304: rfc2616 demands
   that they return no message body; assert that it is so.
 * new root & rootless helper functions (check server)
 * remove the "unlikely to work" message for rootless;
   it seems to be working fine
 * fix pod tests for rootless
   * BUT: add a bolder FIXME because the ID field seems wrong

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-11 14:31:12 -07:00
c2f50499c9 Tests for API v2
Initial framework for testing the version 2 (HTTP) API.
Includes a collection of tests for some of the existing
endpoints. Not all tests are currently passing.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-01-17 09:59:22 -07:00