summaryrefslogtreecommitdiff
path: root/test/networkd-test.py
Commit message (Collapse)AuthorAgeFilesLines
* network: Show network and link file dropins in networkctl statusDaan De Meyer2023-01-121-0/+3
| | | | Fixes #24428
* network/bridge: fix UseBPDU= and AllowPortToBeRoot=Yu Watanabe2022-08-141-2/+2
| | | | | | Fixes bugs caused by 7f9915f0de67f3a10a4b22810d119da65af8c84a. Fixes #24268.
* docs: use lowercase "qemu" and other minor tweaks to test docsZbigniew Jędrzejewski-Szmek2022-05-041-1/+1
| | | | | | | | | We used both "qemu" and "QEMU", let's use the lower-case version everywhere since it's also the name of the binary and the version that people are most familiar with. The stuff under test/ is not only for the integeration tests, but also for various other test-related stuff, so adjust the docs a bit.
* networkd-test: lazy umount tmp directoriesLuca Boccassi2022-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | In Semaphore CI, for some reason, /run/systemd/resolve is busy so the umount fails at the end of the test run: Verify link states with Unmanaged= settings, cold-plug. ... umount: /run/systemd/resolve: target is busy.14:57 ok14:57 ERROR14:57 ======================================================================14:57 ERROR: tearDownModule (__main__)14:57 ----------------------------------------------------------------------14:57 Traceback (most recent call last):14:57 File /tmp/autopkgtest-lxc.6islza9t/downtmp/build.A9b/src/test/networkd-test.py, line 94, in tearDownModule14:57 subprocess.check_call([umount, d])14:57 File /usr/lib/python3.9/subprocess.py, line 373, in check_call14:57 raise CalledProcessError(retcode, cmd)14:57 subprocess.CalledProcessError: Command '['umount', '/run/systemd/resolve']' returned non-zero exit status 32.14:57 ----------------------------------------------------------------------14:58 Ran 35 tests in 138.868s14:58 FAILED (errors=1, skipped=2) Use lazy umount to avoid erroring out.
* tree-wide: fix duplicated wordsMichael Biebl2022-03-181-1/+1
| | | | | | | the the in in not not we we
* Add support for `isolated` parameterSanta Wiryaman2022-02-091-0/+2
| | | | | | | | | | | | | | | | | | Add the "Isolated" parameter in the *.network file, e.g., [Bridge] Isolated=true|false When the Isolated parameter is true, traffic coming out of this port will only be forward to other ports whose Isolated parameter is false. When Isolated is not specified, the port uses the kernel default setting (false). The "Isolated" parameter was introduced in Linux 4.19. See man bridge(8) for more details. But even though the kernel and bridge/iproute2 recognize the "Isolated" parameter, systemd-networkd did not have a way to set it.
* networkd-test: fix resolved_domain_restricted_dnsMichael Biebl2021-10-011-5/+5
| | | | | | | | | | | | | | | | | | megasearch.net was meant to be a non-existing bogus domain, and had been for a long time. But it seems some domain grabber recently registered it, and it's an actual thing now: $ host megasearch.net megasearch.net has address 207.148.248.143 This causes the test to fail randomly. Use search.example.com instead which yields $ host search.example.com Host search.example.com not found: 3(NXDOMAIN) Fixes: #18357
* test/networkd-test: in bridge test, wait for online after restart ↵Dan Streetman2021-05-281-0/+9
| | | | | | | | | | systemd-networkd without waiting for online, there is a race condition between systemd-networkd actually setting the new values and the test checking those values This also sets the link down before restarting systemd-networkd, to avoid the wait for online being a no-op
* networkd-test: support online state in networkctl status outputAlvin Šipraga2021-05-191-0/+1
| | | | | networkctl status now outputs an online state. Fix up the tests to account for this.
* networkd-test: reenable dnssec while testingLennart Poettering2021-02-181-9/+17
| | | | | | | We need to list the synthesized domains as NTAs, otherwise the DNSSEC validation of course cannot succeed. Fixes: #10487 #5029
* networkd-test: add final newlines in generated files, use .format()Zbigniew Jędrzejewski-Szmek2020-12-101-30/+50
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* test-network: stop networkd and its socketMichael Biebl2020-08-281-4/+8
| | | | | | | | With the changes from 2c0dffe82db574b6b9e850e48f444674e4e1d7ea, starting systemd-networkd.service will also activate systemd-networkd.socket. When tearing down a test, we need to stop the socket as well, to make sure networkd can't be activated accidentally with the wrong configuration.
* resolve: lift limits on search domains count or lengthDimitri John Ledkov2020-08-181-34/+1
| | | | | | | | | glibc 2.26 lifted restrictions on search domains count or length to unlimited. This has also been backported to 2.17 in some distributions (RHEL 7 and derivatives). Other softwares may have their own limits for search domains, but we should not restrict what is written out any more. https://sourceware.org/legacy-ml/libc-announce/2017/msg00001.html
* test-network: wait for addresses are not in tentative stateYu Watanabe2020-07-151-1/+1
|
* test-network: suppress logs in status commandYu Watanabe2020-01-071-2/+2
|
* test: print an error when networkctl returns an unexpected ECFrantisek Sumsal2019-07-311-1/+3
| | | | | | If networkctl crashes, like recently with SIGABRT, it returns absolutely no output, which may be confusing during debugging. Help it a little with a short informative message.
* test: use `useradd` instead of `adduser`Frantisek Sumsal2019-07-301-1/+2
| | | | | | | | `adduser` is in certain cases a standalone package which provides a better user experience. In other cases it's just a symlink to `useradd`. And some distributions don't have `adduser` at all, like Arch Linux. Let's use the `useradd` binary instead, which should provide the same functionality everywhere.
* test: use newer verb to set log levelsZbigniew Jędrzejewski-Szmek2019-04-031-2/+2
|
* networkd-test: ignore failures of test_route_only_dns* in containersMartin Pitt2019-02-271-4/+19
| | | | | | This test exposes a race condition when running in LXC, see issue #11848 for details. Until that is understood and fixed, skip the test as it's not a recent regression.
* networkd-test: specify Address= with prefix lengthMartin Pitt2019-02-271-5/+5
| | | | | | | | This avoids a warning: An address '192.168.42.100' is specified without prefix length. The behavior of parsing addresses without prefix length will be changed in the future release. Please specify prefix length explicitly.
* networkd-test: show service journal on startup failureMartin Pitt2019-02-271-11/+15
| | | | This provides easier evaluation of failed tests.
* networkd-test: fix test_dropin()Martin Pitt2019-02-211-2/+2
| | | | | | | | - This test needs resolved, so make sure it is started. In some Debian environments it is not. - It was an unnecessary, and now failing assumption that name servers get atomically written to the resolved's resolv.conf. Wait until both expected name servers are in the file.
* networkd-test: use a complete domain name in test_route_only_dns()Martin Pitt2019-02-211-16/+16
| | | | | | | Since version 241 (commit ea4678?), querying MX type records for single-label domains does not actually forward the query to the DNS server any more. Use "example.com" instead, which is the recommended test domain anyway.
* networkd-test: disable DNSSEC in domain-restricted DNS testMartin Pitt2019-02-211-0/+7
| | | | | | | | dnsmasq 2.80 changed behaviour when being queried by resolved with enabled DNSSEC: It returns errors for SOA and DS queries which cause the entire query to fail. As we don't configure DNSSEC in this test anyway, just disable it so that we retain compatibility with old and new dnsmasq versions.
* resolved: bind .local domains to mDNS with DNS_SCOPE_YES, similar LLMNRLennart Poettering2018-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | Previously, we'd return DNS_SCOPE_MAYBE for all domain lookups matching LLMNR or mDNS. Let's upgrade this to DNS_SCOPE_YES, to make the binding stronger. The effect of this is that even if "local" is defined as routing domain on some iface, we'll still lookup domains in local via mDNS — if mDNS is turned on. This should not be limiting, as people who don't want such lookups should turn off mDNS altogether, as it is useless if nothing is routed to it. This also has the nice benefit that mDNS/LLMR continue to work if people use "~." as routing domain on some interface. Similar for LLMNR and single label names. Similar also for the link local IPv4 and IPv6 reverse lookups. Fixes: #10125
* networkd-test: change test_transient_hostname_with_static to use an explicit ↵Lennart Poettering2018-12-071-2/+10
| | | | | | | | | | | | | static hostname Previously, the test would use the existing static hostname. However, this woud not work as expected in the static hostname was "localhost" because the transient hostname will override the static one in that case anyway, as the assumption hostnamed makes is that "localhost" is a non-initialized hostname. Hence when testing this, let's first set the static hostname to something specific first (that is not "localhost").
* networkd-test: restart hostnamed after reverting /etc/hostname tooLennart Poettering2018-12-071-0/+2
| | | | Otherwise hostnamed will not report the right data in the next test
* networkd-test: add write_config()Lennart Poettering2018-12-071-6/+10
| | | | | The call was removed in ec89276c2ab345b84c2dab4c35826de41aa6fd0f, but is still used. Not sure why noone noticed this.
* networkd-test: set right access modes for /run/systemd/netifLennart Poettering2018-12-071-5/+10
| | | | | | | | Otherwise networkd isn't happy. Let's also make addition of the "systemd-network" non-fatal. The user exists on many machines anyway, hence it shouldn't fail if it already exists.
* tests: update networkd-test.py to use resolvectl instead of systemd-resolve ↵Michael Biebl2018-10-231-10/+10
| | | | | (#10486) The latter is merely a compat symlink nowadays.
* Revert "resolve: enable DynamicUser= for systemd-resolved.service"Zbigniew Jędrzejewski-Szmek2018-09-201-0/+1
| | | | | This reverts commit 0187368cadea183e18c6d575a9d6b7f491a402af. (systemd.conf.m4 part was already reverted in 5b5d82615011b9827466b7cd5756da35627a1608.)
* test: Fix networkd test for an already running serviceMartin Pitt2018-07-091-4/+34
| | | | | | | | | | | | | | Mount tmpfses over the networkd and resolved config and state directories, and stop the services beforehand. This ensures that the test does not mess with an existing networkd/resolved setup. At least for ethernet setups, this does not sever existing links, so is good enough for the CI cases we are interested in (QEMU and LXC). Relax the skip check to only skip the test when trying to run this on real iron, but start running it in virtual machines now. This allows us to run the test on Ubuntu 18.04 LTS in CI, which uses both services by default.
* test: Reset systemd-resolved.service in networkd testMartin Pitt2018-07-091-2/+2
| | | | | | Like s-networkd.service itself, it can happen that s-resolved.service runs into restart limits. Don't enforce a successful call, as on machines without resolved the unit might not be loaded.
* test: fix networkd-test.py rate limiting and dynamic userMartin Pitt2018-07-031-0/+8
| | | | | | | | - Reset systemd-networkd.service before each test run, to avoid running into restart limits. - Our networkd-test-router.service unit needs to run as root and thus can't use `User=`; but networkd still insists on the `systemd-network` system user to exist, so create it.
* tree-wide: use proper unicode © instead of (C) where we canLennart Poettering2018-06-141-1/+1
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* Networkd tests: add bridge link properties to testSusant Sahani2018-05-101-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | Test the "[Bridge]" section keys ``` [Bridge] UnicastFlood=true HairPin=true UseBPDU=true FastLeave=true AllowPortToBeRoot=true Cost=555 Priority=23 ``` ``` test_bridge_init (__main__.BridgeTest) ... ok test_bridge_port_priority (__main__.BridgeTest) ... ok test_bridge_port_priority_set_zero (__main__.BridgeTest) It should be possible to set the bridge port priority to 0 ... ok test_bridge_port_property (__main__.BridgeTest) Test the "[Bridge]" section keys ... ok ```
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* test: sort imports and use "new" string formattingBatuhan Osman Taşkaya2018-02-051-26/+25
| | | | | | Followed PEP8 and PEP3101 rules (#8079) Imports re-ordered by Alphabetical Standarts for following PEP8 Old type string formattings (" example %s " % exampleVar ) re-writed as new type string formattings ( " example {} ".format(exampleVar) ) for following PEP3101
* separate flags from shebangbleep_blop2017-12-251-1/+2
|
* Add SPDX license headers to python scriptsZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
|
* test: drop Exec* prefixes to obtain paths of executablesYu Watanabe2017-08-301-1/+1
|
* tests: ignore router state in networkd test (#6390)Martin Pitt2017-07-181-1/+1
| | | | | | In networkd-test.py, don't assert that the router state is "routable". While it should eventually become that, we don't wait for it, and thus at that point it often is "carrier" or "degrated" still. It is also not really relevant as this only tests the "client" side interface.
* networkd: Add bridge port priority setting (#5545)Dimitri John Ledkov2017-04-111-0/+78
| | | | | | | | | | | Allow setting bridge port priority in the Bridge section of the network file, similar to e.g. port path cost setting. Set the default to an invalid value of 128, and only set the port priority when it's not 128. Unlike e.g. path cost, zero is a valid priority value. Add a networkd-test.py to check that bridge port priority is correctly set. Incidently, fix bridge port cost type and document valid ranges.
* tests: show journal on systemd-resolved.service failures (#5297)Martin Pitt2017-02-091-1/+5
| | | | In networkd-test.py, show resolved's journal on failure, to debug issues like https://github.com/systemd/systemd/pull/5283.
* tests: more precise negative check for dnsmasq log (#4982)Martin Pitt2016-12-261-2/+2
| | | | | | | In test_resolved_domain_restricted_dns(), add dot domain separator to negative .lab/.company tests, so that we don't catch these as part of the host name (like "lxc-labjfr"). Caught in PR #4962
* resolved: correctly handle non-address RR types with /etc/hosts lookups (#4808)Martin Pitt2016-12-221-0/+55
| | | | | | | | | | | | | | | Fix wrong condition test in manager_etc_hosts_lookup(), which caused it to return an IPv4 answer when an IPv6 question was asked, and vice versa. Also only return success if we actually found any A or AAAA record. In systemd-resolved.service(8), point out that /etc/hosts mappings only affect address-type lookups, not other types. The test case currently disables DNSSEC in resolved, as there is a bug where "-t MX" fails due to "DNSSEC validation failed" even after "downgrading to non-DNSSEC mode". This should be dropped once that bug gets fixed. Fixes #4801
* network: support negation in matching patterns (#4809)David Michael2016-12-071-8/+46
|
* Merge pull request #4228 from dm0-/coreos-1554Zbigniew Jędrzejewski-Szmek2016-12-021-47/+188
|\ | | | | networkd: support marking links unmanaged
| * networkd: support marking links unmanagedDavid Michael2016-12-011-0/+116
| |