115_topologies_test.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #! /bin/bash
  2. # shellcheck disable=SC1091
  3. . ./config.sh
  4. start_suite "Test some key topologies are not empty"
  5. scope_on "$HOST1" launch
  6. wait_for_containers "$HOST1" 60 weavescope
  7. topology_is_not_empty() {
  8. local host="$1"
  9. local topology="$2"
  10. local timeout="${5:-60}"
  11. for _ in $(seq "$timeout"); do
  12. local report
  13. local count
  14. report="$(curl -s "http://$host:4040/api/report")"
  15. count=$(echo "$report" | jq -r ".$topology.nodes | length > 0" 2>/dev/null)
  16. if [ "$count" = "true" ]; then
  17. assert "curl -s http://$host:4040/api/report | jq -r '.$topology.nodes | length > 0'" true
  18. return
  19. fi
  20. sleep 1
  21. done
  22. echo "Failed to find any nodes in the $topology topology after $timeout secs"
  23. assert "curl -s http://$host:4040/api/report | jq -r '.$topology.nodes | length > 0'" true
  24. }
  25. topology_is_not_empty "$HOST1" Endpoint
  26. topology_is_not_empty "$HOST1" Process
  27. topology_is_not_empty "$HOST1" Container
  28. topology_is_not_empty "$HOST1" ContainerImage
  29. topology_is_not_empty "$HOST1" Host
  30. scope_end_suite