mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-14 18:09:59 +00:00
integration tests: list containers & endpoints for debugging
And when endpoints_have_ebpf() fails to find all endpoints with eBPF, print an example of endpoint.
This commit is contained in:
@@ -17,6 +17,10 @@ wait_for_containers "$HOST1" 60 nginx client
|
||||
|
||||
has_container "$HOST1" nginx
|
||||
has_container "$HOST1" client
|
||||
|
||||
list_containers "$HOST1"
|
||||
list_connections "$HOST1"
|
||||
|
||||
has_connection containers "$HOST1" client nginx
|
||||
|
||||
endpoints_have_ebpf "$HOST1"
|
||||
|
||||
@@ -13,6 +13,10 @@ wait_for_containers "$HOST1" 60 nginx client
|
||||
|
||||
has_container "$HOST1" nginx
|
||||
has_container "$HOST1" client
|
||||
|
||||
list_containers "$HOST1"
|
||||
list_connections "$HOST1"
|
||||
|
||||
has_connection containers "$HOST1" client nginx
|
||||
|
||||
endpoints_have_ebpf "$HOST1"
|
||||
|
||||
@@ -40,6 +40,19 @@ scope_end_suite() {
|
||||
done
|
||||
}
|
||||
|
||||
list_containers() {
|
||||
local host=$1
|
||||
echo "Listing containers on ${host}:"
|
||||
curl -s "http://${host}:4040/api/topology/containers?system=show" | jq -r '.nodes[] | select(has("metadata")) | .metadata[] | select(.id == "docker_image_name") | .value'
|
||||
}
|
||||
|
||||
list_connections() {
|
||||
local host=$1
|
||||
echo "Listing connections on ${host}:"
|
||||
curl -s "http://${host}:4040/api/topology/containers?system=show" | jq -r '.nodes[] | select(has("adjacency")) | { "from": .id, "to": .adjacency[]} | .from + " -> " + .to'
|
||||
|
||||
}
|
||||
|
||||
# this checks we have a named node in the given view
|
||||
has() {
|
||||
local view=$1
|
||||
@@ -111,6 +124,8 @@ endpoints_have_ebpf() {
|
||||
done
|
||||
|
||||
echo "Only ${have_ebpf} endpoints of ${number_of_endpoints} have ebpf enabled, should be equal"
|
||||
echo "Example of one endpoint:"
|
||||
echo "${report}" | jq -r '[.Endpoint.nodes[]][0]'
|
||||
assert "echo '$have_ebpf" "$number_of_endpoints"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user