Commit Graph

156 Commits

Author SHA1 Message Date
Toshiki Sonoda d640461ced e2e: skip journald test if journald is unavailable
If journald is unavailable, journald logging driver tests
should be skipped.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-04-21 11:16:18 +09:00
Paul Holzinger 525c27fe1d
test/e2e: fix SkipIfNotActive()
If a unit is not active the exit code from systemctl is 3. Thus this
test always failed because it checked the error.

Fix this by checking the exit code and remove the unnecessary output
parsing.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-04-20 16:26:55 +02:00
Toshiki Sonoda da83364eb0 e2e: quadlet uses PODMAN env for podman binary path
Adapts to pass the test even if
podman binary path is not `/usr/local/bin/podman`.

[NO NEW TESTS NEEDED]

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-04-19 16:17:57 +09:00
Paul Holzinger dc9a65e348
test/e2e: use custom network config dir where needed
Since commit f250560a80 the play kube command uses its own network.
this is racy be design because we create the network followed by
creating/running pod/containers. This means in the meantime another
prune or reset process could wipe out the network config because we have
to share the network config directory by design in the test.

The problem is we only have one host netns which is shared between
tests. If the network config dir is not shared we cannot make conflict
checks for interface names and ip address. This results in different
tests trying to use the same interface and/or ip address which will
cause runtime failures in CNI and netavark.

The only solution I see is to make sure only the reset/prune tests are
using a custom network dir. This makes sure they do not wipe configs
that are otherwise required by other parallel running tests.

Fixes #17946

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-04-06 16:16:50 +02:00
Ed Santiago ce8a3a0c1e e2e: GinkgoParallelNode() -> ...Process()
...to silence runtime warning:

   GinkgoParallelNode is deprecated and will be removed in Ginkgo V2.
   Please use GinkgoParallelProcess instead.

Ref: https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#renamed-ginkgoparallelnode

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-04-05 09:44:23 -06:00
Matt Heon 39fd9aa084 Add SQLite job to CI
Signed-off-by: Matt Heon <mheon@redhat.com>
2023-03-15 14:44:47 -04:00
Giuseppe Scrivano fb4f6f95c5
test: reenable idmap test
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-03-11 12:15:38 +01:00
Chris Evich 197529f084
Skip tests which fail with CGv1 & runc
* Skip play-kube test when runc is in use #17436
* Skip uid/gidmapping idmapped-volume test #17433

Signed-off-by: Chris Evich <cevich@redhat.com>
2023-02-22 10:35:03 -05:00
Toshiki Sonoda 2682d3ad9d e2e: Avoid hard-coding ImageCacheDir
- ImageCacheDir is hard-coded as "/tmp/podman/imagecachedir".
To avoid this hard-coding, I changed it to "os.TempDir()/imagecachedir".

- Change ImageCacheDir permissions from 0777 to 0700.
This directory should be used by per-user.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-30 10:14:08 +09:00
OpenShift Merge Robot 14012491cf
Merge pull request #17088 from mtrmac/sign-by-sigstore
Add … push --sign-by-sigstore
2023-01-27 14:02:52 -05:00
Miloslav Trmač 069edc3adf Add (podman {image,manifest} push --sign-by-sigstore=param-file.yaml)
(podman push) and (podman manifest push) now support --sign-by-sigstore=param-file,
using the containers-sigstore-signing-params.yaml(5) file format.

That notably adds support for Fulcio and Rekor signing.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-01-27 16:47:32 +01:00
Toshiki Sonoda 21b82bb687 e2e: Remove the cache with "podman unshare rm" when a rootless user
If rootless, os.RemoveAll() is failed due to permission denied.
Therefore, we use "podman unshare rm" instead of os.RemoveAll().

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-27 23:44:04 +09:00
Toshiki Sonoda 814f7c5695 e2e: Remove some directories at SynchronizedAfterSuite
"tempdir" in SynchronizedAftersuite and "LockTmpDir" can be removed.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-27 21:25:44 +09:00
Toshiki Sonoda 38d5319f16 e2e: reduce dependency on /tmp for e2e tests
- Use filepath.Join(podmanTest.TempDir, "any") instead of "/tmp/any"

- Add generatePolicyFile() to avoid the hardcording of "keyPath": "tmp/key.gpg"

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-26 22:20:15 +09:00
Toshiki Sonoda 17b5bd758d e2e: use isRootless() instead of rootless.IsRootless()
Unify the functions used to detect rootless to "isRootless()".
This function can detect to join the user namespace by mistake.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-18 10:34:51 +09:00
Ed Santiago 37ade6be12 Network tests: ping redhat.com, not podman.io
Much as we'd love to eat our dogfood, podman.io is not hosted
on reliable infrastructure; redhat.com is. Let's see if this
gets rid of CI flakes.

Closes: #17044

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-10 05:38:43 -07:00
OpenShift Merge Robot 1b62e9049e
Merge pull request #16684 from sstosh/e2e-proxy
e2e: fix e2e tests in proxy environment
2022-12-06 19:57:10 -05:00
Toshiki Sonoda 86f4bd4f54 e2e: fix e2e tests in proxy environment
- podman generate kube inheritents the proxy environment valiable by default.
  Therefore, Env field is not empty if it is set.

