5443 Commits

Author SHA1 Message Date
f1c68b79eb add hostname to network alias
We use the name as alias but using the hostname makes also sense and
this is what docker does. We have to keep the short id as well for
docker compat.

While adding some tests I removed some duplicated tests that were
executed twice for nv for no reason.

Fixes #17370

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-11 15:38:24 +02:00
72a1857e43 e2e: Fetch the correct user name
When fetching the user name, you need to use User.Username
instead of User.Name, as with other tests.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-07-11 13:51:47 +09:00
7b54fd84ec Add --no-trunc flag to maintain original annotation length
Adds a `--no-trunc` flag to `podman kube generate` preventing the
annotations from being trimmed at 63 characters. However, due to
the fact the annotations will not be trimmed, any annotation that is
longer than 63 characters means this YAML will no longer be Kubernetes
compatible. However, these YAML files can still be used with `podman
kube play` due to the addition of the new flag below.

Adds a `--no-trunc` flag to `podman kube play` supporting YAML files with
annotations that were not truncated to the Kubernetes maximum length of
63 characters.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2023-07-10 18:02:53 -04:00
eb9d44241e Merge pull request #19004 from rhatdan/secret
Add --replace flag to podman secret create
2023-07-10 14:59:29 -04:00
7b08e024c1 Merge pull request #19180 from vrothberg/fix-19147
manifest inspect: support authentication
2023-07-10 14:40:29 -04:00
97fd03ccdf test/e2e: wait for socket
Do not use podman info/version as they are expensive and clutter the log
for no reason. Just checking if we can connect to the socket should be
good enough and much faster.

Fix the non existing error checking, so that we actually see an useful
error when this does not work.

Also change the interval, why wait 2s for a retry lets take 100ms steps
instead.

Fixes #19010

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-10 17:27:11 +02:00
a69194b02f manifest inspect: support authentication
Previous tests have worked by pure chance since the client and server
ran on the same host; the server picked up the credentials created by
the client login.

Extend the gating tests and add a new integration test which is further
capable of exercising the remote code.

Note that fixing authentication support requires adding a new
`--authfile` CLi flag to `manifest inspect`.  This will at least allow
for passing an authfile to be bindings.  Username and password are not
yet supported.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-07-10 16:26:19 +02:00
efefd8cf5b Add --replace flag to podman secret create
Users may want to replace the secret used within containers, without
destroying the secret and recreating it.

Partial fix for https://github.com/containers/podman/issues/18667

Make sure podman --remote secret inspect and podman secret inspect
return the same error message.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-09 07:26:09 -04:00
531fb21d03 fix(deps): update module golang.org/x/tools to v0.11.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-05 17:43:10 +00:00
99f93d55c4 e2e: fix two toolbox flakes
1. toolbox UID/GID allocation: pick numbers < 1500. Otherwise
   we run the risk of colliding with the Cirrus rootless user.

