summaryrefslogtreecommitdiff
path: root/test/apiv2
Commit message (Collapse)AuthorAge
* Docker compat API - containers create ignores the nameMilivoje Legenovic2020-12-07
| | | | | | /containers/create compat endpoint does not set the name correctly (#7857) Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
* Jira RUN-1106 System handlers updatesJhon Honce2020-12-05
| | | | | | | | * Update tests to reflect system endpoints * First implementation of compat /system/df, only fields that are populated by libpod are set Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Jira RUN-1106 Volumes handlers updatesJhon Honce2020-12-04
| | | | | | * Add tests to verify required fields in responses Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Jira RUN-1106 Network handlers updatesJhon Honce2020-12-04
| | | | | | | | | | | | | | * Add network API tests * Update network create endpoint to return ID not Name Audit: - GET /networks ListNetworks - GET /networks/{id} InspectNetwork - DELETE /networks/{id} RemoveNetwork - POST /networks/create CreateNetwork - POST /networks/prune 405 not implemented Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Merge pull request #8569 from zhangguanzhang/fix-nitOpenShift Merge Robot2020-12-04
|\ | | | | Fix some nit in code and comment
| * Fix some nitzhangguanzhang2020-12-04
| | | | | | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* | Jira RUN-1106 Image handlers updatesJhon Honce2020-12-03
|/ | | | | | | | | | | | | | | | | | | | | | | * Audit and add tests for required fields. * Added issue for /images/load implementation Audit: - GET /images/json GetImages - POST /build BuildImage - POST /build/prune 404 not found - POST /images/create CreateImageFromImage/CreateImageFromSrc - GET /images/{name}/json GetImage - GET /images/{name}/history HistoryImage - POST /images/{name}/push PushImage - POST /images/{name}/tag TagImage - DELETE /images/{name} RemoveImage - POST /images/prune PruneImages - POST /commit CommitContainer - GET /images/{name}/get ExportImage - GET /images/get ExportImages - POST /images/load LoadImages See https://github.com/containers/podman/issues/8586 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Add support for network idsPaul Holzinger2020-12-02
| | | | | | | | | | | | | | | | | | | The network ID is not stored. It is just the sha256 hash from the network name. There is a risk of a potential hash collision. However it's very unlikely and even if we hit this it will complain that more than network with this ID exists. The main benefit is that the compat api can have proper network ID support. Also this adds the support for `podman network ls --format "{{.ID}}"` and `--filter id=<ID>`. It also ensures that we can do network rm <ID> and network inspect <ID>. Since we use a hash this commit is backwards compatible even for already existing networks. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Merge pull request #8505 from Luap99/network-labelsOpenShift Merge Robot2020-12-01
|\ | | | | podman network label support
| * podman network label supportPaul Holzinger2020-11-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add label support for podman network create. Use the `args` field in the cni config file to store the podman labels. Use `podman_labels` as key name and store the labels as map[string]string. For reference: https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#args-in-network-config https://github.com/containernetworking/cni/blob/spec-v0.4.0/SPEC.md#network-configuration Example snippet: ``` ... "args": { "podman_labels": { "key1":"value1", "key2":"value2" } } ... ``` Make podman network list support several filters. Supported filters are name, plugin, driver and label. Filters with different keys work exclusive. Several label filters work exclusive and the other filter keys are working inclusive. Also adjust the compat api to support labels in network create and list. Breaking changes: - podman network ls -f shortform is used for --filter instead --format This matches docker and other podman commands (container ps, volume ps) - libpod network list endpoint filter parameter is removed. Instead the filters paramter should be used as json encoded map[string][]string. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* | Merge pull request #8126 from matejvasek/impl-apiv2-archiveOpenShift Merge Robot2020-12-01
|\ \ | | | | | | Implement containers/{id or name}/archive api
| * | test resource cleanupMatej Vasek2020-11-19
| | | | | | | | | | | | Signed-off-by: Matej Vasek <mvasek@redhat.com>
| * | more testsMatej Vasek2020-11-19
| | | | | | | | | | | | Signed-off-by: Matej Vasek <mvasek@redhat.com>
| * | few more testsMatej Vasek2020-11-19
| | | | | | | | | | | | Signed-off-by: Matej Vasek <mvasek@redhat.com>
| * | add testMatej Vasek2020-11-19
| | | | | | | | | | | | Signed-off-by: Matej Vasek <mvasek@redhat.com>
* | | Add APIv2 tests for kube generateEdward Shen2020-11-30
| |/ |/| | | | | Signed-off-by: Edward Shen <weshen@redhat.com>
* | Refactor compat container create endpointJhon Honce2020-11-23
|/ | | | | | | | | | | | * Make endpoint compatibile with docker-py network expectations * Update specgen helper when called from compat endpoint * Update godoc on types * Add test for network/container create using docker-py method * Add syslog logging when DEBUG=1 for tests Fixes #8361 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* add network connect|disconnect compat endpointsbaude2020-11-17
| | | | | | | | | | | this enables the ability to connect and disconnect a container from a given network. it is only for the compatibility layer. some code had to be refactored to avoid circular imports. additionally, tests are being deferred temporarily due to some incompatibility/bug in either docker-py or our stack. Signed-off-by: baude <bbaude@redhat.com>
* Refactor to use DockerClient vs APIClientJhon Honce2020-11-12
| | | | | | | * Update tests and framework * remove tests for APIClient methods Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Set default network driver for APIv2 networksbaude2020-11-10
| | | | | | | | | | Recent changes in networking require that the cni network driver be set. If the user provides no driver, we set the driver to the defaultnetworkdriver which currently is "bridge". Fixes: #8294 Signed-off-by: baude <bbaude@redhat.com>
* Update CI tests to run python docker library against APIJhon Honce2020-11-09
| | | | | | | | | | | * Update reference to docker-py to docker to reflect change in library name * Update tests to create storage sandbox * Enable all tests that endpoints support * Refactor containers/{id}/rename to return 404 not 500 * Refactor tests to use quay.io vs. docker.io Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Merge pull request #8232 from ashley-cui/volfiltOpenShift Merge Robot2020-11-03
|\ | | | | Make volume filters inclusive
| * Make volume filters inclusiveAshley Cui2020-11-03
| | | | | | | | | | | | | | | | When using multiple filters, return a volume that matches any one of the used filters, rather than matching both of the filters. This is for compatibility with docker's cli, and more importantly, the apiv2 compat endpoint Closes #6765 Signed-off-by: Ashley Cui <acui@redhat.com>
* | Add test/apiv2/rest_api tests to make targetJhon Honce2020-11-02
|/ | | | | | | | * renamed old API tests to not be discovered, they do not pass * Updated the API tests to use a pristine storage configuration * Skipped attach test, it needs to be re-written Signed-off-by: Jhon Honce <jhonce@redhat.com>
* move from docker.ioEd Santiago2020-10-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Followon to #7965 (mirror registry). mirror.gcr.io doesn't cache all the images we need, and I can't find a way to add to its cache, so let's just use quay.io for those images that it can't serve. Tools used: skopeo copy --all docker://docker.io/library/alpine:3.10.2 \ docker://quay.io/libpod/alpine:3.10.2 ...and also: docker.io/library/alpine:3.2 docker.io/library/busybox:latest docker.io/library/busybox:glibc docker.io/library/busybox:1.30.1 docker.io/library/redis:alpine docker.io/libpod/alpine-with-bogus-seccomp:label docker.io/libpod/alpine-with-seccomp:label docker.io/libpod/alpine_healthcheck:latest docker.io/libpod/badhealthcheck:latest Since most of those were new quay.io/libpod images, they required going in through the quay.io GUI, image, settings, Make Public. Signed-off-by: Ed Santiago <santiago@redhat.com>
* Add test cases to cover podman volumeYuhui Jiang2020-10-27
| | | | | | | | | | | | Add test cases to cover below podman volume subcommand: create ls inspect rm prune Signed-off-by: Yuhui Jiang <yujiang@redhat.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Merge pull request #8065 from edsantiago/flake_tweaksOpenShift Merge Robot2020-10-21
|\ | | | | Tests: Fix common flakes, and improve apiv2 test log
| * Tests: Fix common flakes, and improve apiv2 test logEd Santiago2020-10-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* | refactor api compatibility container creation to specgenbaude2020-10-20
|/ | | | | | when using the compatibility layer to create containers, it used code paths to the pkg/spec which is the old implementation of containers. it is error prone and no longer being maintained. rather that fixing things in spec, migrating to specgen usage seems to make the most sense. furthermore, any fixes to the compat create will not need to be ported later. Signed-off-by: baude <bbaude@redhat.com>
* APIv2 tests: try again to fix themEd Santiago2020-10-12
| | | | | | | | | | | | | | | | 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>
* APIv2 tests: get them passing againEd Santiago2020-10-12
| | | | | | | | | | | | | | | | | | | | | In the new-Cirrus transition, APIv2 tests were inadvertently disabled. As expected when tests get disabled, they break. This commit fixes some failing tests, and comments out others (with big FIXMEs) because I have neither the expertise nor time to figure out the real problems. The big change to test-apiv2 is due to a recently-added test that looks for an '=' sign in json output. My '=' vs '~' detector completely barfed on that, and there's just no way to make it work in a bash 'case' statement. So, switch to an 'if' with 'expr'. And, unrelated, fix a longstanding (harmless) bug that was issuing spurious "expected" messages to the test log; those should've been going to the full results log. Signed-off-by: Ed Santiago <santiago@redhat.com>
* Add more APIv2 tests for images: push, tag, untag, rmi and image tree.Edward Shen2020-10-09
| | | | Signed-off-by: Edward Shen <weshen@redhat.com>
* Merge pull request #7891 from rhatdan/rmOpenShift Merge Robot2020-10-09
|\ | | | | This PR allows users to remove external containers directly
| * This PR allows users to remove external containers directlyDaniel J Walsh2020-10-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currenly if a user specifies the name or ID of an external storage container, we report an error to them. buildah from scratch working-container-2 podman rm working-container-2 Error: no container with name or ID working-container-2 found: no such container Since the user specified the correct name and the container is in storage we force them to specify --storage to remove it. This is a bad experience for the user. This change will just remove the container from storage. If the container is known by libpod, it will remove the container from libpod as well. The podman rm --storage option has been deprecated, and removed from docs. Also cleaned documented options that are not available to podman-remote. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | add compatibility endpoint for exporting multiple imagesbaude2020-10-08
|/ | | | | | | | with the recent inclusion of dealing with multiple images in a tar archive, we can now add a compatibility endpoint that was missing images/get?names=one,two. Fixes: #7950 Signed-off-by: baude <bbaude@redhat.com>
* fix apiv2 /containers/$name/json return wrong value in `.Config.StopSignal`zhangguanzhang2020-10-06
| | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* compat: images/create: fix tag parsingValentin Rothberg2020-10-02
| | | | | | | | The `tag` parameter of the compat `images/create` endpoint can be both, a tag and a digest. Fix parsing of the parameter to detect digests and use the appropriate `@` separator. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* fix: The container created by APIV2 has an incorrect Env and WorkDirzhangguanzhang2020-10-01
| | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* apiv2 container limit differ from docker-apizhangguanzhang2020-09-24
| | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* Restore 'id' stanza in pull resultsJhon Honce2020-09-21
| | | | | | | | | | | | | id is the last image id from the set of id's returned via the images stanza. id may be deprecated in a future version of the API Created test_rest_v2_0_0.py to reflect the bump in the API Version. Fixes #7686 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Refactor API version valuesJhon Honce2020-09-15
| | | | | | | | | | | | | | | | * 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>
* Merge pull request #7536 from Luap99/api-network-filterOpenShift Merge Robot2020-09-10
|\ | | | | APIv2 Add network list filtering
| * APIv2 Add network list filteringPaul Holzinger2020-09-07
| | | | | | | | | | | | | | | | | | | | Add the filter option to the libpod endpoint. Add support for the name filter on the docker endpoint. Add apiv2 tests for the network list endpoints. Enable podman network integration tests for remote. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* | Merge pull request #7569 from zhangguanzhang/fix-apiv2-top-response-two-valueOpenShift Merge Robot2020-09-09
|\ \ | |/ |/| fix APIv2 pods top of non-exist pod gets two response value
| * fix APIv2 pods top of non-exist pod gets two response valuezhangguanzhang2020-09-09
| | | | | | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* | APIv2 test: add more tests for containersEdward Shen2020-09-01
|/ | | | Signed-off-by: Edward Shen <weshen@redhat.com>
* fix apiv2 will create containers with incorrect commandszhangguanzhang2020-08-24
| | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* fix /libpod/pods/json returns null when there are no podszhangguanzhang2020-08-21
| | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* Use `bash` binary from env instead of /bin/bash for scriptsSascha Grunert2020-08-17
| | | | | | | | It's not possible to run any of the scripts on distributions which do have `bash` not in `/bin`. This is being fixed by using `/usr/bin/env bash` instead. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
* Add parameter verification for api creation networkzhangguanzhang2020-08-12
| | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>