mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tools/functional-tester: update README for local docker testing
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
cf96d8a130
commit
c932e9e2ba
@ -10,42 +10,38 @@ 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:
|
||||
### Run with Docker
|
||||
|
||||
- Docker 1.9+ (with networking support) - to create isolated network
|
||||
- docker-compose - to create etcd cluster and tester
|
||||
- A multi-arch Go toolchain (OSX)
|
||||
To run locally, first build tester image:
|
||||
|
||||
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`
|
||||
```bash
|
||||
pushd ../..
|
||||
|
||||
GO_VERSION=1.9.3 \
|
||||
make build-docker-functional-tester \
|
||||
-f ./hack/scripts-dev/Makefile
|
||||
|
||||
## with Goreman
|
||||
|
||||
To run the functional tests on a single machine using Goreman, build with the provided build script and run with the provided Procfile:
|
||||
|
||||
```sh
|
||||
./tools/functional-tester/build
|
||||
goreman -f tools/functional-tester/Procfile start
|
||||
popd
|
||||
```
|
||||
|
||||
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
|
||||
And run [example scripts](./scripts).
|
||||
|
||||
```bash
|
||||
./scripts/agent-1.sh
|
||||
./scripts/agent-2.sh
|
||||
./scripts/agent-3.sh
|
||||
|
||||
./scripts/tester-limit.sh
|
||||
```
|
||||
|
37
tools/functional-tester/scripts/agent-1.sh
Executable file
37
tools/functional-tester/scripts/agent-1.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
<<COMMENT
|
||||
# to run agent
|
||||
./scripts/agent-1.sh
|
||||
|
||||
# to run with failpoints
|
||||
ETCD_EXEC_PATH=/etcd-failpoints ./scripts/agent-1.sh
|
||||
COMMENT
|
||||
|
||||
if ! [[ "$0" =~ "scripts/agent-1.sh" ]]; then
|
||||
echo "must be run from tools/functional-tester"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ -z "${ETCD_EXEC_PATH}" ]; then
|
||||
ETCD_EXEC_PATH=/etcd
|
||||
echo "Running agent without failpoints:" ${ETCD_EXEC_PATH}
|
||||
elif [[ "${ETCD_EXEC_PATH}" == "/etcd-failpoints" ]]; then
|
||||
echo "Running agent with failpoints:" ${ETCD_EXEC_PATH}
|
||||
else
|
||||
echo "Cannot find executable:" ${ETCD_EXEC_PATH}
|
||||
exit 255
|
||||
fi
|
||||
|
||||
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.3 \
|
||||
/bin/bash -c "/etcd-agent \
|
||||
--etcd-path ${ETCD_EXEC_PATH} \
|
||||
--etcd-log-dir /agent-1 \
|
||||
--port :19027 \
|
||||
--failpoint-addr :7381"
|
37
tools/functional-tester/scripts/agent-2.sh
Executable file
37
tools/functional-tester/scripts/agent-2.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
<<COMMENT
|
||||
# to run agent
|
||||
./scripts/agent-2.sh
|
||||
|
||||
# to run with failpoints
|
||||
ETCD_EXEC_PATH=/etcd-failpoints ./scripts/agent-2.sh
|
||||
COMMENT
|
||||
|
||||
if ! [[ "$0" =~ "scripts/agent-2.sh" ]]; then
|
||||
echo "must be run from tools/functional-tester"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ -z "${ETCD_EXEC_PATH}" ]; then
|
||||
ETCD_EXEC_PATH=/etcd
|
||||
echo "Running agent without failpoints:" ${ETCD_EXEC_PATH}
|
||||
elif [[ "${ETCD_EXEC_PATH}" == "/etcd-failpoints" ]]; then
|
||||
echo "Running agent with failpoints:" ${ETCD_EXEC_PATH}
|
||||
else
|
||||
echo "Cannot find executable:" ${ETCD_EXEC_PATH}
|
||||
exit 255
|
||||
fi
|
||||
|
||||
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.3 \
|
||||
/bin/bash -c "/etcd-agent \
|
||||
--etcd-path ${ETCD_EXEC_PATH} \
|
||||
--etcd-log-dir /agent-2 \
|
||||
--port :29027 \
|
||||
--failpoint-addr :7382"
|
37
tools/functional-tester/scripts/agent-3.sh
Executable file
37
tools/functional-tester/scripts/agent-3.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
<<COMMENT
|
||||
# to run agent
|
||||
./scripts/agent-3.sh
|
||||
|
||||
# to run with failpoints
|
||||
ETCD_EXEC_PATH=/etcd-failpoints ./scripts/agent-3.sh
|
||||
COMMENT
|
||||
|
||||
if ! [[ "$0" =~ "scripts/agent-3.sh" ]]; then
|
||||
echo "must be run from tools/functional-tester"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [ -z "${ETCD_EXEC_PATH}" ]; then
|
||||
ETCD_EXEC_PATH=/etcd
|
||||
echo "Running agent without failpoints:" ${ETCD_EXEC_PATH}
|
||||
elif [[ "${ETCD_EXEC_PATH}" == "/etcd-failpoints" ]]; then
|
||||
echo "Running agent with failpoints:" ${ETCD_EXEC_PATH}
|
||||
else
|
||||
echo "Cannot find executable:" ${ETCD_EXEC_PATH}
|
||||
exit 255
|
||||
fi
|
||||
|
||||
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.3 \
|
||||
/bin/bash -c "/etcd-agent \
|
||||
--etcd-path ${ETCD_EXEC_PATH} \
|
||||
--etcd-log-dir /agent-3 \
|
||||
--port :39027 \
|
||||
--failpoint-addr :7383"
|
24
tools/functional-tester/scripts/tester-limit.sh
Executable file
24
tools/functional-tester/scripts/tester-limit.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if ! [[ "$0" =~ "scripts/tester-limit.sh" ]]; then
|
||||
echo "must be run from tools/functional-tester"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# to run only 1 test round
|
||||
docker run \
|
||||
--rm \
|
||||
--net=host \
|
||||
--name tester \
|
||||
gcr.io/etcd-development/etcd-functional-tester:go1.9.3 \
|
||||
/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 \
|
||||
--stress-qps=2500 \
|
||||
--stress-key-txn-count 100 \
|
||||
--stress-key-txn-ops 10 \
|
||||
--exit-on-failure"
|
25
tools/functional-tester/scripts/tester-runner.sh
Executable file
25
tools/functional-tester/scripts/tester-runner.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if ! [[ "$0" =~ "scripts/tester-runner.sh" ]]; then
|
||||
echo "must be run from tools/functional-tester"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# to run with etcd-runner
|
||||
docker run \
|
||||
--rm \
|
||||
--net=host \
|
||||
--name tester \
|
||||
gcr.io/etcd-development/etcd-functional-tester:go1.9.3 \
|
||||
/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 \
|
||||
--stress-key-txn-count 100 \
|
||||
--stress-key-txn-ops 10 \
|
||||
--etcd-runner /etcd-runner \
|
||||
--stresser=keys,lease,election-runner,watch-runner,lock-racer-runner,lease-runner \
|
||||
--exit-on-failure"
|
22
tools/functional-tester/scripts/tester.sh
Executable file
22
tools/functional-tester/scripts/tester.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if ! [[ "$0" =~ "scripts/tester.sh" ]]; then
|
||||
echo "must be run from tools/functional-tester"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
docker run \
|
||||
--rm \
|
||||
--net=host \
|
||||
--name tester \
|
||||
gcr.io/etcd-development/etcd-functional-tester:go1.9.3 \
|
||||
/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 \
|
||||
--stress-key-txn-count 100 \
|
||||
--stress-key-txn-ops 10 \
|
||||
--exit-on-failure"
|
Loading…
x
Reference in New Issue
Block a user