Skip to content

Commit

Permalink
functional-tester: update README with proxy
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Jan 2, 2018
1 parent 6e1e650 commit 2e370f0
Showing 1 changed file with 151 additions and 25 deletions.
176 changes: 151 additions & 25 deletions tools/functional-tester/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,168 @@ The environment of the cluster must be stable enough, so etcd test suite can ass

## etcd agent

etcd agent is a daemon on each machines. It can start, stop, restart, isolate and terminate an etcd process. The agent exposes these functionality via HTTP RPC.
etcd agent is a daemon on each machines. It can start, stop, restart, isolate and terminate an etcd process. The agent exposes these functionality via HTTP RPC.

## etcd tester

etcd functional tester control the progress of the functional tests. It calls the RPC of the etcd agent to simulate various test cases. For example, it can start a three members cluster by sending three start RPC calls to three different etcd agents. It can make one of the member failed by sending stop RPC call to one etcd agent.

## with Docker (optionally)
### Run locally

To run the functional tests using Docker, the provided script can be used to set up an environment using Docker Compose.

Script (on linux):
```sh
./tools/functional-tester/test
```
$ PASSES=functional ./test
```

Running the script requires:

- Docker 1.9+ (with networking support) - to create isolated network
- docker-compose - to create etcd cluster and tester
- A multi-arch Go toolchain (OSX)

Notes:
- Docker image is based on Alpine Linux OS running in privileged mode to allow iptables manipulation.
- To specify testing parameters (etcd-tester arguments) modify tools/functional-tester/docker/docker-compose.yml or start etcd-tester manually
- (OSX) make sure that etcd binary is built for linux/amd64 (eg. `rm bin/etcd;GOOS=linux GOARCH=amd64 ./tools/functional-tester/test`) otherwise it will return `exec format error`
### Run with Docker

Run locally

## with Goreman
```bash
$ GO_VERSION=1.9.2 make build-docker-functional-tester -f ./hack/scripts-dev/Makefile
```

To run the functional tests on a single machine using Goreman, build with the provided build script and run with the provided Procfile:
Or

```bash
$ rm -rf `pwd`/agent-1 && mkdir -p `pwd`/agent-1 && docker run \
--rm \
--net=host \
--name agent-1 \
--mount type=bind,source=`pwd`/agent-1,destination=/agent-1 \
gcr.io/etcd-development/etcd-functional-tester:go1.9.2 \
/bin/bash -c "/etcd-agent \
--etcd-path /etcd \
--etcd-log-dir /agent-1 \
--port :19027 \
--failpoint-addr :7381"

$ rm -rf `pwd`/agent-2 && mkdir -p `pwd`/agent-2 && docker run \
--rm \
--net=host \
--name agent-2 \
--mount type=bind,source=`pwd`/agent-2,destination=/agent-2 \
gcr.io/etcd-development/etcd-functional-tester:go1.9.2 \
/bin/bash -c "/etcd-agent \
--etcd-path /etcd \
--etcd-log-dir /agent-2 \
--port :29027 \
--failpoint-addr :7382"

