Skip to content

Commit c70eb52

Browse files
committed
add documentation
Signed-off-by: Andres Taylor <[email protected]>
1 parent a6e0938 commit c70eb52

File tree

3 files changed

+64
-11
lines changed

3 files changed

+64
-11
lines changed

README.md

+17-11
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ This method allows us to thoroughly test queries within a sharded environment, e
2929

3030
## How to use
3131

32-
Build the `vitess-tester` binary:
32+
After installing the `vitess-tester` binary, you need to have Vitess installed and in your path.
33+
To run vitess, you'll need to set VTDATAROOT and VTROOT environment variables.
34+
You can do this, and set up the Vitess environment by running the following command:
35+
3336
```sh
34-
make
37+
source build.env
3538
```
3639

3740
Basic usage:
@@ -68,32 +71,35 @@ Usage of ./vitess-tester:
6871
-perf-test
6972
include end-to-end performance tests
7073
-sharded
71-
run all tests on a sharded keyspace
74+
Run all tests on a sharded keyspace and using auto-vschema. This cannot be used with either -vschema or -vtexplain-vschema.
7275
-stderrthreshold value
7376
logs at or above this threshold go to stderr (default 2)
74-
-test-dir string
75-
Directory for the test files (default "./t/")
7677
-topo-flavor string
7778
choose a topo server from etcd2, zk2 or consul (default "etcd2")
7879
-v value
7980
log level for V logs
8081
-vmodule value
8182
comma-separated list of pattern=N settings for file-filtered logging
8283
-vschema string
83-
Disable auto-vschema by providing your own vschema file
84+
Disable auto-vschema by providing your own vschema file. This cannot be used with either -vtexplain-vschema or -sharded.
85+
-vtexplain-vschema string
86+
Disable auto-vschema by providing your own vtexplain vschema file. This cannot be used with either -vschema or -sharded.
8487
-xunit
8588
Get output in an xml file instead of errors directory
8689
```
8790

88-
It will bring up an entire Vitess cluster on 127.0.0.1, unsharded or sharded depending on the `-sharded` flag. MySQL and VTGate both start with root and no password configured.
91+
It will bring up an entire Vitess cluster on 127.0.0.1, unsharded or sharded depending on the configuration. MySQL and VTGate both start with root and no password configured.
8992

9093
```sh
91-
./vitess-tester t/example.test # run a specified test
92-
./vitess-tester t/example1.test t/example2.test t/example3.test # separate different tests with one or more spaces
93-
./vitess-tester t/*.test # wildcards can be used
94-
./vitess-tester https://raw.githubusercontent.com/vitessio/vitess-tester/main/t/basic.test # can also be run against an URL
94+
vitess-tester t/example.test # run a specified test
95+
vitess-tester t/example1.test t/example2.test t/example3.test # separate different tests with one or more spaces
96+
vitess-tester t/*.test # wildcards can be used
97+
vitess-tester https://raw.githubusercontent.com/vitessio/vitess-tester/main/t/basic.test # can also be run against an URL
98+
vitess-tester -vtexplain-vschema t/vtexplain-vschema.json t/vtexplain.test # run a test with a custom vschema
9599
```
96100

101+
The test files can be amended with directives to control the testing process. Check out `directives.test` to see examples of what directives are available.
102+
97103
## Contributing
98104

99105
Contributions are welcomed and greatly appreciated. You can help by:

build.env

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# No shebang line as this script is sourced from an external shell.
2+
3+
# Copyright 2019 The Vitess Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
source ./tools/shell_functions.inc
18+
19+
export VTROOT="$PWD"
20+
export VTDATAROOT="${VTDATAROOT:-${VTROOT}/vtdataroot}"
21+
export PROTOC_VER=21.3
22+
export ZK_VER=${ZK_VERSION:-3.8.0}
23+
export ETCD_VER=v3.5.6
24+
export CONSUL_VER=1.11.4
25+
export TOXIPROXY_VER=v2.7.0
26+
27+
mkdir -p "$VTDATAROOT"

t/directives.test

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# vitess-tester, just like mysql-tester, uses `--<directive>` in the .test files to do things outside the regular script
2+
# --skip <comment> allows you to skip a test with a comment
3+
--skip "This test is not ready yet"
4+
select * from table_doesnt_exist;
5+
6+
# skip_if_below_version <binary> <version> allows you to skip a query if the binary version is below the specified version
7+
--skip_if_below_version vtgate 999.0
8+
select * from table_doesnt_exist;
9+
10+
# --error allows to assert that a query fails with an error
11+
--error the following query should fail
12+
select * from table_doesnt_exist;
13+
14+
# --vexplain <mode> allows to run a query with vexplain to see the plan or which queries are sent to mysql. Mode can be `plan` or `queries`
15+
--vexplain plan
16+
select 1;
17+
18+
# --wait_authoritative <table> <keyspace> allows to wait until the vtgate has authoritative information about the table
19+
# This is useful when you provide your own vschema and want it amended by the schema tracker
20+
--wait_authoritative table_doesnt_exist keyspace_doesnt_exist

0 commit comments

Comments
 (0)