test-network: Remove/replace non-capturing group regex
authorDan Streetman <ddstreet@canonical.com>
Thu, 31 Oct 2019 16:19:23 +0000 (12:19 -0400)
committerDan Streetman <ddstreet@canonical.com>
Fri, 1 Nov 2019 16:32:49 +0000 (12:32 -0400)
commit426654d72839cb8886a43554211757a300e7897c
treeeca7178716f4c5b41e631328b6b27a631ee42722
parent7471bcb06e9c74bfb3c867a14c7e2a94a8c06dbe
test-network: Remove/replace non-capturing group regex

The systemd-networkd-tests.py has some regex that uses non-capturing
groups, but there is no need to use that with assertRegex; the
groups aren't referenced so it doesn't matter if it's capturing or
non-capturing.  However, there are a few places where optional groups
should have been used instead, so this changes that.

Specifically, groups like this:
(?:whatever |)
should actually be:
(whatever )?

Additionally, this is specifically needed for these tests to run on
Debian systems, because this assertRegex:
'Link File: (?:/usr)/lib/systemd/network/99-default.link'
needs to be:
'Link File: (/usr)?/lib/systemd/network/99-default.link'
test/test-network/systemd-networkd-tests.py