Skip to content

Commit

Permalink
Rename testing/ folder into test/e2e/
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Fedorov committed Jan 10, 2022
1 parent 1526b3f commit 471c6bc
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 45 deletions.
32 changes: 12 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,50 @@ name: Test

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
go: [ '1.17', '1.16', '1.15', '1.14' ]
go: ["1.17", "1.16", "1.15", "1.14"]
name: Go ${{ matrix.go }}
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Setup go
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
-
name: Tests
- name: Tests
run: make test

-
name: benchmarks
- name: benchmarks
run: make bench

build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

-
name: Setup go
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: 1.17

-
name: E2E tests
run: make e2e
- name: E2E tests
run: make test-e2e

-
name: Build
- name: Build
uses: goreleaser/goreleaser-action@5df302e5e9e4c66310a6b6493a8865b12c555af2
with:
distribution: goreleaser
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Verify git tag on release (#347, @miry)
* Fix MacOS 12 tests for go17 with -race flag (#351 @strech)
* Rename `testing/` and `bin/` folders (#354 @strech)

# [2.3.0] - 2021-12-23

Expand Down
50 changes: 25 additions & 25 deletions scripts/test-e2e
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
set -ueo pipefail

wait_for_url() {
echo "--- Waiting for HTTP connection available"
timeout -s TERM 30s bash -c \
'while [[ "$(curl -s -o /dev/null -L -w ''%{http_code}'' ${0})" != "200" ]];\
do echo "Waiting for ${0}" && sleep 2;\
done' ${1}
curl -s -I -X GET $1
echo "--- Waiting for HTTP connection available"
timeout -s TERM 30s bash -c \
'while [[ "$(curl -s -o /dev/null -L -w ''%{http_code}'' ${0})" != "200" ]]; do \
echo "Waiting for ${0}" && sleep 2; \
done' ${1}
curl -s -I -X GET $1
}

echo "== Setup"
Expand All @@ -18,7 +18,7 @@ trap 'pkill -15 -f "dist/toxiproxy-server$"; pkill -15 -f "exe/endpoint$"' EXIT

echo "=== Starting Web service"

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

echo "=== Starting Toxiproxy"

Expand All @@ -44,21 +44,21 @@ echo "== Benchmarking"
echo
echo "=== Without toxics"

go test -bench=. ./testing -v
go test -bench=. ./test/e2e -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.99 shopify_http
--attribute "latency=1000" --attribute="jitter=50" \
--toxicity 0.99 shopify_http
./dist/toxiproxy-cli inspect shopify_http

go test -bench=. ./testing -v
go test -bench=. ./test/e2e -v

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

./dist/toxiproxy-cli toxic delete --toxicName "latency_downstream" shopify_http
Expand All @@ -68,14 +68,14 @@ 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
--attribute "latency=1000" --attribute "jitter=50" \
--toxicity 1 shopify_http
./dist/toxiproxy-cli inspect shopify_http

go test -bench=. ./testing -v
go test -bench=. ./test/e2e -v

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

./dist/toxiproxy-cli toxic delete --toxicName "latency_upstream" shopify_http
Expand All @@ -85,11 +85,11 @@ echo -e "-----------------\n"
echo "=== Bandwidth toxic"

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

go test -bench=. ./testing -v
go test -bench=. ./test/e2e -v

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

Expand All @@ -98,26 +98,26 @@ echo -e "-----------------\n"
echo "=== Timeout toxic"

./dist/toxiproxy-cli toxic add --type timeout --toxicName "timeout_ms" \
--attribute "timeout=10" --toxicity 0.1 shopify_http
--attribute "timeout=10" --toxicity 0.1 shopify_http
./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" --toxicity 1.0 shopify_http
go test -bench=. ./testing -v
--attribute "average_size=64" --attribute "size_variation=32" \
--attribute="delay=10" --toxicity 1.0 shopify_http
go test -bench=. ./test/e2e -v
./dist/toxiproxy-cli toxic delete --toxicName "slicer_us" shopify_http

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

echo "=== Reset peer toxic"

./dist/toxiproxy-cli toxic add --type reset_peer --toxicName "reset_peer" \
--attribute "timeout=2000" \
--toxicity 1.0 shopify_http
--attribute "timeout=2000" \
--toxicity 1.0 shopify_http
./dist/toxiproxy-cli inspect shopify_http
./dist/toxiproxy-cli toxic delete --toxicName "reset_peer" shopify_http

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 471c6bc

Please sign in to comment.