- systemd-socket-acrivate needs to pass an proxy environment variable.

- busybox wget with an proxy doesn't work.
  Network tests should use not wget but curl.
  https://gitlab.alpinelinux.org/alpine/aports/-/issues/10446

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-12-06 11:14:19 +09:00
Miloslav Trmač c83efd0f07 Update c/storage after https://github.com/containers/storage/pull/1436
... and update to remove the now-deprecated Locker interface.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-12-01 16:05:13 +01:00
Paul Holzinger 2ddf1c5cbd
ginkgo tests: apply ginkgolinter fixes
I found the ginkgolinter[1] by accident, this looks for not optimal
matching and suggest how to do it better.

Overall these fixes seem to be all correct and they will give much
better error messages when something fails.
Check out the repo to see what the linter reports.

[1] https://github.com/nunnatsa/ginkgolinter

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-11-25 14:41:43 +01:00
Alexander Larsson 62bb59d3b0 Initial quadlet version integrated in golang
Based on the initial port in https://github.com/containers/quadlet/pull/41

This contains the unit tests and the testcases from the C code as well
as modification to the podman spec file based on what the quadlet
spec file looks like, producing a podman-quadlet subpackage.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-17 15:56:03 +02:00
Chris Evich d968f3fe09
Replace deprecated ioutil
Package `io/ioutil` was deprecated in golang 1.16, preventing podman from
building under Fedora 37.  Fortunately, functionality identical
replacements are provided by the packages `io` and `os`.  Replace all
usage of all `io/ioutil` symbols with appropriate substitutions
according to the golang docs.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-09-20 15:34:27 -04:00
Kir Kolyshkin 75740be395 all: stop using deprecated GenerateNonCryptoID
In view of https://github.com/containers/storage/pull/1337, do this:

	for f in $(git grep -l stringid.GenerateNonCryptoID | grep -v '^vendor/'); do
		sed -i 's/stringid.GenerateNonCryptoID/stringid.GenerateRandomID/g' $f;
	done

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-09-13 16:26:26 -07:00
Paul Holzinger d10e77e1bc
fix podman pod inspect to support multiple pods
Just like the other inspect commands `podman pod inspect p1 p2` should
return the json for both.

To correctly implement this we follow the container inspect logic, this
allows use to reuse the global inspect command.
Note: To not break the existing single pod output format for podman pod
inspect I added a pod-legacy inspect type. This is only used to make
sure we will print the pod as single json and not an array like for the
other commands. We cannot use the pod type since podman inspect --type
pod did return an array and we should not break that as well.

Fixes #15674

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-08 10:28:42 +02:00
Paul Holzinger 290116bf81
integration test: fix network backend option with remote
I honestly do not understand all this extra option parsing here but
there is really no reason to exclude  the option for remote, all the
other global options are also set there.

This fixes a problem with mixed cni/netavark use because the option was
unset.

Fixes #15017

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-22 15:29:18 +02:00
Ed Santiago 4fd5fb97a0 e2e tests: cleanup: capitalize CONSTANTS
A number of standard image names were lower-case, leading to
confusion in code such as:

    registry := podman(... , "-n", "registry", registry, ...)
    ^--- variable                              ^---- constant