$ rm -rf `pwd`/agent-3 && mkdir -p `pwd`/agent-3 && docker run \
--rm \
--net=host \
--name agent-3 \
--mount type=bind,source=`pwd`/agent-3,destination=/agent-3 \
gcr.io/etcd-development/etcd-functional-tester:go1.9.2 \
/bin/bash -c "/etcd-agent \
--etcd-path /etcd \
--etcd-log-dir /agent-3 \
--port :39027 \
--failpoint-addr :7383"
```

```sh
./tools/functional-tester/build
goreman -f tools/functional-tester/Procfile start
```bash
$ docker run \
--rm \
--net=host \
--name tester \
gcr.io/etcd-development/etcd-functional-tester:go1.9.2 \
/bin/bash -c "/etcd-tester \
--agent-endpoints '127.0.0.1:19027,127.0.0.1:29027,127.0.0.1:39027' \
--client-ports 1379,2379,3379 \
--advertise-client-ports 13790,23790,33790 \
--peer-ports 1380,2380,3380 \
--advertise-peer-ports 13800,23800,33800 \
--stress-qps=2500 \
--exit-on-failure"

# to limit test cases
$ docker run \
--rm \
--net=host \
--name tester \
gcr.io/etcd-development/etcd-functional-tester:go1.9.2 \
/bin/bash -c "/etcd-tester \
--agent-endpoints '127.0.0.1:19027,127.0.0.1:29027,127.0.0.1:39027' \
--client-ports 1379,2379,3379 \
--advertise-client-ports 13790,23790,33790 \
--peer-ports 1380,2380,3380 \
--advertise-peer-ports 13800,23800,33800 \
--limit 1 \
--schedule-cases '0 1 2 3 4 5 6 7 8 9' \
--stress-qps=2500 \
--exit-on-failure"

# to run with etcd-runner
$ docker run \
--rm \
--net=host \
--name tester \
gcr.io/etcd-development/etcd-functional-tester:go1.9.2 \
/bin/bash -c "/etcd-tester \
--agent-endpoints '127.0.0.1:19027,127.0.0.1:29027,127.0.0.1:39027' \
--client-ports 1379,2379,3379 \
--advertise-client-ports 13790,23790,33790 \
--peer-ports 1380,2380,3380 \
--advertise-peer-ports 13800,23800,33800 \
--limit 1 \
--schedule-cases '0 1 2 3 4 5 6 7 8 9' \
--stress-qps=2500 \
--etcd-runner /etcd-runner \
--stresser=keys,lease,election-runner,watch-runner,lock-racer-runner,lease-runner \
--exit-on-failure"
```

Notes:
- The etcd-agent will not run with root privileges; iptables manipulation is disabled.
- To specify testing parameters (etcd-tester arguments) modify tools/functional-tester/Procfile or start etcd-tester manually
Run with fail points

```bash
$ rm -rf `pwd`/agent-1 && mkdir -p `pwd`/agent-1 && docker run \
--rm \
--net=host \
--name agent-1 \
--mount type=bind,source=`pwd`/agent-1,destination=/agent-1 \
gcr.io/etcd-development/etcd-functional-tester:go1.9.2 \
/bin/bash -c "/etcd-agent \
--etcd-path /etcd-failpoints \
--etcd-log-dir /agent-1 \
--port :19027 \
--failpoint-addr :7381"

$ rm -rf `pwd`/agent-2 && mkdir -p `pwd`/agent-2 && docker run \
--rm \
--net=host \
--name agent-2 \
--mount type=bind,source=`pwd`/agent-2,destination=/agent-2 \
gcr.io/etcd-development/etcd-functional-tester:go1.9.2 \
/bin/bash -c "/etcd-agent \
--etcd-path /etcd-failpoints \
--etcd-log-dir /agent-2 \
--port :29027 \
--failpoint-addr :7382"

$ rm -rf `pwd`/agent-3 && mkdir -p `pwd`/agent-3 && docker run \
--rm \
--net=host \
--name agent-3 \
--mount type=bind,source=`pwd`/agent-3,destination=/agent-3 \
gcr.io/etcd-development/etcd-functional-tester:go1.9.2 \
/bin/bash -c "/etcd-agent \
--etcd-path /etcd-failpoints \
--etcd-log-dir /agent-3 \
--port :39027 \
--failpoint-addr :7383"

$ docker run \
--rm \
--net=host \
--name tester \
gcr.io/etcd-development/etcd-functional-tester:go1.9.2 \
/bin/bash -c "/etcd-tester \
--agent-endpoints '127.0.0.1:19027,127.0.0.1:29027,127.0.0.1:39027' \
--client-ports 1379,2379,3379 \
--advertise-client-ports 13790,23790,33790 \
--peer-ports 1380,2380,3380 \
--advertise-peer-ports 13800,23800,33800 \
--stress-qps=2500 \
--exit-on-failure"
```

0 comments on commit 2e370f0

Please sign in to comment.