mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-14 18:09:59 +00:00
integration test: restart EbpfTracker
This commit is contained in:
55
integration/315_ebpf_restart_test.sh
Executable file
55
integration/315_ebpf_restart_test.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#! /bin/bash
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
. ./config.sh
|
||||
|
||||
start_suite "Test with ebpf restarts and proc fallback"
|
||||
|
||||
weave_on "$HOST1" launch
|
||||
# Manually start scope in order to start EbpfTracker in debug mode
|
||||
DOCKER_HOST=tcp://${HOST1}:${DOCKER_PORT} CHECKPOINT_DISABLE=true \
|
||||
WEAVESCOPE_DOCKER_ARGS="-e SCOPE_DEBUG_BPF=1" \
|
||||
"${SCOPE}" launch
|
||||
|
||||
server_on "$HOST1"
|
||||
client_on "$HOST1"
|
||||
|
||||
wait_for_containers "$HOST1" 60 nginx client
|
||||
|
||||
has_container "$HOST1" nginx
|
||||
has_container "$HOST1" client
|
||||
has_connection containers "$HOST1" client nginx
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
run_on "$HOST1" 'echo stop | sudo tee /proc/$(pidof scope-probe)/root/var/run/scope/debug-bpf'
|
||||
sleep 5
|
||||
|
||||
server_on "$HOST1" "nginx2"
|
||||
client_on "$HOST1" "client2" "nginx2"
|
||||
|
||||
wait_for_containers "$HOST1" 60 nginx2 client2
|
||||
|
||||
has_container "$HOST1" nginx2
|
||||
has_container "$HOST1" client2
|
||||
has_connection containers "$HOST1" client2 nginx2
|
||||
|
||||
# Save stdout for debugging output
|
||||
exec 3>&1
|
||||
assert_raises "docker_on $HOST1 logs weavescope 2>&1 | grep 'ebpf tracker died, restarting it' || (docker_on $HOST1 logs weavescope 2>&3 ; false)"
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
run_on "$HOST1" 'echo stop | sudo tee /proc/$(pidof scope-probe)/root/var/run/scope/debug-bpf'
|
||||
sleep 5
|
||||
|
||||
server_on "$HOST1" "nginx3"
|
||||
client_on "$HOST1" "client3" "nginx3"
|
||||
|
||||
wait_for_containers "$HOST1" 60 nginx3 client3
|
||||
|
||||
has_container "$HOST1" nginx3
|
||||
has_container "$HOST1" client3
|
||||
has_connection containers "$HOST1" client3 nginx3
|
||||
|
||||
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)"
|
||||
|
||||
scope_end_suite
|
||||
@@ -36,13 +36,18 @@ weave_proxy_on() {
|
||||
}
|
||||
|
||||
server_on() {
|
||||
weave_proxy_on "$1" run -d --name nginx nginx
|
||||
local host=$1
|
||||
local name=${2:-nginx}
|
||||
weave_proxy_on "$1" run -d --name "$name" nginx
|
||||
}
|
||||
|
||||
client_on() {
|
||||
weave_proxy_on "$1" run -d --name client alpine /bin/sh -c "while true; do \
|
||||
wget http://nginx.weave.local:80/ -O - >/dev/null || true; \
|
||||
sleep 1; \
|
||||
local host=$1
|
||||
local name=${2:-client}
|
||||
local server=${3:-nginx}
|
||||
weave_proxy_on "$1" run -d --name "$name" alpine /bin/sh -c "while true; do \
|
||||
wget http://$server.weave.local:80/ -O - >/dev/null || true; \
|
||||
sleep 1; \
|
||||
done"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user