import-export.test 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. . ./testlib.sh
  3. # Initialize three nodes
  4. $tinc $c1 <<EOF
  5. init foo
  6. set DeviceType dummy
  7. set Port 32752
  8. set Address localhost
  9. EOF
  10. $tinc $c2 <<EOF
  11. init bar
  12. set DeviceType dummy
  13. set Port 0
  14. EOF
  15. $tinc $c3 <<EOF
  16. init baz
  17. set DeviceType dummy
  18. set Port 0
  19. EOF
  20. # Test import, export and exchange commands
  21. $tinc $c1 export | $tinc $c2 exchange | $tinc $c1 import
  22. # Test export-all and exchange-all
  23. $tinc $c1 export-all | $tinc $c3 exchange | $tinc $c1 import
  24. $tinc $c1 exchange-all </dev/null | $tinc $c2 import
  25. # Test equivalence of host config files
  26. cmp $d1/hosts/foo $d2/hosts/foo
  27. cmp $d1/hosts/foo $d3/hosts/foo
  28. cmp $d1/hosts/bar $d2/hosts/bar
  29. cmp $d1/hosts/bar $d3/hosts/bar
  30. cmp $d1/hosts/baz $d2/hosts/baz
  31. cmp $d1/hosts/baz $d3/hosts/baz
  32. # Check whether the nodes can connect to each other
  33. $tinc $c1 start $r1
  34. $tinc $c2 add ConnectTo foo
  35. $tinc $c3 add ConnectTo foo
  36. sleep 1
  37. $tinc $c2 start $r2
  38. $tinc $c3 start $r3
  39. sleep 1
  40. test `$tinc $c1 dump reachable nodes | wc -l` = 3
  41. test `$tinc $c2 dump reachable nodes | wc -l` = 3
  42. test `$tinc $c3 dump reachable nodes | wc -l` = 3
  43. $tinc $c3 stop
  44. $tinc $c2 stop
  45. $tinc $c1 stop