summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAge
* Merge pull request #11890 from Luap99/portsOpenShift Merge Robot2021-11-06
|\ | | | | libpod: deduplicate ports in db
| * libpod: deduplicate ports in dbPaul Holzinger2021-10-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The OCICNI port format has one big problem: It does not support ranges. So if a users forwards a range of 1k ports with podman run -p 1001-2000 we have to store each of the thousand ports individually as array element. This bloats the db and makes the JSON encoding and decoding much slower. In many places we already use a better port struct type which supports ranges, e.g. `pkg/specgen` or the new network interface. Because of this we have to do many runtime conversions between the two port formats. If everything uses the new format we can skip the runtime conversions. This commit adds logic to replace all occurrences of the old format with the new one. The database will automatically migrate the ports to new format when the container config is read for the first time after the update. The `ParsePortMapping` function is `pkg/specgen/generate` has been reworked to better work with the new format. The new logic is able to deduplicate the given ports. This is necessary the ensure we store them efficiently in the DB. The new code should also be more performant than the old one. To prove that the code is fast enough I added go benchmarks. Parsing 1 million ports took less than 0.5 seconds on my laptop. Benchmark normalize PortMappings in specgen: Please note that the 1 million ports are actually 20x 50k ranges because we cannot have bigger ranges than 65535 ports. ``` $ go test -bench=. -benchmem ./pkg/specgen/generate/ goos: linux goarch: amd64 pkg: github.com/containers/podman/v3/pkg/specgen/generate cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz BenchmarkParsePortMappingNoPorts-12 480821532 2.230 ns/op 0 B/op 0 allocs/op BenchmarkParsePortMapping1-12 38972 30183 ns/op 131584 B/op 9 allocs/op BenchmarkParsePortMapping100-12 18752 60688 ns/op 141088 B/op 315 allocs/op BenchmarkParsePortMapping1k-12 3104 331719 ns/op 223840 B/op 3018 allocs/op BenchmarkParsePortMapping10k-12 376 3122930 ns/op 1223650 B/op 30027 allocs/op BenchmarkParsePortMapping1m-12 3 390869926 ns/op 124593840 B/op 4000624 allocs/op BenchmarkParsePortMappingReverse100-12 18940 63414 ns/op 141088 B/op 315 allocs/op BenchmarkParsePortMappingReverse1k-12 3015 362500 ns/op 223841 B/op 3018 allocs/op BenchmarkParsePortMappingReverse10k-12 343 3318135 ns/op 1223650 B/op 30027 allocs/op BenchmarkParsePortMappingReverse1m-12 3 403392469 ns/op 124593840 B/op 4000624 allocs/op BenchmarkParsePortMappingRange1-12 37635 28756 ns/op 131584 B/op 9 allocs/op BenchmarkParsePortMappingRange100-12 39604 28935 ns/op 131584 B/op 9 allocs/op BenchmarkParsePortMappingRange1k-12 38384 29921 ns/op 131584 B/op 9 allocs/op BenchmarkParsePortMappingRange10k-12 29479 40381 ns/op 131584 B/op 9 allocs/op BenchmarkParsePortMappingRange1m-12 927 1279369 ns/op 143022 B/op 164 allocs/op PASS ok github.com/containers/podman/v3/pkg/specgen/generate 25.492s ``` Benchmark convert old port format to new one: ``` go test -bench=. -benchmem ./libpod/ goos: linux goarch: amd64 pkg: github.com/containers/podman/v3/libpod cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz Benchmark_ocicniPortsToNetTypesPortsNoPorts-12 663526126 1.663 ns/op 0 B/op 0 allocs/op Benchmark_ocicniPortsToNetTypesPorts1-12 7858082 141.9 ns/op 72 B/op 2 allocs/op Benchmark_ocicniPortsToNetTypesPorts10-12 2065347 571.0 ns/op 536 B/op 4 allocs/op Benchmark_ocicniPortsToNetTypesPorts100-12 138478 8641 ns/op 4216 B/op 4 allocs/op Benchmark_ocicniPortsToNetTypesPorts1k-12 9414 120964 ns/op 41080 B/op 4 allocs/op Benchmark_ocicniPortsToNetTypesPorts10k-12 781 1490526 ns/op 401528 B/op 4 allocs/op Benchmark_ocicniPortsToNetTypesPorts1m-12 4 250579010 ns/op 40001656 B/op 4 allocs/op PASS ok github.com/containers/podman/v3/libpod 11.727s ``` Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* | rename rootless cni ns to rootless netnsPaul Holzinger2021-11-05
| | | | | | | | | | | | | | | | | | | | | | | | Since we want to use the rootless cni ns also for netavark we should pick a more generic name. The name is now "rootless network namespace" or short "rootless netns". The rename might cause some issues after the update but when the all containers are restarted or the host is rebooted it should work correctly. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* | Merge pull request #12162 from giuseppe/run-split-test-in-separate-cgroupOpenShift Merge Robot2021-11-04
|\ \ | | | | | | test: run --cgroups=split in new cgroup
| * | test: run --cgroups=split in new cgroupGiuseppe Scrivano2021-11-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the --cgroups=split test changes the current cgroup as it creates a sub-cgroup. This can cause a race condition in tests that are reading the current cgroup. Closes: https://github.com/containers/podman/issues/11191 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* | | Merge pull request #12060 from mtrmac/podman-trust-show-f35OpenShift Merge Robot2021-11-03
|\ \ \ | | | | | | | | Fix `Podman image trust` tests
| * | | Fix tests of podman image trust --raw and --jsonMiloslav Trmač2021-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead using the OS-wide system default policy, use the one in this repo, and adjust the expected results (as well as making the test stricter). Signed-off-by: Miloslav Trmač <mitr@redhat.com>
| * | | Tighten the expected output of the "podman image trust show" testMiloslav Trmač2021-10-25
| | | | | | | | | | | | | | | | | | | | | | | | ... to include all fields. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
| * | | Use INTEGRATION_ROOT instead of current directoryMiloslav Trmač2021-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Should not change behavior, just to set a consistent precedent for code introduced in future commits. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* | | | Merge pull request #12166 from Luap99/macOpenShift Merge Robot2021-11-03
|\ \ \ \ | | | | | | | | | | MAC address json unmarshal should allow strings
| * | | | MAC address json unmarshal should allow stringsPaul Holzinger2021-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create a new mac address type which supports json marshal/unmarshal from and to string. This change is backwards compatible with the previous versions as the unmarshal method still accepts the old byte array or base64 encoded string. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* | | | | Merge pull request #12159 from jwhonce/issues/12115OpenShift Merge Robot2021-11-02
|\ \ \ \ \ | |/ / / / |/| | | | Implement top streaming for containers and pods
| * | | | Implement top streaming for containers and podsJhon Honce2021-11-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement API query parameter stream and delay for containers and pods top endpoints * Update swagger with breaking changes * Add python API tests for endpoints Fixes #12115 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* | | | | Merge pull request #12158 from edsantiago/more_batsOpenShift Merge Robot2021-11-02
|\ \ \ \ \ | | | | | | | | | | | | System tests: enhance volume test, add debug prints
| * | | | | System tests: enhance volume test, add debug printsEd Santiago2021-11-01
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Volume test: add a sequence of stat()s to confirm that volumes are mounted as a different device than root. Network test: add debugging code for #11825 (dnsmasq inotify failure in bodhi only). Signed-off-by: Ed Santiago <santiago@redhat.com>
* | | | | Merge pull request #12156 from matejvasek/docker-api-zero-value-fixesOpenShift Merge Robot2021-11-02
|\ \ \ \ \ | |_|_|/ / |/| | | | Fix libpod API conformance to swagger
| * | | | Fix libpod API conformance to swaggerMatej Vasek2021-11-01
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | * Return empty array when nothing has been pruned. * Use correct return type swagger doc-comment. Signed-off-by: Matej Vasek <mvasek@redhat.com>
* | | | Merge pull request #12118 from hshiina/log-f-journaldOpenShift Merge Robot2021-11-02
|\ \ \ \ | |/ / / |/| | | Set flags to test 'logs -f' with journald driver
| * | | Set flags to test 'logs -f' with journald driverHironori Shiina2021-10-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `logs -f` with `journald` is supported only when `journald` events backend is used. To pass system tests using `logs -f` in an environment where `events_logger` is not set to `journald` in `containers.conf`, this fix sets `--events-backend` or `--log-driver` temporally. Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
* | | | Fix help message case for `podman version`Praveen Kumar2021-10-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a cosmetic change. The help message for `podman version` is in title case whereas all other command help messages are not in title case. This stands out as inconsistent when looking at the output of `podman help`. Signed-off-by: Praveen Kumar <praveen+git@kumar.in>
* | | | Merge pull request #12127 from vrothberg/bz-2014149OpenShift Merge Robot2021-10-29
|\ \ \ \ | | | | | | | | | | volumes: be more tolerant and fix infinite loop
| * | | | volumes: be more tolerant and fix infinite loopValentin Rothberg2021-10-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make Podman more tolerant when parsing image volumes during container creation and further fix an infinite loop when checking them. Consider `VOLUME ['/etc/foo', '/etc/bar']` in a Containerfile. While it looks correct to the human eye, the single quotes are wrong and yield the two volumes to be `[/etc/foo,` and `/etc/bar]` in Podman and Docker. When running the container, it'll create a directory `bar]` in `/etc` and a directory `[` in `/` with two subdirectories `etc/foo,`. This behavior is surprising to me but how Docker behaves. We may improve on that in the future. Note that the correct way to syntax for volumes in a Containerfile is `VOLUME /A /B /C` or `VOLUME ["/A", "/B", "/C"]`; single quotes are not supported. This change restores this behavior without breaking container creation or ending up in an infinite loop. BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2014149 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | | | | Allow label and labels when creating volumesJhon Honce2021-10-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JSON payload may have either key. Labels will override any values set via Label. Fixes #12102 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* | | | | volumes: allow more options for devptsGiuseppe Scrivano2021-10-28
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | allow to pass down more options that are supported by the kernel. Discussion here: https://github.com/containers/toolbox/issues/568 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* | | | Merge pull request #12064 from vrothberg/fix-11933OpenShift Merge Robot2021-10-27
|\ \ \ \ | | | | | | | | | | container create: fix --tls-verify parsing
| * | | | container create: fix --tls-verify parsingValentin Rothberg2021-10-27
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that the value is only set if specified on the CLI. c/image already defaults to true but if set in the system context, we'd skip settings in the registries.conf. Fixes: #11933 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | | | Merge pull request #12111 from giuseppe/fix-warning-move-pause-processOpenShift Merge Robot2021-10-27
|\ \ \ \ | | | | | | | | | | runtime: check for pause pid existence
| * | | | runtime: check for pause pid existenceGiuseppe Scrivano2021-10-27
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | check that the pause pid exists before trying to move it to a separate scope. Closes: https://github.com/containers/podman/issues/12065 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* | | | Merge pull request #12110 from cevich/fix_systemd_pid1OpenShift Merge Robot2021-10-27
|\ \ \ \ | |_|/ / |/| | | Fix systemd PID1 test
| * | | Fix systemd PID1 testChris Evich2021-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously this test used an ad-hoc timeout mechanism to synchronize with output of the container ID. However, depending on runtime conditions this may not correctly correspond with complete startup of the systemd process. Consequently this test fails under some conditions with an error like: `System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down` Fix this by using the more appropriate `WaitContainerReady()` against output from system startup, close to finalization. In this way, the test status command cannot run until systemd is fully operational. Signed-off-by: Chris Evich <cevich@redhat.com>
* | | | Merge pull request #11956 from vrothberg/pauseOpenShift Merge Robot2021-10-27
|\ \ \ \ | |_|/ / |/| | | remove need to download pause image
| * | | pod create: remove need for pause imageValentin Rothberg2021-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, the infra containers of pods required pulling down an image rendering pods not usable in disconnected environments. Instead, build an image locally which uses local pause binary. Fixes: #10354 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | | | Merge pull request #12098 from Luap99/slirp-dadOpenShift Merge Robot2021-10-26
|\ \ \ \ | |_|/ / |/| | | Slirp4netns with ipv6 set net.ipv6.conf.default.accept_dad=0
| * | | Slirp4netns with ipv6 set net.ipv6.conf.default.accept_dad=0Paul Holzinger2021-10-26
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Duplicate Address Detection slows the ipv6 setup down for 1-2 seconds. Since slirp4netns is run it is own namespace and not directly routed we can skip this to make the ipv6 address immediately available. We change the default to make sure the slirp tap interface gets the correct value assigned so DAD is disabled for it. Also make sure to change this value back to the original after slirp4netns is ready in case users rely on this sysctl. Fixes #11062 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* | | Merge pull request #12067 from hshiina/logs-journal-tailOpenShift Merge Robot2021-10-26
|\ \ \ | | | | | | | | Fix a few problems in 'podman logs --tail' with journald driver
| * | | Fix a few problems in 'podman logs --tail' with journald driverHironori Shiina2021-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following problems regarding `logs --tail` with the journald log driver are fixed: - One more line than a specified value is displayed. - '--tail 0' displays all lines while the other log drivers displays nothing. - Partial lines are not considered. - If the journald events backend is used and a container has exited, nothing is displayed. Integration tests that should have detected the bugs are also fixed. The tests are executed with json-file log driver three times without this fix. Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
* | | | Merge pull request #12088 from adrianreber/2021-10-25-fix-label-ipc-hostOpenShift Merge Robot2021-10-26
|\ \ \ \ | |_|/ / |/| | | Allow 'container restore' with '--ipc host'
| * | | Allow 'container restore' with '--ipc host'Adrian Reber2021-10-26
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying to restore a container that was started with '--ipc host' fails with: Error: error creating container storage: ProcessLabel and Mountlabel must either not be specified or both specified We already fixed this exact same error message for containers started with '--privileged'. The previous fix was to check if the to be restored container is a privileged container (c.config.Privileged). Unfortunately this does not work for containers started with '--ipc host'. This commit changes the check for a privileged container to check if both the ProcessLabel and the MountLabel is actually set and only then re-uses those labels. Signed-off-by: Adrian Reber <areber@redhat.com>
* / | Add support to play kube for --log-optDaniel J Walsh2021-10-25
|/ / | | | | | | | | | | Fixes: https://github.com/containers/podman/issues/11727 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Merge pull request #12021 from rhatdan/kubeOpenShift Merge Robot2021-10-22
|\ \ | |/ |/| Generate Kube should not print default structs
| * Generate Kube should not print default structsDaniel J Walsh2021-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If podman uses Workdir="/" or the workdir specified in the image, it should not add it to the yaml. If Podman find environment variables in the image, they should not get added to the yaml. If the container or pod do not have changes to SELinux we should not print seLinuxOpt{} If the container or pod do not change any dns options the yaml should not have a dnsOption={} If the container is not privileged it should not have privileged=false in the yaml. Fixes: https://github.com/containers/podman/issues/11995 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Merge pull request #12057 from flouthoc/allow-tagging-manifest-listOpenShift Merge Robot2021-10-21
|\ \ | | | | | | tag: Support tagging manifest list instead of resolving to images
| * | tag: Support tagging manifest list instead of resolving to imagesAditya Rajan2021-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following commit makes sure when buildah tag is invoked on a manifest list, it tags the same manifest list instead of resolving to an image and tagging it. Port of: https://github.com/containers/buildah/pull/3483 Signed-off-by: Aditya Rajan <arajan@redhat.com>
* | | Merge pull request #12028 from edsantiago/test_system_connectionOpenShift Merge Robot2021-10-21
|\ \ \ | |/ / |/| | Add test for system connection
| * | Add test for system connectionEd Santiago2021-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First a basic (connectionless) one to make sure we 'add', 'ls', and 'rm' work; then an actual one with a service; then (if ssh to localhost is set up and works) test ssh Requires a little trickery to work around the CI definition of $PODMAN, which includes "--url /path/to/sock", which overrides podman's detection of whether to use a connection or not. Signed-off-by: Ed Santiago <santiago@redhat.com>
* | | System tests: confirm that -a and -l clashEd Santiago2021-10-20
| | | | | | | | | | | | | | | | | | ...and fix one instance where there was no check Signed-off-by: Ed Santiago <santiago@redhat.com>
* | | Merge pull request #11851 from cdoern/podRmOpenShift Merge Robot2021-10-20
|\ \ \ | | | | | | | | Pod Rm Infra Handling Improvements
| * | | Pod Rm Infra Improvementscdoern2021-10-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Made changes so that if the pod contains all exited containers and only infra is running, remove the pod. resolves #11713 Signed-off-by: cdoern <cdoern@redhat.com>
* | | | Merge pull request #12041 from edsantiago/container_envOpenShift Merge Robot2021-10-20
|\ \ \ \ | | | | | | | | | | system tests: CONTAINER_* and --help: cleanup
| * | | | system tests: CONTAINER_* and --help: cleanupEd Santiago2021-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A small part of this test was written in a confusing and fragile way: it was very hard to understand, and in fact only worked through pure luck (using 'echo $output', which emitted everything in one long line, vs the standard quoted 'echo "$output"' which would've kept the formatting and caused the test to pass, incorrectly, no matter whether --remote was in the output or not). Plus, the '$?' check in the next line would never trigger on failure anyway, so the failure message would've been unhelpful if the test were ever to fail. Anyhow. Make it readable and make it work. (Followup to #11990) Signed-off-by: Ed Santiago <santiago@redhat.com>