6383 Commits

Author SHA1 Message Date
4b3890ccac remote: fix incorrect CONTAINER_CONNECTION parsing
When a user specifies a invalid connection in CONTAINER_CONNECTION then
podman should return a proper error saying so. Currently it ignored the
error and in rootFlags() just exited early with defining any flags. This
caused a panic then when trying to use the flags later.

In order to address this first store the connection error in the
PodmanConfig struct and not abort right away during flag setup. This is
important as the user might have specified a flag with a valid remote
connection. As such we check all flags and only when none were given we
return the connection error.

Also while at it I noticed that the default connection reported via
podman --help was wrong as it only used the old containers.conf field
for it and did not consider the podman-connections.json default.

New regression tests have been added to make sure it behaves correctly.

This fixes the problem reported in the PR #22997.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-21 14:01:22 +02:00
64a9c73330 Merge pull request #23056 from rst0git/fix-restore-into-pod
restore: fix container restore into pod
2024-06-21 08:59:29 +00:00
8be9ec7216 e2e: test container restore in pod by name
Add a test to verify that restoring a container in a Pod works when
the `container restore --pod` option is used with Pod *name* (this
functionality was previously limited to support only full Pod ID).

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2024-06-21 05:52:40 +01:00
3f785e8735 systests: kube: bump up a timeout
PR #22821 (CI speedup) was overly aggressive in one kube test.
It's flaking. Bump up timeout from 3s to 4.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-06-20 14:37:25 -06:00
fdaef4609f Merge pull request #23029 from ygalblum/quadlet-template-unescaped
Quadlet - use specifier for unescaped values for templated container name
2024-06-20 18:47:01 +00:00
f6be78d2c6 Merge pull request #23053 from mariushoch/main
sqlite_state: Fix RewriteVolumeConfig
2024-06-20 17:32:45 +00:00
6dd9abf9ec sqlite_state: Fix RewriteVolumeConfig
The VolumeConfig table does not have an ID column, thus
use the Name column to update it.

Fixes #23052

Signed-off-by: Marius Hoch <mail@mariushoch.de>
2024-06-20 11:39:44 +02:00
83549ba11f chore(deps): update dependency setuptools to ~=70.1.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-19 13:37:57 +00:00
91a5c0de2a Quadlet - use specifier for unescaped values for templated container name
The escaped version replaces - with / which creates an invalid container name
See https://github.com/containers/podman/issues/22874#issuecomment-2175559746

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2024-06-19 14:44:21 +03:00
4e0cd49148 test/system: check for leaks in teardown suite
At the end of all tests always check for leaks. That should make us more
robust against adding tests at the end that would leak stuff otherwise.

TODO: something seems wrong with bats when returning an error in
teardown_suite(), it prints a warning:
bats warning: Executed <NUM+1> instead of expected <NUM> tests
And also the output is formatted weirdly in this case where the podman
args are split over multiple lines.
But the test fails as expected so I don't think it is a problem.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-18 11:06:51 +02:00
81c90f51c2 test/system: speed up basic_{setup,teardown}()
While these are not really slow they still take about 100-250ms if I
time this locally. Given they are run for every test this adds up
quickly. Looking at CI logs I can see the timings for skipped
tests are all in 600ms range. So I think it is safe to assume that these
functions need to get faster.

We have over 670 test cases currently so we talk about over 400s spend
in these functions in CI. This allows for big gains.

Now overall this is a tricky trade of, while all tests should cleanup
after themselves there is no guarantee for that as such errors can be
leaked into other tests making debugging much harder. To work at least a
bit against this teardown checks if the test was successful and only
skips the podman commands bases on that. Without it a single flake could
cause all following tets to fail.

As such this commit does the proper setup once one suite start then only
after a test failed.

In order for this to work at all we have to fix all leaks first, see
previous commits. And then for the future keep a very strong eye on
this during reviews.

Also add a PODMAN_BATS_LEAK_CHECK option

