From 2e370f015291cdc8acf2c25b69cd06bf50aa4c5e Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Tue, 2 Jan 2018 09:01:23 -0800 Subject: [PATCH] functional-tester: update README with proxy Signed-off-by: Gyuho Lee --- tools/functional-tester/README.md | 176 +++++++++++++++++++++++++----- 1 file changed, 151 insertions(+), 25 deletions(-) diff --git a/tools/functional-tester/README.md b/tools/functional-tester/README.md index 78e9b26b3909..daf7e00dcba9 100644 --- a/tools/functional-tester/README.md +++ b/tools/functional-tester/README.md @@ -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" +```