summaryrefslogtreecommitdiffstats
path: root/test/networkd-test.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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-101-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
| |
| * networkd-test: define a utility class to simplify testsDavid Michael2016-12-011-47/+72
| |
* | python: use raw strings for regexp patternsZbigniew Jędrzejewski-Szmek2016-12-021-12/+12
| | | | | | | | | | Behaviour is not changed, because "unknown" escapes like \s or \d were not substituted, but it's much nicer to use raw strings to avoid ambiguity.
* | python: adjust imports, indentation, unused variables following pylint adviceZbigniew Jędrzejewski-Szmek2016-12-021-2/+2
| |
* | test: retry checking for transient hostname in hostnamectl (#4769)Martin Pitt2016-11-301-2/+11
|/ | | | | | | | Sometimes setting the transient hostname does not happen synchronously, so retry up to five times. It is not yet clear whether this is legitimate behaviour or an underlying bug, but this will at least show whether the wrong transient hostname is just a race condition or permanently wrong. Fixes #4753
* test: make transient hostname tests fail verbosely (#4754)Martin Pitt2016-11-281-12/+37
| | | | | | | | | This test fails sometimes but it is hard to reproduce, so we need more information what happens. Set journal log level to "debug" for the entirety of networkd-test.py, and show networkd's and hostnamed's journals and the DHCP server log on failure of the two test_transient_hostname* tests. Also sync the journal before querying it to get more precise output. This should help with tracking down issue #4753.
* networkd: allow networkd to set the timezone in timedatedMartin Pitt2016-11-231-2/+30
| | | | | | | | | | | | | | | | | systemd-networkd runs as user "systemd-network" and thus is not privileged to set the timezone acquired from DHCP: systemd-networkd[4167]: test_eth42: Could not set timezone: Interactive authentication required. Similarly to commit e8c0de912, add a polkit rule to grant org.freedesktop.timedate1.set-timezone to the "systemd-network" system user. Move the polkit rules from src/hostname/ to src/network/ to avoid too many small distributed policy snippets (there might be more in the future), as it's easier to specify the privileges for a particular subject in this case. Add NetworkdClientTest.test_dhcp_timezone() test case to verify this (for all people except those in Pacific/Honolulu, there the test doesn't prove anything -- sorry ☺ ).
* tests: check transient hostname with and without static hostnameMartin Pitt2016-11-211-2/+30
| | | | We expect a static hostname to win over a transient one, so test both cases.
* hostnamed: allow networkd to set the transient hostnameMartin Pitt2016-11-201-4/+22
| | | | | | | | | | | | | | | | | | | | systemd-networkd runs as user "systemd-network" and thus is not privileged to set the transient hostname: systemd-networkd[516]: ens3: Could not set hostname: Interactive authentication required. Standard polkit *.policy files do not have a syntax for granting privileges to a user, so ship a pklocalauthority (for polkit < 106) and a JavaScript rules file (for polkit >= 106) that grants the "systemd-network" system user that privilege. Add DnsmasqClientTest.test_transient_hostname() test to networkd-test.py to cover this. Make do_test() a bit more flexible by interpreting "coldplug==None" as "test sets up the interface by itself". Change DnsmasqClientTest to set up test_eth42 with a fixed MAC address so that we can configure dnsmasq to send a special host name for that. Fixes #4646
* test: clean up "dummy0" interface after each test case in networkd-test.pyMartin Pitt2016-11-201-0/+2
|