By default test must cleanup themselves and to speed up CI we no longer
do any cleanup in teardown by default. However there is still many cases
where we might have to debug a leak so add a new PODMAN_BATS_LEAK_CHECK
env option that can be set and should cause teardown to fail if the test
did not cleanup properly.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-18 11:06:50 +02:00
a2352fa3ea test/system: fix up many tests that do not cleanup
All tests should cleanup themselves and not leak stuff.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-18 11:06:49 +02:00
e9c6cd1559 test/system: fix podman --authfile=nonexistent-path
Remove leaking containers and remove unessesary push/pull args. For push
it tries to push an image as argument which makes no sense and for pull
we try to pull argument as image which is also wrong.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-18 11:06:47 +02:00
00bcd9aa81 Merge pull request #22733 from nalind/system-check
Add `podman system check`
2024-06-13 10:35:56 +00:00
267d838e38 ExitWithError, continued
Low-hanging fruit: Exit(X) with no error message
is now ExitWithError(X, "")

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-06-12 08:48:19 -06:00
798beb47ec Merge pull request #22694 from jmaibaum/quadlet-build
Quadlet: Add support for .build files
2024-06-11 20:41:28 +00:00
f79ede86c6 Merge pull request #22914 from Luap99/start-stopped
libpod: do not reuse networking on start
2024-06-11 19:18:55 +00:00
ad8fc6a74b --squash --layers=false should be allowed
This is the same as what --squash-all is doing, and we already support
--squash with --layers=true since this is the default.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-06-10 13:24:05 -04:00
a9de888a15 libpod: do not resuse networking on start
If a container was stopped and we try to start it before we called
cleanup it tried to reuse the network which caused a panic as the pasta
code cannot deal with that. It is also never correct as the netns must
be created by the runtime in case of custom user namespaces used. As
such the proper thing is to clean the netns up first.

Also change a e2e test to report better errors. It is not directly
related to this chnage but it failed on v1 of this patch so we noticed
the ugly error message it produced. Thanks to Ed for the fix.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-07 17:50:28 +02:00
f317eb29ab ExitWithError() - continued
Convert Exit(N) to ExitWithError(N, "expected error")

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-06-06 12:00:16 -06:00
c3728a50e6 Merge pull request #22908 from containers/renovate/golang.org-x-tools-0.x
fix(deps): update module golang.org/x/tools to v0.22.0
2024-06-05 14:52:52 +00:00
42ffa4db43 Merge pull request #22886 from Luap99/fast-system-test-3
test/system: make some tests faster part 3
2024-06-05 13:19:00 +00:00
f4b14c11ef fix(deps): update module golang.org/x/tools to v0.22.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-05 10:59:51 +00:00
b63767866e Merge pull request #22895 from Luap99/hc-startup-leak
libpod: do not leak systemd hc startup unit timer
2024-06-04 17:41:21 +00:00
37339f5a30 Merge pull request #22859 from ut-wangbo/hostname-new-line
libpod: hostname written to /etc/hostname ends with a newline character
2024-06-04 17:12:53 +00:00
e8ea1e7632 libpod: do not leak systemd hc startup unit timer
This fixes a regression added in commit 4fd84190b8, because the name was
overwritten by the createTimer() timer call the removeTransientFiles()
call removed the new timer and not the startup healthcheck. And then
when the container was stopped we leaked it as the wrong unit name was
in the state.

A new test has been added to ensure the logic works and we never leak
the system timers.

Fixes #22884

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 18:03:46 +02:00
350dfabf66 test/system: speed up podman ps --external
The buildah buil kill trick is bad as we have to sleep and wait to aboid
flakes which takes time. Instead it is possible to redo this build part
manually with buildah commands. It is not trival and harder to
understand but it safes 2-3s so I think it is worth it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:24:01 +02:00
8fa1ffbbec test/system: speed up podman network connect/disconnect
Combine multiple inspect --format into one, it is not much but is makes
it faster by a few 100 ms.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:24:01 +02:00
8640ce998c test/system: speed up podman network reload
First, as root don't wait 5s for the timeout, 1s is enough. Also switch
to use the curl --max-time option instead, that way we know we do not
kill curl before it had the chance to do anything possibly.

Second, combine podman inspect commands into one. This makes the test
faster by over one second as we safe a bunch of podman commands.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:24:00 +02:00
609146fb75 test/system: speed up quadlet - pod simple
Another case of contianer does not exit with SIGTERM so we waste 10s.
Now because our contianer reacts to sigterm and exits 0 the systemd unit
status changed to inactive from failed.
And most importantly add Notify=yes because the socat call always failed
as the default is to not leak the notify socket into the container.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:24:00 +02:00
7f3bb2d238 test/system: speed up podman parallel build should not race
It is not clear at all why the count of 30 was choosen, this seems a
lot and of course takes quite a while. The test takes over 16s in CI.
To speed it up reduce the count to 10. I think this should still be good
enough to ensure there are no races IMO.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:24:00 +02:00
8852614792 test/system: speed up podman cp dir from host to container
It makes the test a bit uglier but I cannot see a good way to sped this
up otherwise. I chnaged the created test to only start/stop the
contianer once instead of every test case iteration. This makes it about
2s faster locally.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:24:00 +02:00
8d3f65b026 test/system: speed up podman build - workdir, cmd, env, label
Overall just combine several container runs into one. Every RUN
instruction will run a new container which is quite expensive so chain
the commands together. The same for podman run's.
I could have combined a bit more but I think this leaves it still
readable. This speeds up the test about 4s locally from 8s before.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:24:00 +02:00
471e001c7f test/system: speed up podman --log-level recognizes log levels
Use podman version over podman info because info has to query a lot of
internal state, e.g. contianer and image count, so it is slower than a
simple info. This speeds the test up by about 600ms locally.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:24:00 +02:00
26bdb5d110 test/system: remove obsolete debug in net connect/disconnect test
Issue #11825 was fixed a long time ago. Also we no longer test
cni/dnsname so there is really no point in having this.
Speeds up the test by 1 second.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:23:59 +02:00
c466377013 test/system: speed up quadlet - basic
Another case of contianer does not exit with SIGTERM so we waste 10s.
Now because our contianer reacts to sigterm and exits 0 the systemd
unit status changed to inactive from failed.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:23:59 +02:00
6b021dd4ba test/system: speed up user namespace preserved root ownership
We don't have two loop twice for the stat call we can just stat both
dirs at once. This means we only have to create half of the containers
so the test is twice as fast.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-04 16:23:59 +02:00
2e70d4201f System tests: add podman system check tests
Testing `podman system check` requires that we have a way to
intentionally introduce storage corruptions.  Add a hidden `podman
testing` command that provides the necessary internal logic in
subcommands.  Stub out the tunnel implementation for now.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-06-04 10:00:37 -04:00
7243c7109c fix(libpod): add newline character to the end of container's hostname file
debian's man (5) hostname page states "The file should contain a single newline-terminated hostname
string."
[NO NEW TESTS NEEDED]

fix #22729

Signed-off-by: Bo Wang <wangbob@uniontech.com>
2024-06-04 15:20:04 +08:00
241821b77d Merge pull request #22707 from rhatdan/stats
Fail earlier when no containers exist in stats
2024-06-03 15:55:48 +00:00
d78ffd9ccc Merge pull request #22766 from containers/renovate/requests-2.x
chore(deps): update dependency requests to ~=2.32.3
2024-06-03 15:42:00 +00:00
164573dc34 test/e2e: use local skopeo not image
The e2e tests already depend on skopeo anyway and pulling a over 300
MB image is not helpful for flakes but most importantly we see ENOSPC
flakes. I see them around the skopeo test so I assume the big image is
pushing the tmpfs limits so other tests running in parallel can start
failing because of it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-03 12:26:59 +02:00
b146f9126a chore(deps): update dependency requests to ~=2.32.3
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-31 13:12:50 +00:00
900e29549a libpod: do not move podman with --cgroups=disabled
The expectation with --cgroups=disabled is that the current cgroup is
used by the container.

Currently the --cgroups=disabled is passed directly to the OCI
runtime, but it doesn't stop Podman from creating a new cgroup when it
doesn't own the current one.

Closes: https://github.com/containers/podman/issues/20910

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-05-30 16:59:30 +02:00
5dc1738c05 test: look at the file base name
make the test more robust when an absolute path is used.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-05-29 22:21:21 +02:00
6243f5cebe tests: simplify expected output
the condition doesn't work when the runtime to use is specified
through its absolute path as the error message contains that.

Simplify the check and just look for "read from the init process".

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-05-29 22:00:03 +02:00
846d717c0b Merge pull request #22826 from Luap99/fast-system-test-2
test/system: make some tests faster part 2
2024-05-29 12:59:09 +00:00
4adb5cbbff Fail earlier when no containers exist in stats
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-05-29 06:38:56 -04:00
ad661b5b31 test/system: speed up kube generate tmpfs on /tmp
The command does not react on sigterm, so kube down needs to wait 10s.
To fix it first use a command that does but also write the yaml
directly instead of doing the podman create && kube generate dance.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-05-29 11:01:16 +02:00
bff0697de8 test/system: speed up podman kube play tests
use a command that stops on SIGTERM not sleep, that way the tests can
continue to use podman kube down without waiting for the full stop
timeout every time.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-05-29 11:01:16 +02:00