mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
refactor: extract a couple of test helpers
This commit is contained in:
@@ -7,11 +7,9 @@ start_suite "Test short lived connections between containers"
|
||||
|
||||
weave_on "$HOST1" launch
|
||||
scope_on "$HOST1" launch
|
||||
weave_proxy_on "$HOST1" run -d --name nginx nginx
|
||||
weave_proxy_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \
|
||||
wget http://nginx.weave.local:80/ -O - >/dev/null || true; \
|
||||
sleep 1; \
|
||||
done"
|
||||
|
||||
server_on "$HOST1"
|
||||
client_on "$HOST1"
|
||||
|
||||
wait_for_containers "$HOST1" 60 nginx client
|
||||
|
||||
|
||||
@@ -7,11 +7,9 @@ start_suite "Test short lived connections between containers, without ebpf conne
|
||||
|
||||
weave_on "$HOST1" launch
|
||||
scope_on "$HOST1" launch --probe.ebpf.connections=false
|
||||
weave_proxy_on "$HOST1" run -d --name nginx nginx
|
||||
weave_proxy_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \
|
||||
wget http://nginx.weave.local:80/ -O - >/dev/null || true; \
|
||||
sleep 1; \
|
||||
done"
|
||||
|
||||
server_on "$HOST1"
|
||||
client_on "$HOST1"
|
||||
|
||||
wait_for_containers "$HOST1" 60 nginx client
|
||||
|
||||
|
||||
@@ -12,11 +12,9 @@ weave_on "$HOST1" launch
|
||||
DOCKER_HOST=tcp://${HOST1}:${DOCKER_PORT} CHECKPOINT_DISABLE=true \
|
||||
WEAVESCOPE_DOCKER_ARGS="-v /tmp:/sys/kernel/debug/tracing:ro" \
|
||||
"${SCOPE}" launch
|
||||
weave_proxy_on "$HOST1" run -d --name nginx nginx
|
||||
weave_proxy_on "$HOST1" run -d --name client alpine /bin/sh -c "while true; do \
|
||||
wget http://nginx.weave.local:80/ -O - >/dev/null || true; \
|
||||
sleep 1; \
|
||||
done"
|
||||
|
||||
server_on "$HOST1"
|
||||
client_on "$HOST1"
|
||||
|
||||
wait_for_containers "$HOST1" 60 nginx client
|
||||
|
||||
|
||||
@@ -11,11 +11,8 @@ weave_on "$HOST2" launch "$HOST1" "$HOST2"
|
||||
scope_on "$HOST1" launch
|
||||
scope_on "$HOST2" launch
|
||||
|
||||
weave_proxy_on "$HOST1" run -d --name nginx nginx
|
||||
weave_proxy_on "$HOST2" run -d --name client alpine /bin/sh -c "while true; do \
|
||||
wget http://nginx.weave.local:80/ -O - >/dev/null || true; \
|
||||
sleep 1; \
|
||||
done"
|
||||
server_on "$HOST1"
|
||||
client_on "$HOST2"
|
||||
|
||||
sleep 30 # need to allow the scopes to poll dns, resolve the other app ids, and send them reports
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ start_suite "Test long connections (procspy) between processes"
|
||||
|
||||
weave_on "$HOST1" launch
|
||||
scope_on "$HOST1" launch --probe.conntrack=false
|
||||
weave_proxy_on "$HOST1" run -d --name nginx nginx
|
||||
|
||||
server_on "$HOST1"
|
||||
weave_proxy_on "$HOST1" run -dti --name client alpine /bin/sh -c "while true; do \
|
||||
nc nginx.weave.local 80 || true; \
|
||||
sleep 1; \
|
||||
|
||||
@@ -11,7 +11,7 @@ weave_on "$HOST2" launch "$HOST1" "$HOST2"
|
||||
scope_on "$HOST1" launch --probe.conntrack=false
|
||||
scope_on "$HOST2" launch --probe.conntrack=false
|
||||
|
||||
weave_proxy_on "$HOST1" run -d --name nginx nginx
|
||||
server_on "$HOST1"
|
||||
weave_proxy_on "$HOST2" run -dti --name client alpine /bin/sh -c "while true; do \
|
||||
nc nginx.weave.local 80 || true; \
|
||||
sleep 1; \
|
||||
|
||||
@@ -35,6 +35,17 @@ weave_proxy_on() {
|
||||
DOCKER_PORT=12375 docker_on "$host" "$@"
|
||||
}
|
||||
|
||||
server_on() {
|
||||
weave_proxy_on "$1" run -d --name nginx 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; \
|
||||
done"
|
||||
}
|
||||
|
||||
scope_end_suite() {
|
||||
end_suite
|
||||
for host in $HOSTS; do
|
||||
|
||||
Reference in New Issue
Block a user