21 Commits

Author SHA1 Message Date
be24633300 Bump to v5.0.0-dev
Signed-off-by: Ashley Cui <acui@redhat.com>
2023-11-20 15:10:17 -05:00
1b45fd7239 /_ping handler: return OSType http header
The docker client expects to read the OSType header from the `/_ping` response in order to determine the OS type of the server, for example, when running `docker run --device=/dev/fuse ...`

https://github.com/moby/moby/blob/master/client/ping.go#L57

Signed-off-by: chnrxn <cohawk@yahoo.com>
2023-08-28 22:28:16 +08:00
dde4286420 Bump Compat API maximum version to v1.41
Docker bumped their API, so we should do the same.

Fixes #14204

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-05-23 11:31:44 -04:00
609b52f726 Bump version to v4.1.0-dev
I think we forgot to bump the version in the main branch. It should be
v4.1.0-dev now.
Also set the min api version to 4.0.0 as on the podman 4.0 branch.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-27 14:32:28 +02:00
7b51acd4c4 APIv2 tests: fail on syntax/logic errors
(i.e. not test failures, but actual programming bugs).

We've had a number of syntax errors creep into this test, usually
caused by a missing backslash on a test command. I've long wanted
to 'set -e' but that causes other problems. This PR introduces
error handling via 'trap', with useful diagnostics on failure.

This PR also catches and fixes two previously-unknown bugs that
were causing tests to not actually run.

And, since /events takes eons on my high-uptime laptop, add /since

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-14 18:28:50 -07:00
0ab9d19ad5 Bump to v4.0.0-dev
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-08-02 13:27:49 -04:00
c03ff140d8 APIv2 basic test: relax APIVersion check
It is tedious and error-prone to update the 'APIVersion=<exact>'
test every time there's a minor bump. Change the test so it
confirms only the major version.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-03-29 15:32:01 -06:00
637c5d55e1 Bump to v3.2.0-dev
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-03-29 14:03:04 -04:00
258749e43d apiv2 tests: finally fix POST as originally intended
When I originally wrote this code I had no idea what POST
would look like so I did a sloppy job, deferring making it
usable. Now that we have some real-world examples in place,
I have a better understanding of what params look like and
how to make tests more readable/maintainable. (Deferring isn't
always bad: one of my early ideas was to separate params using
commas; that would've been a disaster because some JSON values,
such as arrays, include commas).

This commit implements a better way of dealing with POST:

  * The main concept is still 'key=value'
    * When value is a JSON object (dictionary, array), it
      can be quoted.
    * Multiple params are simply separated by spaces.
      The 3-digit HTTP code is a prominent, readable separator
      between POST params and expected results. The parsing
      code is a little uglier, but test developers need
      never see that. The important thing is that writing
      tests is now easier.
  * POST params can be empty (this removes the need for a
    useless '')

I snuck in one unrelated change: one of the newly-added
tests, .NetworkSettings, was failing when run rootless
(which is how I test on my setup). I made it conditional.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-03-10 05:24:44 -07:00
f86d641308 Use version package to track all versions
* Server, bindings, and CLI all now pull version information from version
package.
* Current /libpod API version slaved to podman/libpod Version
* Bindings validate against libpod API Minimal version
* Remove pkg/bindings/bindings.go and updated tests

Fixes: #9207

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-03-03 17:03:19 -07:00
002f2aca70 Bump remote API version to 3.0.0
Fixes #9175

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-02-04 16:42:29 -05:00
f5b3dc976c Tests: Fix common flakes, and improve apiv2 test log
- apiv2 - the 'ten /info requests' test is flaking often,
  taking ~8 seconds (our limit is 7, up from 5 a few weeks
  ago). Brent suggested that the first /info call might be
  expensive, because it needs to access storage. So, let's
  prime it by running one /info outside the timing loop.
  And, because even that continues to fail, bump it up
  to 10 seconds and file #8076 to track the slowdown.

- toolbox test - WaitForReady() has timed out, even on one
  occasion causing a run failure because it failed 3 times.
  Solution: bump up timeout from 2s to 5s. Not really great,
  but CI systems are underpowered, and it's not unreasonable
  that 2s might be too low.

- sdnotify test - add a 'podman wait' between stop & rm.
  This may prevent a "cannot rm container as it is running"
  race condition.

While working on this, Brent and I noticed a few ways that
test-apiv2 logging can be improved:

- test name: when request is POST, display the jsonified
  parameters, not the original input ones. This should
  make it much easier to reproduce failures.

- use curl's "--write-out" option to capture http code,
  content type, and request time. We were getting the
  first two via grep from logged headers; this is cleaner.
  And there was no other way to get timing. We now include
  the timing as X-Response-Time in the log file.

- abort on *any* curl error, not just 7 (cannot connect).
  Any error at all from curl is bad news.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-10-20 11:32:49 -06:00
2a6a3f333b APIv2 tests: try again to fix them
CI discovered that a lot of networking tests are failing; my
fault, for not having run my tests as root on my laptop.
Disable those.

Also: bump up the ten-request time limit, from 5 to 7 seconds.
Looks like something keeps getting slower and slower, but I
guess there's not much we can do about it.

Also: when we get a mismatch response code (e.g. 500 when we
expect 200), dump the response body and skip any subsequent
response checks.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-10-12 13:57:59 -06:00
8a8bae8299 Refactor API version values
* API-Version header now Major.Minor to support tools parsing this
   header
 * Libpod Version updated to 2.0.0 to reflect changes in API field
   values
 * API-Version and Libpod-API-Version headers are now included in all
   results

Fixes #7327

 * Header support tested against goland 2020.2 and
    https://www.jetbrains.com/help/idea/docker.html plugin

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-15 11:29:45 -07:00
cff727d488 Add versioned _ping endpoint
Fixes #7008

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-07-31 10:19:23 -07:00
724a09e40e test/apiv2: add a simple events test
Add a simple test to exercise the events API without the "filters"
parameter.  Prevents regressing on #7078.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-27 11:51:48 +02: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
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