314_container_accept_before_kretprobe_test.sh 992 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #! /bin/bash
  2. # shellcheck disable=SC1091
  3. . ./config.sh
  4. start_suite "Test accept before kretprobe, see https://github.com/weaveworks/tcptracer-bpf/issues/10"
  5. weave_on "$HOST1" launch
  6. # Launch the server before Scope to make sure it calls accept() before Scope's
  7. # kretprobe on the accept function is installed. We use busybox' nc instead of
  8. # Alpine's nc so that it blocks on the accept() syscall.
  9. weave_proxy_on "$HOST1" run -d --name server busybox /bin/sh -c "while true; do \
  10. date ;
  11. sleep 1 ;
  12. done | nc -l -p 8080"
  13. scope_on "$HOST1" launch
  14. wait_for_containers "$HOST1" 60 server
  15. has_container "$HOST1" server
  16. weave_proxy_on "$HOST1" run -d --name client busybox /bin/sh -c "ping -c 5 server.weave.local; \
  17. while true; do \
  18. date ;
  19. sleep 1 ;
  20. done | nc server.weave.local 8080"
  21. wait_for_containers "$HOST1" 60 server client
  22. has_container "$HOST1" client
  23. list_containers "$HOST1"
  24. list_connections "$HOST1"
  25. has_connection containers "$HOST1" client server
  26. scope_end_suite