Skip to content

Commit

Permalink
Rename bin/ and testing/ folders (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
Strech authored Jan 10, 2022
1 parent c2863c1 commit 06aafdc
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 51 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# [Unreleased]

* Verify git tag on release (#347, @miry)
* Fix MacOS 12 tests for go17 with -race flag (#351 @strech)
* 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
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ test:
# NOTE: https://github.com/golang/go/issues/49138
$(MALLOC_ENV) go test -v -race -timeout 1m ./...

.PHONY: test-e2e
test-e2e: build
scripts/test-e2e

.PHONY: test-release
test-release: test bench test-e2e release-dry
scripts/test-release

.PHONY: bench
bench:
# TODO: Investigate why benchmarks require more sockets: ulimit -n 10240
Expand All @@ -28,10 +36,6 @@ fmt:
lint:
golangci-lint run

.PHONY: e2e
e2e: build
bin/e2e

.PHONY: build
build: dist clean
go build -ldflags="-s -w" -o ./dist/toxiproxy-server ./cmd/server
Expand All @@ -45,10 +49,6 @@ release:
release-dry:
goreleaser release --rm-dist --skip-publish --skip-validate

.PHONY: release-test
release-test: test bench e2e release-dry
bin/release_test

.PHONY: setup
setup:
go mod download
Expand Down
44 changes: 22 additions & 22 deletions bin/e2e → scripts/test-e2e
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ 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}
'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
}

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.
File renamed without changes.

0 comments on commit 06aafdc

Please sign in to comment.