summaryrefslogtreecommitdiff
path: root/test/e2e/network_test.go
Commit message (Collapse)AuthorAge
* enable netavark specific testsLokesh Mandvekar2022-02-11
| | | | | | | These are copies of the CNI tests with modifications wherever neccessary. Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
* netavark e2e testsBrent Baude2022-02-02
| | | | | | enabled e2e tests for netavark Signed-off-by: Brent Baude <bbaude@redhat.com>
* rename --cni-config-dir to --network-config-dirPaul Holzinger2022-01-18
| | | | | | | | Since this option will also be used for netavark we should rename it to something more generic. It is important that --cni-config-dir still works otherwise we could break existing container cleanup commands. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* bump go module to version 4Valentin Rothberg2022-01-18
| | | | | | | | | | | | | Automated for .go files via gomove [1]: `gomove github.com/containers/podman/v3 github.com/containers/podman/v4` Remaining files via vgrep [2]: `vgrep github.com/containers/podman/v3` [1] https://github.com/KSubedi/gomove [2] https://github.com/vrothberg/vgrep Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* use libnetwork from c/commonPaul Holzinger2022-01-12
| | | | | | | | The libpod/network packages were moved to c/common so that buildah can use it as well. To prevent duplication use it in podman as well and remove it from here. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* fix e2e test missing network cleanupPaul Holzinger2021-12-10
| | | | | | | | I noticed that this test will fail its flake rerun because the network was not removed and it tried to create a network with the same name. Also network disconnect works rootless now. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Use HaveLen(x) instead of Expect(len(y)).To(Equal(x))Ed Santiago2021-12-02
| | | | | | sed -i -e 's/Expect(len(\(.*\)))\.To(Equal(\(.*\)))/Expect(\1).To(HaveLen(\2))/' test/e2e/*.go Signed-off-by: Ed Santiago <santiago@redhat.com>
* e2e: yet more cleanup of BeTrue/BeFalseEd Santiago2021-11-30
| | | | | | Thanks to Paul for teaching me about HaveKey() Signed-off-by: Ed Santiago <santiago@redhat.com>
* a few more manual BeTrue cleanupsEd Santiago2021-11-30
| | | | Signed-off-by: Ed Santiago <santiago@redhat.com>
* e2e tests: more cleanup of BeTrue()sEd Santiago2021-11-30
| | | | | | | | | | Write a BeValidJSON() matcher, and replace IsJSONOutputValid(): sed -i -e 's/Expect(\(.*\)\.IsJSONOutputValid()).To(BeTrue())/Expect(\1.OutputToString())\.To(BeValidJSON())/' test/e2e/*_test.go (Plus a few manual tweaks) Signed-off-by: Ed Santiago <santiago@redhat.com>
* e2e tests: enable golintEd Santiago2021-11-29
| | | | | | ...and fix problems found therewith. Signed-off-by: Ed Santiago <santiago@redhat.com>
* e2e tests: clean up antihelpful BeTrue()sEd Santiago2021-11-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Many ginkgo tests have been written to use this evil form: GrepString("foo") Expect(that to BeTrue()) ...which yields horrible useless messages on failure: false is not true Identify those (automatically, via script) and convert to: Expect(output to ContainSubstring("foo")) ...which yields: "this output" does not contain substring "foo" There are still many BeTrue()s left. This is just a start. This is commit 1 of 2. It includes the script I used, and all changes to *.go are those computed by the script. Commit 2 will apply some manual fixes. Signed-off-by: Ed Santiago <santiago@redhat.com>
* Add --time out for podman * rm -f commandsDaniel J Walsh2021-10-04
| | | | | | | | | Add --time flag to podman container rm Add --time flag to podman pod rm Add --time flag to podman volume rm Add --time flag to podman network rm Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* fix podman network prune integration test flakesPaul Holzinger2021-09-27
| | | | | | | | | | | The podman integration tests run in parallel. Because all tests use the same CNI config dir the podman network prune test will remove networks which are used by other tests at the moment and thus creating unexpected flakes. The solution use an extra cni config dir for the network prune test. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* Wire network interface into libpodPaul Holzinger2021-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make use of the new network interface in libpod. This commit contains several breaking changes: - podman network create only outputs the new network name and not file path. - podman network ls shows the network driver instead of the cni version and plugins. - podman network inspect outputs the new network struct and not the cni conflist. - The bindings and libpod api endpoints have been changed to use the new network structure. The container network status is stored in a new field in the state. The status should be received with the new `c.getNetworkStatus`. This will migrate the old status to the new format. Therefore old containers should contine to work correctly in all cases even when network connect/ disconnect is used. New features: - podman network reload keeps the ip and mac for more than one network. - podman container restore keeps the ip and mac for more than one network. - The network create compat endpoint can now use more than one ipam config. The man pages and the swagger doc are updated to reflect the latest changes. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* e2e tests: use Should(Exit()) and ExitWithError()Ed Santiago2021-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e2e test failures are rife with messages like: Expected 1 to equal 0 These make me cry. They're anti-helpful, requiring the reader to dive into the source code to figure out what those numbers mean. Solution: Go tests have a '.Should(Exit(NNN))' mechanism. I don't know if it spits out a better diagnostic (I have no way to run e2e tests on my laptop), but I have to fantasize that it will, and given the state of our flakes I assume that at least one test will fail and give me the opportunity to see what the error message looks like. THIS IS NOT REVIEWABLE CODE. There is no way for a human to review it. Don't bother. Maybe look at a few random ones for sanity. If you want to really review, here is a reproducer of what I did: cd test/e2e ! positive assertions. The second is the same as the first, ! with the addition of (unnecessary) parentheses because ! some invocations were written that way. The third is BeZero(). perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(Equal\((\d+)\)\)/Expect($1).Should(Exit($2))/' *_test.go perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(\(Equal\((\d+)\)\)\)/Expect($1).Should(Exit($2))/' *_test.go perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(BeZero\(\)\)/Expect($1).Should(Exit(0))/' *_test.go ! Same as above, but handles three non-numeric exit codes ! in run_exit_test.go perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(Equal\((\S+)\)\)/Expect($1).Should(Exit($2))/' *_test.go ! negative assertions. Difference is the spelling of 'To(Not)', ! 'ToNot', and 'NotTo'. I assume those are all the same. perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(Not\(Equal\((0)\)\)\)/Expect($1).To(ExitWithError())/' *_test.go perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.ToNot\(Equal\((0)\)\)/Expect($1).To(ExitWithError())/' *_test.go perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.NotTo\(Equal\((0)\)\)/Expect($1).To(ExitWithError())/' *_test.go ! negative, old use of BeZero() perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.ToNot\(BeZero\(\)\)/Expect($1).Should(ExitWithError())/' *_test.go Run those on a clean copy of main branch (at the same branch point as my PR, of course), then diff against a checked-out copy of my PR. There should be no differences. Then all you have to review is that my replacements above are sane. UPDATE: nope, that's not enough, you also need to add gomega/gexec to the files that don't have it: perl -pi -e '$_ .= "$1/gexec\"\n" if m!^(.*/onsi/gomega)"!' $(grep -L gomega/gexec $(git log -1 --stat | awk '$1 ~ /test\/e2e\// { print $1}')) UPDATE 2: hand-edit run_volume_test.go UPDATE 3: sigh, add WaitWithDefaultTimeout() to a couple of places UPDATE 4: skip a test due to bug #10935 (race condition) Signed-off-by: Ed Santiago <santiago@redhat.com>
* Fix network create macvlan with subnet optionPaul Holzinger2021-05-20
| | | | | | | | | | Creating a macvlan network with the subnet or ipRange option should set the ipam plugin type to `host-local`. We also have to insert the default route. Fixes #10283 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Add support for cli network prune --filter flagJakub Guzik2021-05-12
| | | | Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
* Fix for podman network rm (-f) workflowJakub Guzik2021-03-05
| | | | Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
* Updated based on Jhonce commentsParker Van Roy2021-02-24
| | | | | | | | | Added ID to default removed outdated imports slight refactor Test Network Headers added to network_test.go Signed-off-by: Parker Van Roy <pvanroy@redhat.com>
* bump go module to v3Valentin Rothberg2021-02-22
| | | | | | | | | 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>
* fix dns resolution on ubuntubaude2021-02-15
| | | | | | ubuntu's dns seems a little odd and requires a fq name in its tests. Signed-off-by: baude <bbaude@redhat.com>
* e2e: fix network alias testValentin Rothberg2021-02-15
| | | | | | | | | | | The logic in the e2e test for multiple network aliases is indicating the test should wait for the containerized nginx to be ready. As this may take some time, the test does an exponential backoff starting at 2050ms. Fix the logic by removing the `Expect(...)` call during the exponential backoff. Otherwise, the test errors immediately. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* add network prunebaude2021-02-06
| | | | | | | | | add the ability to prune unused cni networks. filters are not implemented but included both compat and podman api endpoints. Fixes :#8673 Signed-off-by: baude <bbaude@redhat.com>
* Honor network options for macvlan networksbaude2021-02-02
| | | | | | | | | when creating a macvlan network, we should honor gateway, subnet, and mtu as provided by the user. Fixes: #9167 Signed-off-by: baude <bbaude@redhat.com>
* add macvlan as a supported network driverbaude2021-02-01
| | | | | | | | | | | | instead of using the --macvlan to indicate that you want to make a macvlan network, podman network create now honors the driver name of *macvlan*. Any options to macvlan, like the parent device, should be specified as a -o option. For example, -o parent=eth0. the --macvlan option was marked as deprecated in the man page but is still supported for the duration of 3.0. Signed-off-by: baude <bbaude@redhat.com>
* Add support for rootless network-aliasesPaul Holzinger2021-01-27
| | | | | | | | | | Make sure we pass the network aliases as capability args to the cnitool in the rootless-cni-infra container. Also update the dnsname plugin in the cni-infra container. Fixes #8567 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Use random network names in the e2e testsPaul Holzinger2021-01-21
| | | | | | | | | Unlike the container storage all e2e test are using the same cni config directory. This causes problems if the network name already exists. Using random names will make the second run pass even if the first failed. This is only done to prevent full CI failures. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* podman network existsPaul Holzinger2021-01-19
| | | | | | Add podman network exists command with remote support. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Fix network ls --filter invalid value flakePaul Holzinger2020-12-07
| | | | | | The filter is only validated when at least one network exists. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Add support for network idsPaul Holzinger2020-12-02
| | | | | | | | | | | | | | | | | | | The network ID is not stored. It is just the sha256 hash from the network name. There is a risk of a potential hash collision. However it's very unlikely and even if we hit this it will complain that more than network with this ID exists. The main benefit is that the compat api can have proper network ID support. Also this adds the support for `podman network ls --format "{{.ID}}"` and `--filter id=<ID>`. It also ensures that we can do network rm <ID> and network inspect <ID>. Since we use a hash this commit is backwards compatible even for already existing networks. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Merge pull request #8505 from Luap99/network-labelsOpenShift Merge Robot2020-12-01
|\ | | | | podman network label support
| * podman network label supportPaul Holzinger2020-11-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add label support for podman network create. Use the `args` field in the cni config file to store the podman labels. Use `podman_labels` as key name and store the labels as map[string]string. For reference: https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#args-in-network-config https://github.com/containernetworking/cni/blob/spec-v0.4.0/SPEC.md#network-configuration Example snippet: ``` ... "args": { "podman_labels": { "key1":"value1", "key2":"value2" } } ... ``` Make podman network list support several filters. Supported filters are name, plugin, driver and label. Filters with different keys work exclusive. Several label filters work exclusive and the other filter keys are working inclusive. Also adjust the compat api to support labels in network create and list. Breaking changes: - podman network ls -f shortform is used for --filter instead --format This matches docker and other podman commands (container ps, volume ps) - libpod network list endpoint filter parameter is removed. Instead the filters paramter should be used as json encoded map[string][]string. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* | network connect disconnect on non-running containersbaude2020-11-30
| | | | | | | | | | | | | | a container can connect and disconnet to networks even when not in a running state. Signed-off-by: baude <bbaude@redhat.com>
* | Fix problems with network removePaul Holzinger2020-11-26
|/ | | | | | | | | First, make sure we are only trying to remove the network interface if we are root. Second, if we cannot get the interface name (e.g macvlan config) then we should not fail. Just remove the config file. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Merge pull request #8404 from rhatdan/rmOpenShift Merge Robot2020-11-20
|\ | | | | Add alias for podman network rm -> remove
| * Add alias for podman network rm -> removeDaniel J Walsh2020-11-19
| | | | | | | | | | | | | | | | docker network remove exists and is alias to docker network rm. Bug for bug compatible. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | add network connect|disconnect compat endpointsbaude2020-11-19
|/ | | | | | | | | | | this enables the ability to connect and disconnect a container from a given network. it is only for the compatibility layer. some code had to be refactored to avoid circular imports. additionally, tests are being deferred temporarily due to some incompatibility/bug in either docker-py or our stack. Signed-off-by: baude <bbaude@redhat.com>
* use lookaside storage for remote testsbaude2020-11-16
| | | | | | | | | | in an effort to speed up the remote testing, we should be using lookaside storage to avoid pull images as well as importing multiple images into the RW store. one test was removed and added into system test by Ed in #8325 Signed-off-by: baude <bbaude@redhat.com>
* network aliases for container creationbaude2020-11-09
| | | | | | | | podman can now support adding network aliases when running containers (--network-alias). It requires an updated dnsname plugin as well as an updated ocicni to work properly. Signed-off-by: baude <bbaude@redhat.com>
* Include CNI networks in inspect output when not runningMatthew Heon2020-10-09
| | | | | | | | | | | We were only including the CNI Network fields in the output of `podman inspect` when the container was not running. It's simple enough to fix (populate with empty structs, since we can't fill anything without a CNI response to get IP address assigned, etc). This is necessary for Docker compatibility. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
* This PR allows users to remove external containers directlyDaniel J Walsh2020-10-09
| | | | | | | | | | | | | | | | | | | | | | | Currenly if a user specifies the name or ID of an external storage container, we report an error to them. buildah from scratch working-container-2 podman rm working-container-2 Error: no container with name or ID working-container-2 found: no such container Since the user specified the correct name and the container is in storage we force them to specify --storage to remove it. This is a bad experience for the user. This change will just remove the container from storage. If the container is known by libpod, it will remove the container from libpod as well. The podman rm --storage option has been deprecated, and removed from docs. Also cleaned documented options that are not available to podman-remote. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Fix some flakes in the e2e network tests.Paul Holzinger2020-10-01
| | | | | | | | | | The network test created config files with random filenames but the network name was static. Since the tests can run in parallel podman was not able to distinguish the networks. We need to make sure that each test has its own config file and network name. This helps to prevent unnecessary flakes. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Make the e2e test network cleanup more robust.Daniel J Walsh2020-09-30
| | | | | | | | | | | | | We need to handle removal of non existing network. This allows the `removeCNINetwork` function always to be called. This is needed by tests which are trying to remove the network manually in order to prevent flakes. Fixes #7809 Signed-off-by: Paul Holzinger <paul.holzinger@web.de> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Merge pull request #7825 from rhatdan/exitcodeOpenShift Merge Robot2020-09-30
|\ | | | | Fix handling of remove of bogus volumes, networks and Pods
| * Fix handling of remove of bogus volumes, networks and PodsDaniel J Walsh2020-09-29
| | | | | | | | | | | | | | | | | | | | | | | | In podman containers rm and podman images rm, the commands exit with error code 1 if the object does not exists. This PR implements similar functionality to volumes, networks, and Pods. Similarly if volumes or Networks are in use by other containers, and return exit code 2. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Make all Skips specify a reasonDaniel J Walsh2020-09-29
|/ | | | | | Always use CGROUPV2 rather then reading from system all the time. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Merge pull request #7786 from rhatdan/rootlessOpenShift Merge Robot2020-09-28
|\ | | | | Remove SkipIfRootless if possible, document other calls
| * Remove SkipIfRootless if possible, document other callsDaniel J Walsh2020-09-27
| | | | | | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Fix network remove for the podman remote clientPaul Holzinger2020-09-28
| | | | | | | | | | | | | | | | The podman remote client ignored the force option due a typo. If an error occured the remote client would panic with an index out of range error. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>