Skip to content

Commit

Permalink
Update e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
miry committed Sep 17, 2021
1 parent 642f12a commit 4f9c70a
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions bin/e2e
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,42 @@ echo "== Setup"
trap 'pkill -15 -f "dist/toxiproxy-server$"; pkill -15 -f "exe/endpoint$"' EXIT SIGINT SIGTERM

echo "=== Starting Web service"

go run testing/endpoint.go 2>&1 | sed -e 's/^/[web] /' &

echo "=== Starting Toxiproxy"

./dist/toxiproxy-server 2>&1 | sed -e 's/^/[toxiproxy] /' &

echo "=== Wait when service are available"

wait_for_url http://localhost:20002/test2
wait_for_url http://localhost:8474/version

echo "=== Test client to manipulate proxy"

./dist/toxiproxy-cli -h http://localhost:8474 create -l localhost:20000 -u localhost:20002 shopify_http
./dist/toxiproxy-cli list
./dist/toxiproxy-cli toggle shopify_http
./dist/toxiproxy-cli inspect shopify_http
./dist/toxiproxy-cli toggle shopify_http

echo -e "-----------------\n"

echo "== Benchmarking"

echo
echo "=== Without toxics"

go test -bench=. ./testing -v

echo -e "-----------------\n"

echo "=== Latency toxic downstream"

./dist/toxiproxy-cli toxic add --downstream --type latency --toxicName "latency_downstream" \
--attribute "latency=1000" --attribute="jitter=50" \
--toxicity 0.5 shopify_http
--toxicity 0.99 shopify_http
./dist/toxiproxy-cli inspect shopify_http

go test -bench=. ./testing -v
Expand All @@ -54,54 +62,61 @@ go test -bench=. ./testing -v
./dist/toxiproxy-cli inspect shopify_http

./dist/toxiproxy-cli toxic delete --toxicName "latency_downstream" shopify_http

echo -e "-----------------\n"

echo "=== Latency toxic upstream"

./dist/toxiproxy-cli toxic add --upstream --type latency --toxicName "latency_upstream" \
--attribute "latency=1000" --attribute "jitter=50" \
--toxicity 1 shopify_http
./dist/toxiproxy-cli inspect shopify_http

go test -bench=. ./testing -v

./dist/toxiproxy-cli toxic update --toxicName "latency_upstream" --attribute="jitter=20"
./dist/toxiproxy-cli toxic update --toxicName "latency_upstream" --attribute="jitter=20" \
--toxicity 0.3 shopify_http
./dist/toxiproxy-cli inspect shopify_http

./dist/toxiproxy-cli toxic delete --toxicName "latency_upstream" shopify_http

echo -e "-----------------\n"

echo "=== Bandwidth toxic"

./dist/toxiproxy-cli toxic add --type bandwidth --toxicName "bandwidth_kb_per_second" \
--attribute "rate=1" shopify_http
--attribute "rate=1" --toxicity 0.5 shopify_http
./dist/toxiproxy-cli toxic update --toxicName "bandwidth_kb_per_second" --attribute="rate=10" \
shopify_http
--toxicity 1.0 shopify_http

go test -bench=. ./testing -v

./dist/toxiproxy-cli toxic delete --toxicName "bandwidth_kb_per_second" shopify_http

echo -e "-----------------\n"

echo "=== Timeout toxic"

./dist/toxiproxy-cli toxic add --type timeout --toxicName "timeout_ms" \
--attribute "timeout=10" --toxicity 0.1 shopify_http

go test -bench=. ./testing -v --timeout 1m

./dist/toxiproxy-cli toxic delete --toxicName "timeout_ms" shopify_http

echo -e "-----------------\n"

echo "=== Slicer toxic"

./dist/toxiproxy-cli toxic add --type slicer --toxicName "slicer_us" \
--attribute "average_size=64" --attribute "size_variation=32" \
--attribute="delay=10" shopify_http
--attribute="delay=10" --toxicity 1.0 shopify_http
go test -bench=. ./testing -v
./dist/toxiproxy-cli toxic delete --toxicName "slicer_us" shopify_http

echo -e "-----------------\n"

echo "== Teardown"

./dist/toxiproxy-cli delete shopify_http

echo -e "=================\n"

echo "Succcess!"

0 comments on commit 4f9c70a

Please sign in to comment.