Fix a number of those to be capitalized and with _IMAGE suffix:

    registry := podman(...,                    REGISTRY_IMAGE

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-07-05 15:36:08 -06:00
openshift-ci[bot] 9539a89ee7
Merge pull request #14831 from giuseppe/fix-leak-connections-test
two minor tweaks to common_test.go
2022-07-05 14:25:58 +00:00
Sascha Grunert 49cb288df3
hack/test/utils: switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of
the deprecated github.com/pkg/errors package.

[NO NEW TESTS NEEDED]

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-05 12:13:33 +02:00
Giuseppe Scrivano 2da731a7ea
test: reduce sleep interval
there is no need to use such long sleep intervals for such cheap
operations like opening a connection or stat'ing a file.

Also make WaitForService() honor defaultWaitTimeout.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-07-05 11:36:06 +02:00
Giuseppe Scrivano c02f793bab
test: return immediately on connect
if the connection is successfull then return immediately instead of doing
all the iterations.  It also solves a problem where connections are
leaked since there are multiple Dial but only one Close.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-07-05 11:12:30 +02:00
Paul Holzinger 4c5b058e86
fix flake in aardvark tests
The retry logic in digshort() did not work because dig always exits with
0 even when the domain name is not found. To make it work we have to
check the standard output.

We work on fixing the underlying issue in aardvark/netavark but
this will take more time.

Fixes #14173
Fixes #14171

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-04 17:16:14 +02:00
Erik Sjölund aa4279ae15 Fix spelling "setup" -> "set up" and similar
* Replace "setup", "lookup", "cleanup", "backup" with
  "set up", "look up", "clean up", "back up"
  when used as verbs. Replace also variations of those.

* Improve language in a few places.

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2022-06-22 18:39:21 +02:00
Paul Holzinger 41528739ce
golangci-lint: enable nolintlint
The nolintlint linter does not deny the use of `//nolint`
Instead it allows us to enforce a common nolint style:
- force that a linter name must be specified
- do not add a space between `//` and `nolint`
- make sure nolint is only used when there is actually a problem

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-06-14 16:29:42 +02:00
Giuseppe Scrivano d0ca90b3ed
test: simplify cleanup code
do not try to first stop and then rm but combine the two operations in
a single command.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-05-10 20:11:16 +02:00
Jhon Honce 8da5f3f733 Add podman machine events
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-05-03 13:49:01 -07:00
Paul Holzinger a48c37df37
fix broken hooks-dir test
The test has been broken since it was added 4 years ago. Instead of
using hardcoded paths we should use tmp files.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-29 14:06:54 +02:00
Paul Holzinger 51fbf3da9e
enable gocritic linter
The linter ensures a common code style.
- use switch/case instead of else if
- use if instead of switch/case for single case statement
- add space between comment and text
- detect the use of defer with os.Exit()
- use short form var += "..." instead of var = var + "..."
- detect problems with append()
```
newSlice := append(orgSlice, val)
```
  This could lead to nasty bugs because the orgSlice will be changed in
  place if it has enough capacity too hold the new elements. Thus we
  newSlice might not be a copy.

Of course most of the changes are just cosmetic and do not cause any
logic errors but I think it is a good idea to enforce a common style.
This should help maintainability.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-26 18:12:22 +02:00
Ed Santiago ee9d755c5b Robustify nginx tests
[skip ci]

While chasing a flake, I discovered that our alpine_nginx
image is broken: it returns 404 on all requests. We never
caught this because--surprise!--curl exits 0 even when
server returns 4xx/5xx status.

Let's be strict: add -f (--fail) option to all invocations
of curl.

And, although I couldn't identify the root cause of the
flake (in "run two containers with the same IP" test),
I can at least fix the broken wait-for-nginx loop, bump
up the number of retries, and improve diagnostics on
failure. And add a strict error-message check.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-04-25 14:25:10 -06:00
OpenShift Merge Robot 09ef4f2e22
Merge pull request #13978 from Luap99/unparam
enable unparam linter
2022-04-25 13:43:57 -04:00
Paul Holzinger c7b16645af
enable unparam linter
The unparam linter is useful to detect unused function parameters and
return values.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-25 13:23:20 +02:00
Paul Holzinger 5b4af0584d
replace golint with revive linter
golint, scopelint and interfacer are deprecated. golint is replaced by
revive. This linter is better because it will also check for our error
style: `error strings should not be capitalized or end with punctuation or a newline`

scopelint is replaced by exportloopref (already endabled)
interfacer has no replacement but I do not think this linter is
important.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-22 15:12:33 +02:00
Paul Holzinger 2a8e435671
enable staticcheck linter
Fix many problems reported by the staticcheck linter, including many
real bugs!

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-22 12:51:29 +02:00
Chris Evich c67d6a52c4
Fix using --network-backend on podman-remote
When this option was added to the e2e tests, there was no CI Automation
support for running remote tests w/ netavark.  When added, many
e2e test errors/failures are generated due to this option not being
valid for the remote client.  Fix this in the tests by conditionally
adding the option if the test is running the remote client.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-04-21 14:29:44 -04:00
Chris Evich d865fcc5ec
Fix e2e tests referencing generic env. var.
Use of `$DEBUG` is highly likely to clash.  Fortunately this one is in
a very specific/special context, so a rename fix should be perfectly
adequate.

See also https://github.com/containers/automation/pull/96
and https://github.com/containers/podman/issues/13932

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-04-20 14:02:08 -04:00
Jhon Honce f8c2df87cb Add build test for .containerignore tar file
Ensure a directory added to .containerignore on client is not included
in tar sent to remote podman API service

* Clean up podman invocations to not include duplicate --remote and
  --url flags
* Use pkill vs. pgrep when cleaning up podman API service in tests
* Add exit code when logging error when testing

Closes #13535

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-31 08:48:54 -07:00
Valentin Rothberg 06dd9136a2 fix a number of errcheck issues
Numerous issues remain, especially in tests/e2e.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:15:28 +01:00
Lokesh Mandvekar 8cfdddf509
test/e2e: add aardvark specific tests
Co-authored-by: Brent Baude <bbaude@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2022-03-08 15:07:55 -05:00
Lokesh Mandvekar 6f9f78f7f2 enable netavark specific tests
These are copies of the CNI tests with modifications wherever
neccessary.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2022-02-11 13:34:28 -05:00
Brent Baude 7d3ad6081f netavark e2e tests
enabled e2e tests for netavark

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-02-02 13:03:45 -06:00
Daniel J Walsh 1cddd63976
Show correct default values or show none
Before this PR, the podman --help command shows the defaults
as runc and overlay even if the storage.conf and containers.conf
files do not match. This PR changes them to show the actual defaults
and in the case of storage driver, does not show the default at all.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-24 13:15:42 -05:00