Commit Graph

45 Commits

Author SHA1 Message Date
Jakub Guzik c5beaf0e17 Recreate until container prune tests for bindings
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-04-01 12:10:31 +02:00
Jakub Guzik e174a8b5da Fix bindings prune containers flaky test
In #9863 prune containers filter params were narrowed to support only those
required by http API. name filter in bindings was replaced by until filter,
which is not a good match, as until filters are causing tests to be flaky.

Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-31 13:40:55 +02:00
Jakub Guzik f7d82a1f30 Containers prune endpoint should use only prune filters
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>
2021-03-30 10:19:22 +02:00
Jhon Honce 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
Valentin Rothberg 5dded6fae7 bump go module to v3
We missed bumping the go module, so let's do it now :)

* Automated go code with github.com/sirkon/go-imports-rename
* Manually via `vgrep podman/v2` the rest

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-02-22 09:03:51 +01:00
Matej Vasek fc385806df Improve ContainerEngine.ContainerWait()
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-02-03 21:49:09 +01:00
Daniel J Walsh 073f76c132
Switch podman stop/kill/wait handlers to use abi
Change API Handlers to use the same functions that the
local podman uses.

At the same time:

 implement remote API for --all and --ignore flags for podman stop
 implement remote API for --all flags for podman stop

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-29 14:04:44 -05:00
baude 4ccb0729b4 Add binding options for container|pod exists
It turns out an options was added to container exists so it makes sense
to have pods and container exists calls have an optional structure for
options.

Signed-off-by: baude <bbaude@redhat.com>
2021-01-18 13:48:51 -06:00
Baron Lenardson b90f7f9095 Rework pruning to report reclaimed space
This change adds code to report the reclaimed space after a prune.
Reclaimed space from volumes, images, and containers is recorded
during the prune call in a PruneReport struct. These structs are
collected into a slice during a system prune and processed afterwards
to calculate the total reclaimed space.

Closes #8658

Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
2020-12-30 19:57:35 -06:00
baude 401dcff838 podman v3 container bindings
convert the golang container bindings to all use options so that changes
in the future are more managable.

