From 9bd978cc8ebf2fd9075f2be646fafd90128d403f Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 17 Apr 2016 13:56:37 +0200 Subject: [PATCH] Add a test for tinc-up creation from invitations. --- test/Makefile.am | 1 + test/invite-tinc-up.test | 51 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100755 test/invite-tinc-up.test diff --git a/test/Makefile.am b/test/Makefile.am index 5457b2fc..df8e2c3b 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -4,6 +4,7 @@ TESTS = \ executables.test \ import-export.test \ invite-join.test \ + invite-tinc-up.test \ ns-ping.test \ ping.test \ sptps-basic.test \ diff --git a/test/invite-tinc-up.test b/test/invite-tinc-up.test new file mode 100755 index 00000000..bc5d45bf --- /dev/null +++ b/test/invite-tinc-up.test @@ -0,0 +1,51 @@ +#!/bin/sh + +. ./testlib.sh + +# Initialize one node + +$tinc $c1 <$d1/invitation-created <\$INVITATION_FILE +echo Ifconfig = 93.184.216.34/24 >>\$INVITATION_FILE +echo Route = 2606:2800:220:1::/64 2606:2800:220:1:248:1893:25c8:1946 >>\$INVITATION_FILE +echo Route = 1.2.3.4 1234:: >>\$INVITATION_FILE +$tinc $c1 export >>\$INVITATION_FILE +EOF + +chmod u+x $d1/invitation-created + +$tinc $c1 invite bar | $tinc $c2 --batch join + +# Test equivalence of host config files + +cmp $d1/hosts/foo $d2/hosts/foo +test "`grep ^Ed25519PublicKey $d1/hosts/bar`" = "`grep ^Ed25519PublicKey $d2/hosts/bar`" + +# Check if the tinc-up.invitation file is created and contains the right commands + +test -f $d2/tinc-up.invitation + +fgrep -q "93.184.216.34/24" $d2/tinc-up.invitation +fgrep -q "2606:2800:220:1::/64" $d2/tinc-up.invitation +fgrep -q "2606:2800:220:1:248:1893:25c8:1946" $d2/tinc-up.invitation +fgrep -q "1234::" $d2/tinc-up.invitation && exit 1 + +# Check that no tinc-up is created and that tinc-up.invitation is not executable + +test -x $d2/tinc-up.invitation && exit 1 +test -f $d2/tinc-up && exit 1 + +$tinc $c1 stop -- 2.20.1