invite-join.test 866 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. . ./testlib.sh
  3. # Initialize one node
  4. $tinc $c1 <<EOF
  5. init foo
  6. set DeviceType dummy
  7. set Mode switch
  8. set Broadcast no
  9. del Port
  10. set Address localhost
  11. set Port 32751
  12. start $r1
  13. EOF
  14. # Generate an invitation and let another node join the VPN
  15. sleep 1
  16. $tinc $c1 invite bar | $tinc $c2 join
  17. # Test equivalence of host config files
  18. cmp $d1/hosts/foo $d2/hosts/foo
  19. test "`grep ^ECDSAPublicKey $d1/hosts/bar`" = "`grep ^ECDSAPublicKey $d2/hosts/bar`"
  20. # Test Mode, Broadcast and ConnectTo statements
  21. test `$tinc $c2 get Mode` = switch
  22. test `$tinc $c2 get Broadcast` = no
  23. test `$tinc $c2 get ConnectTo` = foo
  24. # Check whether the new node can join the VPN
  25. $tinc $c2 << EOF
  26. set DeviceType dummy
  27. set Port 0
  28. start $r2
  29. EOF
  30. sleep 1
  31. test `$tinc $c1 dump reachable nodes | wc -l` = 2
  32. test `$tinc $c2 dump reachable nodes | wc -l` = 2
  33. $tinc $c2 stop
  34. $tinc $c1 stop