315_ebpf_restart_test.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #! /bin/bash
  2. # shellcheck disable=SC1091
  3. . ./config.sh
  4. start_suite "Test with ebpf restarts and proc fallback"
  5. weave_on "$HOST1" launch
  6. # Manually start scope in order to start EbpfTracker in debug mode
  7. DOCKER_HOST=tcp://${HOST1}:${DOCKER_PORT} CHECKPOINT_DISABLE=true \
  8. WEAVESCOPE_DOCKER_ARGS="-e SCOPE_DEBUG_BPF=1" \
  9. "${SCOPE}" launch
  10. server_on "$HOST1"
  11. client_on "$HOST1"
  12. wait_for_containers "$HOST1" 60 nginx client
  13. has_container "$HOST1" nginx
  14. has_container "$HOST1" client
  15. has_connection containers "$HOST1" client nginx
  16. docker_on "$HOST1" exec weavescope sh -c "mkdir /var/run/scope && echo stop > /var/run/scope/debug-bpf"
  17. sleep 5
  18. server_on "$HOST1" "nginx2"
  19. client_on "$HOST1" "client2" "nginx2"
  20. wait_for_containers "$HOST1" 60 nginx2 client2
  21. has_container "$HOST1" nginx2
  22. has_container "$HOST1" client2
  23. has_connection containers "$HOST1" client2 nginx2
  24. # Save stdout for debugging output
  25. exec 3>&1
  26. assert_raises "docker_on $HOST1 logs weavescope 2>&1 | grep 'ebpf tracker died, restarting it' || (docker_on $HOST1 logs weavescope 2>&3 ; false)"
  27. docker_on "$HOST1" exec weavescope sh -c "echo stop > /var/run/scope/debug-bpf"
  28. sleep 5
  29. server_on "$HOST1" "nginx3"
  30. client_on "$HOST1" "client3" "nginx3"
  31. wait_for_containers "$HOST1" 60 nginx3 client3
  32. has_container "$HOST1" nginx3
  33. has_container "$HOST1" client3
  34. has_connection containers "$HOST1" client3 nginx3
  35. assert_raises "docker_on $HOST1 logs weavescope 2>&1 | grep 'ebpf tracker died again, gently falling back to proc scanning' || (docker_on $HOST1 logs weavescope 2>&3 ; false)"
  36. scope_end_suite