Signed-off-by: baude <bbaude@redhat.com>
2020-12-21 09:21:46 -06:00
Daniel J Walsh c734c13904
Fix potential race condition in testing
The It("podman wait to pause|unpause condition"... test is
flaking every so often when a messages is sent in the second
function to a channel.  It is my believe that in between the time
the first function sends a message to the channel and before it closes
the channel the second errChan=make() has happened.  This would mean that
the fist function closes the second errChan, and then when the second
function sends a message to the second errChan, it fails and blows up with
the error you are seeing.

By creating a different variable for the second channel, we eliminate the race.

Fixes: https://github.com/containers/podman/issues/6518

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-01 14:11:04 -05:00
Daniel J Walsh db23e12611
Add support for external container
External containers are containers created outside of Podman.
For example Buildah and CRI-O Containers.

$ buildah from alpine
alpine-working-container
$ buildah run alpine-working-container touch /test
$ podman container exists --external alpine-working-container

$ podman container diff alpine-working-container
C /etc
A /test

Added --external flag to refer to external containers, rather then --storage.

Added --external for podman container exists and modified podman ps to use
--external rather then --storage.  It was felt that --storage would confuse
the user into thinking about changing the storage driver or options.

--storage is still supported through the use of aliases.

Finally podman contianer diff, does not require the --external flag, since it
there is little change of users making the mistake, and would just be a pain
for the user to remember the flag.

podman container exists --external is required because it could fool scripts
that rely on the existance of a Podman container, and there is a potential
for a partial deletion of a container, which could mess up existing users.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-15 09:51:31 -04:00
zhangguanzhang 4a2c4c3989 Fix podman-remote ps --ns broken
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-10-04 19:48:13 +08:00
Ed Santiago d36c4e0d5d bindings: reenable flaky(?) pause/unpause test
Reference: #6518, a very-frequently-flaking CI test, disabled
a month ago (#7143) because it was triggering so often in CI.
Unfortunately, that seems to have simply swept the problem
under the rug. AFAICT nobody has bothered to look at the
root bug, so let's just reenable. If the problem persists,
I'll let annoyed developers squeaky-wheel 6158 so there's
some incentive to fix it. If the problem has miraculously
gone away in the last month, that's a win too.

(This test failure does not reproduce on my laptop, nor
does it lend itself to devising a simple reproducer on
a test VM.)

Also: since #5325 appears to have been closed as fixed,
remove a 'Skip' that references it. Unfortunately this
also requires removing a lot of other cruft. This was
an incidental oh-by-the-way addition that I thought
would be trivial but ended up causing a much larger diff.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-08-31 10:53:14 -06:00
Matthew Heon 569854d634 Unconditionally retrieve pod names via API
The ListContainers API previously had a Pod parameter, which
determined if pod name was returned (but, notably, not Pod ID,
which was returned unconditionally). This was fairly confusing,
so we decided to deprecate/remove the parameter and return it
unconditionally.

To do this without serious performance implications, we need to
avoid expensive JSON decodes of pod configuration in the DB. The
way our Bolt tables are structured, retrieving name given ID is
actually quite cheap, but we did not expose this via the Libpod
API. Add a new GetName API to do this.

Fixes #7214

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-08-10 10:15:51 -04:00
Ed Santiago 52375c033a bindings: skip flaky pause/unpause test
The "podman wait to pause|unpause condition" test is failing
several times a day, always a flake. Issue #6518.

Disable it until the cause can be identified and fixed.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-07-29 11:30:09 -06:00
Daniel J Walsh a5e37ad280
Switch all references to github.com/containers/libpod -> podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 08:23:45 -04:00
Valentin Rothberg 8489dc4345 move go module to v2
With the advent of Podman 2.0.0 we crossed the magical barrier of go
modules.  While we were able to continue importing all packages inside
of the project, the project could not be vendored anymore from the
outside.

Move the go module to new major version and change all imports to
`github.com/containers/libpod/v2`.  The renaming of the imports
was done via `gomove` [1].

[1] https://github.com/KSubedi/gomove

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-06 15:50:12 +02:00
Sujil02 4a3f3b5c02 Adds more docker py test
Addes more docker py test
Optimize test to import images from cache
Rename test class and dir for python unittest framework

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-06-15 02:57:55 -04:00
Jhon Honce f51e0d0597 V2 enable remote logs and testing
* wire up bindings and handler for obtaining logs remotely
* enable debug logging from podman in e2e test using DEBUG and
  DEBUG_SERVICE env variables
* Fix error in streaming log frames
* enable remote logs test

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-05-22 07:51:29 -07:00
Jhon Honce f587fa3ba3 Make convenience boxed true/false easier to use
* changed PFalse to &false
* changed PTrue to &true

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-05-14 13:35:59 -07:00
Jhon Honce b6113e2b9e WIP V2 attach bindings and test
* Add ErrLostSync to report lost of sync when de-mux'ing stream
* Add logus.SetLevel(logrus.DebugLevel) when `go test -v` given
* Add context to debugging messages

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-05-13 11:49:17 -07:00
Lokesh Mandvekar 1ca263bdfc bindings tests for container remove and inspect
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-05-08 15:50:24 -04:00
Brent Baude a4c607cc71 set binding tests to required
some small fix ups for binding tests and then make them required.

update containers-common

V2 bindings tests were failing because of changes introduced in commit
a2ad5bb.

Fix some typos.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>

in the case where the specgen attribute for Env and Labels are nil, we should should then make the map IF we have labels and envs that need to be added.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-08 09:05:37 -05:00
Lokesh Mandvekar bee486b91f Fix NewSpecGenerator args in pkg/bindings/test
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-04-27 11:29:43 -04:00
Sujil02 ec4060aef6 Ability to prune container in api V2
Adds ability to prune containers for v2.
Adds client side prompt with force flag and filters options to prune.

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-04-15 11:17:33 -04:00
Brent Baude 830f3a4462 v2podman ps revert structure changes
reverting name changes to the listcontainer structure because it negatively impacted the direct consumption of the restful API.  instead we now use a local structure in the CLI to modify the output as needed.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-14 09:40:43 -05:00
Brent Baude d8d1aa49d2 v2podman add container init
add the ability to init a container both local and remote

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-13 19:51:20 -05:00
Brent Baude 6f650a5129 podmanv2 history and image remove templates
remove the use of template functions images and history to allow for straight-forward user experience.  instead of templates we use structs and struct methods.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-13 09:15:24 -05:00
Brent Baude 7d0e0a7129 v2podman container cleanup
add the ability to clean up after a container has attempted to run.  this is also important for podman run --rm --rmi.

also included are fixes and tweaks to various code bits to correct regressions on output.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-09 16:59:33 -05:00
Lokesh Mandvekar ce35fe3730 add tests for kill and exists
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-04-08 10:46:57 -04:00
Valentin Rothberg 9812804f75 podmanv2: implement pod top
Implement `podman pod top` for podmanV2.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-28 17:32:22 +01:00
Valentin Rothberg 500a2d508b podmanV2: implement top
Implement the `top` command for podmanV2.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-27 09:14:01 +01:00
Matthew Heon e42cbdd1b2 Add bindings for Container Exec Create + Inspect
Also adds some basic tests for these two. More tests are needed
but will have to wait for state to be finished.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-03-26 13:33:33 -04:00
Brent Baude c81e065149 podmanv2 enable remote wait
enable remote container wait with condition

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-20 14:33:33 -05:00
Brent Baude d1c26af144 apiv2 add bindings for logs|events
add go-bindings for logs and events. tests were also added.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-19 09:38:00 -05:00
Brent Baude 2099643aa2 add apiv2 healthcheck code
reworking binding and endpoint to actually work.  added documentation in swagger for and various return code possibilities.  add a good start on tests though we need some other container functions not yet implemented for that.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-13 07:43:12 -05:00
Brent Baude 8b5e2a6297 add default network for apiv2 create
during container creation, if no network is provided, we need to add a default value so the container can be later started.

use apiv2 container creation for RunTopContainer instead of an exec to the system podman. RunTopContainer now also returns the container id and an error.

added a libpod commit endpoint.

also, changed the use of the connections and bindings slightly to make it more convenient to write tests.

Fixes: 5366
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-06 14:31:45 -06:00
OpenShift Merge Robot 47c4ea3919
Merge pull request #5347 from baude/apiv2wait
rework apiv2 wait endpoint|binding
2020-03-02 20:23:26 +01:00
Chris Evich e95c493fec
Fix wrong condition in bindings test
Thanks for Brent Baude <bbaude@redhat.com> for the fix.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-28 11:44:16 -05:00
Brent Baude 0904873100 rework apiv2 wait endpoint|binding
added the ability to wait on a condition (stopped, running, paused...) for a container.  if a condition is not provided, wait will default to the stopped condition which uses the original wait code paths.  if the condition is stopped, the container exit code will be returned.

also, correct a mux issue we discovered.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-28 09:36:53 -06:00
OpenShift Merge Robot 9631c30ce4
Merge pull request #5328 from lsm5/trivial-typo-correction
fix trivial typo
2020-02-25 22:57:53 +01:00
Lokesh Mandvekar 4e015cefc2 fix trivial typo
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-02-25 15:44:06 -05:00
Chris Evich 80da73f13c
Temp. skip "remove pause by id" bindings test
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-25 12:34:26 -05:00
Lokesh Mandvekar e3857800d2 add apiv2 tests for podman pause and stop
Initial ginkgo setup credit to Brent Baude <bbaude@redhat.com>

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-02-24 15:05:52 -05:00