Skip to content

Commit

Permalink
test:generator: wait-online DNS testing
Browse files Browse the repository at this point in the history
  • Loading branch information
slyon committed Feb 3, 2025
1 parent 68328a8 commit 8bf3f10
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/generator/test_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,13 @@ def test_systemd_generator(self):
# eth99 does not exist on the system, so will not be listed
self.assertEqual(f.read(), '''[Unit]
ConditionPathIsSymbolicLink=/run/systemd/generator/network-online.target.wants/systemd-networkd-wait-online.service
After=systemd-resolved.service
[Service]
ExecStart=
ExecStart=/lib/systemd/systemd-networkd-wait-online -i eth99.43:carrier -i lo:carrier \
-i eth99.42:carrier -i eth99.44:degraded -i bond0:degraded
ExecStart=/lib/systemd/systemd-networkd-wait-online --any -o routable -i eth99.43 -i eth99.45 -i bond0\n''')
ExecStart=/lib/systemd/systemd-networkd-wait-online --any --dns -o routable -i eth99.43 -i eth99.45 -i bond0\n''')

# should be a no-op the second time while the stamp exists
out = subprocess.check_output([generator, '--root-dir', self.workdir.name, outdir, outdir, outdir],
Expand Down Expand Up @@ -323,11 +324,12 @@ def test_systemd_wait_online_only_routable(self):
with open(override, 'r') as f:
self.assertEqual(f.read(), '''[Unit]
ConditionPathIsSymbolicLink=/run/systemd/generator/network-online.target.wants/systemd-networkd-wait-online.service
After=systemd-resolved.service
[Service]
ExecStart=
ExecStart=/lib/systemd/systemd-networkd-wait-online -i br0:degraded
ExecStart=/lib/systemd/systemd-networkd-wait-online --any -o routable -i br0
ExecStart=/lib/systemd/systemd-networkd-wait-online --any --dns -o routable -i br0
''')

def test_systemd_generator_noconf(self):
Expand Down Expand Up @@ -395,11 +397,12 @@ def test_systemd_generator_escaping(self):
# eth99 does not exist on the system, so will not be listed
self.assertEqual(f.read(), '''[Unit]
ConditionPathIsSymbolicLink=/run/systemd/generator/network-online.target.wants/systemd-networkd-wait-online.service
After=systemd-resolved.service
[Service]
ExecStart=
ExecStart=/lib/systemd/systemd-networkd-wait-online -i a \\; b\\t; c\\t; d \\n 123 \\; echo :degraded
ExecStart=/lib/systemd/systemd-networkd-wait-online --any -o routable -i a \\; b\\t; c\\t; d \\n 123 \\; echo \n''')
ExecStart=/lib/systemd/systemd-networkd-wait-online --any --dns -o routable -i a \\; b\\t; c\\t; d \\n 123 \\; echo \n''')

# should be a no-op the second time while the stamp exists
out = subprocess.check_output([generator, '--root-dir', self.workdir.name, outdir, outdir, outdir],
Expand Down

0 comments on commit 8bf3f10

Please sign in to comment.