X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=test%2Fintegration%2Ftestlib%2Fcmd.py;fp=test%2Fintegration%2Ftestlib%2Fcmd.py;h=3a97fc9891f9b858aceff059cdbbe57e52fca436;hp=9a71f65c68d57ae1e9fcc2c7261be699bd2b5c84;hb=c8402791b82947c49ba1d04f855dab04191607ca;hpb=66eb66ec8f872db3dc12e1d01101772918d69a4a diff --git a/test/integration/testlib/cmd.py b/test/integration/testlib/cmd.py index 9a71f65c..3a97fc98 100755 --- a/test/integration/testlib/cmd.py +++ b/test/integration/testlib/cmd.py @@ -13,6 +13,21 @@ ExchangeIO = T.Tuple[ ] +def connect(node0: Tinc, node1: Tinc) -> ExchangeIO: + """Exchange configuration between nodes and start + them in such an order that `Port 0` works on both sides. + """ + node0.add_script(node1.script_up) + node0.start() + result = exchange(node0, node1) + node1.add_script(node0.script_up) + node1.cmd("add", "ConnectTo", node0.name) + node1.start() + node0[node1.script_up].wait() + node1[node0.script_up].wait() + return result + + def exchange(node0: Tinc, node1: Tinc, export_all: bool = False) -> ExchangeIO: """Run `export(-all) | exchange | import` between the passed nodes. `export-all` is used if export_all is set to True.