2. WaitContainerReady(): check the results of the last "podman logs"
   before timing out. Otherwise, the user will see "READY" followed
   immediately by "Container is not ready".
   (global bug, not just toolbox, but that's where I discovered it).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-05 06:52:13 -06:00
93447e292d Merge pull request #19092 from vrothberg/bz-2218315
auto update: fix usage of --authfile
2023-07-05 08:02:46 -04:00
fc5aa9c9ca test/e2e: use GinkgoT().TempDir() over MkdirTemp()
Using GinkgoT().TempDir() will automatically result in the directy to be
cleaned up when the test is done. This should help to prevent leaking
files and we do not need to error check every time.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:40:26 +02:00
ea8992cb45 test/e2e: use random ImageCacheDir
Like LockTmpDir use a random tmpdir for this directory. Make sure it is
set for all parallel ginkgo processes.

Also GinkgoT().TempDir() will automatcially remove the directory at the
end so we do not need to worry about cleanup.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:40:24 +02:00
17a06d3431 test/e2e: remove RHEL7 workaround
AFAIK the latest podman will not even run on RHEL 7 anymore, in any case
we do not need these tests to run there.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:39:57 +02:00
bc22aefce6 test/e2e: remove unnecessary code in SynchronizedAfterSuite
This code does not do anything useful beside removing the cache dir.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:39:46 +02:00
ff77900387 test/e2e: do not use /tmp for podman commands
Using the OS tempdir here is not good. This defaults to /tmp which means
the inital podman test setup uses these paths:
`--root /tmp/root --runroot /tmp/runroot and --tmpdir /tmp`

Thus we create many files directly under /tmp. Also they were never
removed thus leaked out. When running as root and then later as rooltess
this would fail to permission problems.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:39:02 +02:00
db7cb1dbfc test/tools: vendor ginkgo v2.11
Ginkgo currently logs a warning because the cli version (defnied in
test/tools/go.mod) does not match the library version (defnied in
go.mod).

Simply fix this by updating ginkgo to the latest version.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:12:44 +02:00
c20612babc test/e2e: write timings directly to file
There is no need to buffer them all into an array then write them once
at the end. Just write directly to the file.

Fixes #19104

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-05 10:12:43 +02:00
d874790bc6 auto update: fix usage of --authfile
The --authfile flag has been ignored.  Fix that and add a test to make
sure we won't regress another time.  Requires a new --tls-verify flag
to actually test the code.

Also bump c/common since common/pull/1538 is required to correctly check
for updates.  Note that I had to use the go-mod-edit-replace trick on
c/common as c/buildah would otherwise be moved back to 1.30.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2218315
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-07-05 08:30:39 +02:00
ba1355b230 system tests: refactor registry code
The podman-login tests have accumulated much cruft over the
years, because that's the only place where we run a local
registry, and the process was crufty: we actually start/stopped
the registry as the first & last tests of the file. Meaning,
you couldn't do 'hack/bats 150:just-one-test' because that
would skip the registry start. And just now, a completely
unrelated test has had to be shoved into the login file.

This PR revamps the whole thing, by adding a new registry helper
module that can be used anywhere. And, once the registry is
started, it just stays running until the end of tests. (This
requires BATS 1.7 or greater).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-07-04 15:26:55 -06:00
a16488f89d fix(command): ignore --format in podman search --list-tags
Fix: https://github.com/containers/podman/issues/19033

Signed-off-by: Black-Hole1 <bh@bugs.cc>
2023-06-30 18:19:48 +08:00
5561390a00 Merge pull request #19053 from edsantiago/pasta_test_cleanup
pasta system tests: cleanup, fixes, sanity check
2023-06-30 05:10:21 -04:00
39624473b0 pasta: Create /etc/hosts entries for pods using pasta networking
For pods with bridged and slirp4netns networking we create /etc/hosts
entries to make it more convenient for the containers to address each
other.  We omitted to do this for pasta networking, however.  Add the
necessary code to do this.

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

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-06-30 13:04:02 +10:00
2393fe4536 pasta tests: add sanity check for test name vs function
Confirm that pasta test name agrees with the test being run.
This is a development-time-only check, it must never fail
beyond CI. The idea is to prevent something like

   @test "... Single TCP ... IPv4" {
      pasta_test_to 6 ... udp ...
   }

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-29 12:54:33 -06:00
4da3e47b6f pasta tests: cleanup + 1 new test
- typo fix, a misspelled variable resulting in test being NOP
- remove unnecessary variable (followup to #19044)
- add opportunistic CONTAINERS_CONF test (followup to #19032)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-29 12:54:33 -06:00
d09edd2820 Merge pull request #19043 from dgibson/fix19021
pasta: Remove some leftover code from pasta bats tests
2023-06-29 16:22:30 +02:00
92db6a871a Merge pull request #19032 from Luap99/def-rootless-network
rootless: use default_rootless_network_cmd config
2023-06-29 15:27:31 +02:00
f64a1a1cc8 rootless: use default_rootless_network_cmd config
Make sure we use the config field to know if we should use pasta or
slirp4netns as default.

While at it fix broken code which sets the default at two different
places, also do not set in Validate() as this should not modify the
specgen IMO, so set it directly before that.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-29 09:46:25 +02:00
e4efd709d9 Revert^3 "pasta: Use two connections instead of three in TCP range forward tests"
This reverts commit c2a24abc0d33cdb21681cfec63677ac29e92446c, which
itself reverted 1c08f2edac3f9ecf128cf8da91276e963e6ad14c, which
reverted e33f4e0bc7429038ba6aa82285ae8749c9037c88.

The original e33f4e0bc742 "pasta: Use two connections instead of three
in TCP range forward tests" was a workaround to avoid intermittent
errors in CI where the pasta networking port range forwarding tests
would fail.  It was reverted and unreverted when we thought we'd fixed
the problem, but that turned out not to be the case.

We're now much more confident that we've genuinely found and fixed (or
at least, worked around) the underlying problem, so we revert it again.

Link: https://github.com/containers/podman/issues/17287

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-06-29 16:15:02 +10:00
17cd5aecbb pasta: Workaround occasional socat failures in CI
With a number of the port range forwarding tests, we've seen occasional
failures where the sending socat fails with an EINTR on connect().  This
was mitigated by e33f4e0bc742 "pasta: Use two connections instead of three
in TCP range forward tests" (which has been reverted and un-reverted
several times).  However, this did not eliminate the problem, for example
see [0].

For the failing tests we are using the socat address "EXEC:printf x" to
make socat invoke printf(1) to generate a single byte of data to transfer.
Closer analysis shows that the SIGCHLD as the printf process ends is
occasionally intersecting with the connect() call causing this failure.

This is arguably a bug in socat, to not handle this race one way or
another.  However, we can easily workaround the problem by using a
temporary file with the data to transfer, rather than invoking printf every
time.  Do this, to avoid the flakiness of these tests.

[0]
https://github.com/containers/podman/issues/17287#issuecomment-1611855165

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

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-06-29 15:53:13 +10:00
13c7d05cc1 pasta: Remove some leftover code from pasta bats tests
https://github.com/containers/podman/pull/19021 fixed bugs with the pasta
networking tests not working on hosts with multiple interfaces.  Alas, the
patch left in some stale code that generates spurious error messages for
the IPv6 case.  This is sort of harmless - later code overrides what's done
here and the tests can pass anyway.  However if a test fails for some other
reason it means we get a misleading irrelevant error message.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-06-29 12:51:44 +10:00
455c7c8264 Merge pull request #19011 from rhatdan/secret1
Display secret to user in inspect
2023-06-28 22:54:35 +02:00
bf60bb0731 Display secret to user in inpspect
It is pretty complicated to display the secret on the host, but is
not really secured. This patch makes it easier to examine the secret.

Partial fix for https://github.com/containers/podman/issues/18667

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-28 13:14:49 -04:00
8fb719a9e8 e2e: systemd test: major fixes
[October 2022] While mucking around in this test, I noticed that
a test was being unnecessarily skipped in rootless. Reason was,
test was creating a /etc/systemd file, which it really shouldn't
have been doing anyway.

[Flash forward to June 2023] Ugh. This got complicated, so I
abandoned it. But it's flaking in CI, so one focus-push later,
here's everything that this PR fixes:

  - create systemd unit file in proper (safe) path.

  - create it *with proper podman options!!!* As in, the
    whole --this --that --root --tmpdir options! Sheesh!

  - use a pseudorandom service name, not just "redis"

  - invoke systemctl/journalctl with --system or --user
    as appropriate.

  - remove unnecessary "bash -c"

  - remove SkipIfRootless, but add SkipIfRemote

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-28 10:07:19 -06:00
92b2a15a27 Merge pull request #19029 from rhatdan/inspect
Remove 'inspecting object' from inspect errors
2023-06-28 17:00:10 +02:00
416b4eeac6 Merge pull request #18814 from danishprakash/kube-down-volrm
play.go: remove volumes with `kube down --force`
2023-06-28 15:31:41 +02:00
b6e636cbe2 Remove 'inspecting object' from inspect errors
This is just useless noise and gets us closer to what
Docker returns.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-28 08:19:37 -04:00
be49741dc7 Merge pull request #19021 from dgibson/bug19007
pasta: Fix pasta tests to work on hosts with multiple interfaces
2023-06-28 13:06:43 +02:00
fe8355be7f pasta: Fix pasta tests to work on hosts with multiple interfaces
At various points the pasta bats tests need to know the name of the
interface that pasta will use by default, and the host addresses it will
use by default.  Currently we use the pre-existing helper functions
ether_get_name and ipv[46]_get_addr_global to retreive that.

However, those just pick the first non-loopback interface or address, which
may not be the one that pasta uses if there are multiple connected host
interfaces.

Replace those helpers with local ones which examine the routing table to
more closely match pasta's internal logic about which interface to select.
This allows the tests to run successfully on a host with multiple
interfaces.

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

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-06-28 13:12:33 +10:00
bcb89fc8b2 Fix readonly=false failure
There was a huge cut and paste of mount options which were not constent
in parsing tmpfs, bind and volume mounts.  Consolidated into a single
function to guarantee all parse the same.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-27 16:57:21 -04:00
089dbed498 Merge pull request #18999 from Luap99/vendor
update c/{common,image,storage,buildah} to latest
2023-06-27 21:10:58 +02:00
f5cc0487e8 Fixes for vendoring Buildah
This commit was automatically cherry-picked
by buildah-vendor-treadmill v0.3
from the buildah vendor treadmill PR, #13808

Changes since 2023-05-01:
  - skip a new test, it fails in remote
  - skip encrypted-FROM test, broken by buildah PR 4746

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-27 18:04:42 +02:00
6eaf8a271d tests: fix "Storing signatures" check
After[1] c/image no longer prints "Storing signatures" so we should
not check for it.

[1] https://github.com/containers/image/pull/2001

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-27 18:04:42 +02:00
eeb7aeb496 Kube quadlets can support autoupdate as well as containers
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-27 11:20:14 -04:00
2160a114cc debug tail 800 lines flake
Sometimes this tests flakes but in the CI log I see all expected lines
printed but still for some reason the matcher fails.
Right now it will truncate the array so it is not possible to verify
what the matcher sees. Change this be removing the truncate limit for
this specific test only.

see #18501

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-27 14:58:27 +02:00
c2d46acdea Merge pull request #18980 from vrothberg/bz-2216700
make image listing more resilient
2023-06-26 22:42:37 +02:00
68f71f49d6 Merge pull request #19002 from giuseppe/skip-devices-userns
specgen: raise error with --device-cgroup-rule in a userns
2023-06-26 22:34:54 +02:00
6a742cb2f5 Merge pull request #18981 from rhatdan/quadlet
Trim whitespace from unit files while parsing
2023-06-26 22:29:42 +02:00
0220f33384 specgen, rootless: raise error with --device-cgroup-rule
we were silently ignoring --device-cgroup-rule in rootless mode.  Make
sure an error is returned if the user tries to use it.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-06-26 17:36:55 +02:00
db37d66cd1 make image listing more resilient
Handle more TOCTOUs operating on listed images.  Also pull in
containers/common/pull/1520 and containers/common/pull/1522 which do the
same on the internal layer tree.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2216700
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-26 16:34:26 +02:00