summaryrefslogtreecommitdiff
path: root/test/apiv2/20-containers.at
Commit message (Collapse)AuthorAge
* Allow filtering of "removing", it is a valid statusDaniel J Walsh2022-04-24
| | | | | | | | | Do not use a list of statuses outside of libpod to validate container statuses. Removing status was never added to the list. Fixes: https://github.com/containers/podman/issues/13986 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* compat api: use network mode bridge as defaultPaul Holzinger2022-04-13
| | | | | | | | | | | For better docker compatibility we should use the bridge network mode as default for rootless. This was already done previously but commit 535818414c2a introduced this regression in v4.0. Since the apiv2 test are only run rootful we cannot catch this problem in CI. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* API: use no_hosts from containers.confPaul Holzinger2022-04-11
| | | | | | | | | The API endpoints should properly honour the `no_hosts=true` setting in containers.conf. Fixes #13719 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Exit with 0 when receiving SIGTERMJhon Honce2022-03-15
| | | | | | | * systemctl stop podman.service will now return exit code 0 * Update test framework to support JSON boolean and numeric values Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Fix handling of tmpfs-mode for tmpfs creation in compat modeDaniel J Walsh2022-03-09
| | | | | | | | | | | | The permissions on disk were wrong since we were not converting to octal. Fixes: https://github.com/containers/podman/issues/13108 [NO NEW TESTS NEEDED] Since we don't currently test using the docker client Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Fix #2 for compat commit handling of --changesDaniel J Walsh2022-01-21
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Merge pull request #12914 from rhatdan/commitOpenShift Merge Robot2022-01-19
|\ | | | | Handle changes in docker compat mode
| * Handle changes in docker compat modeDaniel J Walsh2022-01-19
| | | | | | | | | | | | Fixes: https://github.com/containers/podman/issues/12830 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | APIv2 tests: followup to recent log testEd Santiago2022-01-19
|/ | | | | | | | | | | | | Followup to #12919, which merged while I was writing review feedback. This actually confirms log output. This required a minor change to the 't' helper: stripping NUL chars from the http result. And, while I'm at it, a bunch of cleanup for running rootless: - set $CONTAINERS_HELPER_BINARY_DIR, so we can find rootlessport - add a few conditionals for different expectations Signed-off-by: Ed Santiago <santiago@redhat.com>
* apiv2 test: add regression test for #12904Valentin Rothberg2022-01-19
| | | | | | | | | Add a regression test for issue #12904 to make sure that attaching with logs=true to the compact endpoint does not blow up. Note that I did not find a way to test the output (i.e., '123'); logs are sent in a binary format and I did not find a way to compare the control characters. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Revamp Libpod state strings for Docker compatMatthew Heon2022-01-17
| | | | | | | | | | | | | | | | | | | | | | | | Improve our compatibility with Docker by better handling the state strings that we print in `podman ps`. Docker capitalizes all states in `ps` (we do not) - fix this in our PS code. Also, stop normalizing ContainerStateConfigured to the "Created" state, and instead make it always be Created, with the existing Created state becoming Initialized. I didn't rename the actual states because I'm somewhat reticent to make such a large change a day before we leave for break. It's somewhat confusing that ContainerStateConfigured now returns Created, but internally and externally we're still consistent. [NO NEW TESTS NEEDED] existing tests should catch anything that broke. I also consider this a breaking change. I will flag appropriately on Github. Fixes RHBZ#2010432 and RHBZ#2032561 Signed-off-by: Matthew Heon <mheon@redhat.com>
* use libnetwork from c/commonPaul Holzinger2022-01-12
| | | | | | | | The libpod/network packages were moved to c/common so that buildah can use it as well. To prevent duplication use it in podman as well and remove it from here. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Add podman rm --dependDaniel J Walsh2022-01-11
| | | | | | | | | | | This option causes Podman to not only remove the specified containers but all of the containers that depend on the specified containers. Fixes: https://github.com/containers/podman/issues/10360 Also ran codespell on the code Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Fix Container List API call to return mount infoDaniel J Walsh2022-01-04
| | | | | | | | | We are hard coding mounts to return nil in compat API, since we have the data, we should return it. Fixes: https://github.com/containers/podman/issues/12734 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* prefix imageId with sha256: in containers listOliver2021-12-29
| | | | | | test for compat API ImageId Signed-off-by: Oliver Thallmair <oliver.thallmair@mailbox.org>
* APIv2 tests: fail on syntax/logic errorsEd Santiago2021-12-14
| | | | | | | | | | | | | | | | (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>
* Fix panic in container create compat apiPaul Holzinger2021-10-14
| | | | | | | | | The bind and tmpfs options can be nil, we have to check that before we try to use it. Fixes #11961 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* api: handle nil pointer dereference in rest endpointsJelle van der Waa2021-09-15
| | | | | | | | When `?all=garbage` is passed to an API endpoint schema validation fails and err is nil. Wrapf uses err to create an error message causing a nil pointer dereference. Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
* Add support for mount options to APIJhon Honce2021-08-27
| | | | | | | | When creating containers the specialized mount options where not populated via the API. Fixes: #10831 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Fixed healthcheck default values when container created via compat APIMilivoje Legenovic2021-08-14
| | | | | | Fixes #11225 Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
* Only support containers stats using cgroups v2Jhon Honce2021-08-03
| | | | | | Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1988252 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Fix broken volume and container testsAlex Schultz2021-07-14
| | | | | | | | | There are a handful of tests that aren't actually being run because there are missing \ which is prevented the tests from being executed. Additionally some of the test syntax was incorrect but not showing up because these tests didn't run. Signed-off-by: Alex Schultz <aschultz@redhat.com>
* Fix compat create with NetworkMode=defaultMatthew Heon2021-06-07
| | | | | | | | | | | The rework of namespace handling for rootless CNI broke this, as CNI networks were being computed incorrectly. Fix handling of CNI networks for the Compat Create REST API for containers, and add a test so we don't regress again. Fixes #10569 Signed-off-by: Matthew Heon <mheon@redhat.com>
* fix: use UTC Time Stamps in response JSONMatej Vasek2021-05-10
| | | | Signed-off-by: Matej Vasek <mvasek@redhat.com>
* migrate Podman to containers/common/libimageValentin Rothberg2021-05-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Migrate the Podman code base over to `common/libimage` which replaces `libpod/image` and a lot of glue code entirely. Note that I tried to leave bread crumbs for changed tests. Miscellaneous changes: * Some errors yield different messages which required to alter some tests. * I fixed some pre-existing issues in the code. Others were marked as `//TODO`s to prevent the PR from exploding. * The `NamesHistory` of an image is returned as is from the storage. Previously, we did some filtering which I think is undesirable. Instead we should return the data as stored in the storage. * Touched handlers use the ABI interfaces where possible. * Local image resolution: previously Podman would match "foo" on "myfoo". This behaviour has been changed and Podman will now only match on repository boundaries such that "foo" would match "my/foo" but not "myfoo". I consider the old behaviour to be a bug, at the very least an exotic corner case. * Futhermore, "foo:none" does *not* resolve to a local image "foo" without tag anymore. It's a hill I am (almost) willing to die on. * `image prune` prints the IDs of pruned images. Previously, in some cases, the names were printed instead. The API clearly states ID, so we should stick to it. * Compat endpoint image removal with _force_ deletes the entire not only the specified tag. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* compat api: Networks must be empty instead of nullPaul Holzinger2021-05-04
| | | | | | | | | The compat endpoint for container inspect must return {} instead of null for NetworkSettings.Networks. Fixes #9837 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Containers prune endpoint should use only prune filtersJakub Guzik2021-03-30
| | | | | | | | Containers endpoints for HTTP compad and libpod APIs allowed usage of list HTTP endpoint filter funcs. Documentation in case of libpod and compat API does not allow that. This commit aligns code with the documentation. Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
* Fix containers list/prune http api filter behaviourJakub Guzik2021-03-20
| | | | | | | | | | The problem described in #9711 and followed by #9758 affects containers as well. When user provides wrong filter input, error message should occur, not fallback to full list/prune command. This change fixes the issue. Additionally, there are error message fixes for docker http api compat. Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
* Merge pull request #9686 from edsantiago/apiv2_jsonifyDaniel J Walsh2021-03-11
|\ | | | | apiv2 tests: finally fix POST as originally intended
| * apiv2 tests: finally fix POST as originally intendedEd Santiago2021-03-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Removing a non existing container API should return 404Daniel J Walsh2021-03-10
|/ | | | | | | | | | | | | | | | | | Currently we were overwrapping error returned from removal of a non existing container. $ podman rm bogus -f Error: failed to evict container: "": failed to find container "bogus" in state: no container with name or ID bogus found: no such container Removal of wraps gets us to. ./bin/podman rm bogus -f Error: no container with name or ID "bogus" found: no such container Finally also added quotes around container name to help make it standout when you get an error, currently it gets lost in the error. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Respect NanoCpus in Compat CreateMatthew Heon2021-03-04
| | | | | | | | | | The NanoCpus field in HostConfig was not wired up. It conflicts with CPU period and quota (it hard-codes period to a specific value and then sets the user-specified value as Quota). Fixes #9523 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
* Add network summary to compat psbaude2021-03-03
| | | | | | | | | The compatibility endpoint for listing containers should have the summarized network configuration with it. Fixes: #9529 Signed-off-by: baude <bbaude@redhat.com>
* Compat api containers/json Ports field is nullMilivoje Legenovic2021-03-02
| | | | | | Fixes #9553 Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
* APIv2 tests: make more maintainableEd Santiago2021-03-01
| | | | | | | | | | | | | | | While I wasn't looking, some completely unreadable cruft crept in here, and it's totally my fault: I never knew you could pass JSON to a GET query. Everyone who DID know that, did so, but had to URL-escape it into a completely gobbledygook mess to make curl happy. Solution: trivial, do the URL-escaping in 't' itself. I just never realized that was needed. I'm so sorry. I hope this helps. Signed-off-by: Ed Santiago <santiago@redhat.com>
* Quote URLNikolay Edigaryev2021-02-18
| | | | Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com>
* API: fix libpod's container wait endpoint condition conversionNikolay Edigaryev2021-02-18
| | | | Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com>
* Ensure the Volumes field in Compat Create is honoredMatthew Heon2021-01-26
| | | | | | | | | | | | | | | | Docker has, for unclear reasons, three separate fields in their Create Container struct in which volumes can be placed. Right now we support two of those - Binds and Mounts, which (roughly) correspond to `-v` and `--mount` respectively. Unfortunately, we did not support the third, `Volumes`, which is used for anonymous named volumes created by `-v` (e.g. `-v /test`). It seems that volumes listed here are *not* included in the remaining two from my investigation, so it should be safe to just append them into our handling of the `Binds` (`-v`) field. Fixes #8649 Signed-off-by: Matthew Heon <mheon@redhat.com>
* Compat api containers/json add support for filtersPaul Holzinger2021-01-01
| | | | | | Fixes #8860 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Fix Wrong image tag is used when creating a container from an image with ↵zhangguanzhang2020-12-11
| | | | | | multiple tags Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* Fix some nitzhangguanzhang2020-12-04
| | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.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>
* 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: 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>
* 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>
* fix apiv2 /containers/$name/json return wrong value in `.Config.StopSignal`zhangguanzhang2020-10-06
| | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.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>
* fix apiv2 will create containers with incorrect commandszhangguanzhang2020-08-24
| | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* Switch all references to github.com/containers/libpod -> podmanDaniel J Walsh2020-07-28
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>