3 """Check that basic functionality works (tincd can be started and stopped)."""
5 from testlib.test import Test
6 from testlib.proc import Tinc
7 from testlib.feature import SANDBOX_LEVEL
8 from testlib.log import log
9 from testlib.script import Script
10 from testlib import check
13 def init(ctx: Test) -> Tinc:
14 """Initialize new test nodes."""
15 node = ctx.node(init=f"set Sandbox {SANDBOX_LEVEL}")
16 node.add_script(Script.TINC_UP)
20 def test(ctx: Test, *flags: str) -> None:
21 """Run tests with flags."""
22 log.info("init new node")
25 log.info('starting tincd with flags "%s"', " ".join(flags))
26 tincd = node.tincd(*flags)
28 log.info("waiting for tinc-up script")
29 node[Script.TINC_UP].wait()
31 log.info("stopping tincd")
34 log.info("checking tincd exit code")
35 check.success(tincd.wait())
38 with Test("foreground mode") as context:
41 with Test("background mode") as context: