Skip to content

Rebased against master - #1

Open
miry wants to merge 60 commits into
chaosbox:RFC-reset-conn-toxicfrom
miry:RFC-reset-conn-toxic
Open

miry wants to merge 60 commits into
chaosbox:RFC-reset-conn-toxicfrom
miry:RFC-reset-conn-toxic

Conversation

@miry

@miry miry commented Oct 16, 2021

Copy link
Copy Markdown

No description provided.

nothinux and others added 30 commits May 20, 2019 16:20
Add example config.json file to README.md
I've developed a full-fledged elixir client for Toxiproxy that is highly inspired by the ruby version.
It's called `ToxiproxyEx` but I think we can link it as `toxiproxy-elixir` to make it clear that it is an elixir client.
- move to github.com/urface/cli/v2 API
- refresh all dependencies to @latest
- golang.org/x/crypto/ssh/terminal moved to golang.org/x/term
- deprecated functions
- copylocks on range
- t.Fatal in non-test goroutines
- use bytes.Equal
- #nosec for math/crypto
Upgrade bundler to protect your service
Fixing dev.yml to allow running 'dev up'
Use latest versions of the programming languages.
Generate binaries and archives with [goreleaser](https://github.com/goreleaser/goreleaser).
Build locally docker images and docker manifest for cross platforms.
Remove dependencies to ruby.
Run tests on each commit in master and pull requests with Github Actions.
Remove Travis config file.
Build binaries for Solaris.
The binaries names: `toxiproxy-client-solaris-amd64`, `toxiproxy-server-solaris-amd64`
The current process according the README is manual.
It requires to have access users to DockerHub.

After small investigation, found that DockerHub is not actively
internaly used and decided to switch container registry to Github.

The relase part was done with [goreleaser](https://github.com/goreleaser/goreleaser).
It can create Release in Github, Container registries and Homebrew.

Update documentation to use Github container registry for new versions.
miry and others added 24 commits September 8, 2021 10:57
Add script to run e2e tests to test client and server.
Use benchmark script as sample client application.
Automate the process with Github Actions in test workflow.
Since Shopify#253 added a `go.mod` for
toxiproxy, the v2.x.x release from v2.1.5 can no longer be referred to
as an `+incompatible` module dependency and is required to have a `/v2`
suffix on the module path.

```
server response: not found: github.com/Shopify/toxiproxy@v2.1.5+incompatible:
  invalid version: +incompatible suffix not allowed:
    module contains a go.mod file, so semantic import versioning is required
```
(see [Go Modules have a v2+ Problem](https://donatstudios.com/Go-v2-Modules) for further discussion)

Fixes Shopify#310
Forgot to mention during PR review to update the `CHANGELOG.md`.
Run CodeQL on Pull Requests, master changes and scheduled.
Specify dependabot config for go modules and github actions.
Bumps [docker/login-action](https://github.com/docker/login-action) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@28218f9...f054a8b)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Setup a very basic linting tool [golangci-lint](https://golangci-lint.run/).
Disable all linters as the goal of this changes setup automation.
The code required be formatted and will be enabled one by one.
Add linter `lll` to golangci-lint to check the max line length.

Use https://github.com/segmentio/golines to format most of files.
Add linter to check that code closes the http body.
Add a check to Github actions to run bench tests.
Update Makefile to run benchmark tests.
…or the host flag (Shopify#319)

* Read TOXIPROXY_URL as EnvVars

* Update CHANGELOG.md on `TOXIPROXY_URL`
Extract common part in test to initialize the test upstream server.
* Tune proxy.go to has small functions

* Extract proxy accept function

* Revert changes in proxy accept
Update the `bin/e2e` to cover flags like `host` and `toxicity`.
Make sure the main function in client is not overwhelming,
extract portion of lines to separate methods for better read.

Found that client in `toxic add` supports both: `--upstream` and
`--downstream`. Because it tries to create 2 toxics with same name it
produces the error when tries add `--downstream` toxic, and in same time
creates the `--upstream` toxic.

To remove confusion update the client usage help to support only one in
same time. Return error message in case 2 flags provided.

Introduce a new way to add toxics with client: 
Provide a structure`ToxicOptions` with all required options and pass to `client.AddToxic`, `client.UpdateToxic` and `client.RemoveToxic`
Enable linter funlen to limit the function length
and the number of the statements.
Use scratch docker base image.
Update document how to use docker server and clients.
Base on some examples picked few more linters.
Modify code to resolve the broken checks.
Before the marking the release it is usefull
to test if docker image is working correctly.
Use goreleaser to test how it builds the image
and run tests with commands:

```shell
$ docker run --name toxiproxy-server -d --net=host -it ghcr.io/shopify/toxiproxy:2.1.6-next-amd64
$ docker run --entrypoint=/toxiproxy-cli --rm --net=host -it ghcr.io/shopify/toxiproxy:2.1.6-next-amd64 list
$ docker run --entrypoint=/toxiproxy-cli --rm --net=host -it ghcr.io/shopify/toxiproxy:2.1.6-next-amd64 create -l localhost:3000 -u localhost:80 local
$ docker run --entrypoint=/toxiproxy-cli --rm --net=host -it ghcr.io/shopify/toxiproxy:2.1.6-next-amd64 list
$ docker stop toxiproxy-server
$ docker rm toxiproxy-server
```
There is a missing spot during upgrade the modules to `/v2` - goreleaser config.

The latest build 2.1.6 returns `git` as version:

```shell
$ toxiproxy-cli --version
toxiproxy-cli version git
```

Add validation with `make release-dry` to check that the tags are correctly set.
Closes Shopify#330

Linux packages installs binaries to `/usr/local/bin`
and has names:

```
toxiproxy-server-linux-amd64
toxiproxy-cli-linux-amd64
```

It is not common way and different from previous releases.

Changes the binary destination path to `/usr/bin` and has short binary
names:

```
toxiproxy-server
toxiproxy-cli
```
@miry
miry force-pushed the RFC-reset-conn-toxic branch from 2cf69f4 to e2c0a08 Compare October 16, 2021 11:47
@miry
miry force-pushed the RFC-reset-conn-toxic branch 2 times, most recently from 77e0041 to 44f995f Compare October 17, 2021 16:04
Update documentation to mention about reset_peer toxic.
Add e2e smoke tests to check format of reset_peer toxic.
Client show the toxic in the help usage output.

Example of usage:

```shell
$ toxiproxy-cli -h http://localhost:8474 create -l localhost:20000 -u localhost:20002 http
$ toxiproxy-cli toxic add --type reset_peer --toxicName "reset_peer" \
                       --attribute "timeout=2000" \
                       --toxicity 1.0 http
$ time curl 127.0.0.1:20000
curl: (56) Recv failure: Connection reset by peer
curl 127.0.0.1:20000  0.00s user 0.00s system 0% cpu 2.010 total
```
@miry
miry force-pushed the RFC-reset-conn-toxic branch from 44f995f to 7a12b12 Compare October 17, 2021 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.