vitess-gh/go/test/endtoend
Rohit Nayak 86e0cf822b
Partial Movetables: allow moving a table one shard at a time (#9987)
* Initial Implementation of partial movetables.  Implement cross-shard queries that obey shard routing rules.

Refactor rss updation with routed shard and add to multi col resolution. Run vtgate and reservedconn tests for both regular and with a partially moved shard.

Add ability to run tests with partial keyspaces by adding to a list in the CI generator. Implement that in test.go and cluster setup. Revert previous iteration of running partial keyspace tests in parallel. One test is failing: TestSetSystemVarAutocommitWithConnError.

Add partial vtgate misc test

Add partial keyspace tests to vtgate transaction

Add vtgate queries partial keyspace tests

Review and fix skipped tests where applicable. Refactor to allow conditional skipping of tests for partial keyspaces only so that other tests work exactly as earlier without specifying the DbName, for example

Add move shards example

Cache routing tables and minor refactor. Move move_shards example

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Add lookup index to move shards example. Comment error logs while trying to delete from missing _vt.vdiff table

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Remove move shards demo example

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Add vtgate flag to enable shard routing. Update tests to get vtparams based on partial keyspace setting, so that global routing continues to be tested as earlier without DbName being specified

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

To create subsequent partial movetables workflows we should ignore previous partial movetables (now frozen)

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Remove vdiff2 deletes since they were failing unit tests etc

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Use vtgate flag to enable shard routing rules

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Fix incorrect test setup

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Expect modified frozen query

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

set vtgate param --enable_shard_routing in partial movetables test

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Fix failing tests

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Fix flags test

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Use VTParams helper for partial keyspace tests

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Specify vtParams.DBName for partial keyspace queries

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Self-review. Remove bypass caching.

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Report partial SwitchTraffic results

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Try to address most of the upstream PR review comments

From: https://github.com/vitessio/vitess/pull/9987

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Enforce proper routing for partial migrations

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Minor changes after self review

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Account for local timezone in check for vdiff progress

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Update go version in workflows. Fix gofmt issue

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Fix failing CI tests

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Comment failing test for partial keyspaces

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Fix TestVtGateVtExplain by specifying dbname

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Fix leftover debug code

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Move partial keyspace tests to a single shard. Refactor test.go to use multiple config.json files

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Improve test skip comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* gofmt

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Fix failing tests

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Try TestFunctionInDefault for partial keyspaces. Update skip comment.

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Delete temporary log lines

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Co-authored-by: Matt Lord <mattalord@gmail.com>
2022-09-23 12:15:12 +02:00
..
backup Adding tablet startup check (#11251) 2022-09-20 16:22:26 -07:00
cellalias [vtctl] Delete query commands (#10646) 2022-07-25 15:10:17 -04:00
cluster Partial Movetables: allow moving a table one shard at a time (#9987) 2022-09-23 12:15:12 +02:00
clustertest Run latest gofmt on everything & address linter warnings (#11008) 2022-08-16 13:53:42 -07:00
docker Run latest gofmt on everything & address linter warnings (#11008) 2022-08-16 13:53:42 -07:00
encryption Replace OpenSSL usage for test certificates with Go crypto 2022-03-29 14:27:29 +02:00
keyspace Delete all legacy sharding related code (#10278) 2022-07-07 13:52:32 -04:00
messaging messaging: support vt_message_cols to limit cols 2022-05-30 16:21:33 -06:00
migration Run latest gofmt on everything & address linter warnings (#11008) 2022-08-16 13:53:42 -07:00
mysqlctl test: make more tests use InitShardPrimary 2021-12-10 17:57:04 +05:30
mysqlctld test: make more tests use InitShardPrimary 2021-12-10 17:57:04 +05:30
mysqlserver [VEP-4, phase 1] Flag Deprecation Warnings (#9733) 2022-03-08 14:27:31 -08:00
onlineddl Online DDL: --pospone-launch, ALTER VITESS_MIGRATION ... LAUNCH (#10915) 2022-09-18 11:07:42 +03:00
preparestmt Remove the `Gateway` interface (#9852) 2022-03-31 16:12:36 +02:00
recovery Deprecate enable-semi-sync in favour of RPC parameter (#10695) 2022-07-22 21:35:15 +05:30
reparent FlakinessFix: Reparent tests by removing `restore_from_backup` (#11064) 2022-08-23 16:50:26 +05:30
schemadiff/vrepl Online DDL: support multiple 'ADD FULLTEXT KEY' in single ALTER (#11013) 2022-08-16 16:12:52 +03:00
sharded [endtoend/{sharded,sharding}] update flags and imports (#9913) 2022-03-21 15:48:03 -04:00
stress revert not required changes 2021-11-10 19:32:23 +01:00
tabletgateway decouple olap tx timeout from oltp tx timeout (#10946) 2022-09-07 22:37:27 +05:30
tabletmanager Replication Manager Improvements (#11194) 2022-09-12 15:06:26 +05:30
topoconncache Expect SERVING status for tablets added to shard with a PRIMARY (#11007) 2022-08-12 13:49:01 -07:00
topotest all: gofmt -w -r 'interface{} -> any' src 2022-03-22 09:39:55 +01:00
utils Upgrade vtgate CI jobs to 20.04 (#11118) 2022-08-30 17:40:53 +02:00
vault Run latest gofmt on everything & address linter warnings (#11008) 2022-08-16 13:53:42 -07:00
versionupgrade Remove the `Gateway` interface (#9852) 2022-03-31 16:12:36 +02:00
vreplication Partial Movetables: allow moving a table one shard at a time (#9987) 2022-09-23 12:15:12 +02:00
vtcombo fix: change planner_version to planner-version everywhere (#10453) 2022-06-08 11:15:57 +02:00
vtctldweb Run latest gofmt on everything & address linter warnings (#11008) 2022-08-16 13:53:42 -07:00
vtgate Partial Movetables: allow moving a table one shard at a time (#9987) 2022-09-23 12:15:12 +02:00
vtgr Various mods for replacing MASTER with PRIMARY 2021-08-06 15:32:30 +02:00
vtorc Refactor: Rename Orchestrator to VTOrc in the codebase (#11231) 2022-09-18 14:37:31 +05:30
README.md Various mods for replacing MASTER with PRIMARY 2021-08-06 15:32:30 +02:00

README.md

This document describe the testing strategy we use for all Vitess components, and the progression in scope / complexity.

As Vitess developers, our goal is to have great end to end test coverage. In the past, these tests were mostly written in python 2.7 is coming to end of life we are moving all of those into GO.

End to End Tests

These tests are meant to test end-to-end behaviors of the Vitess ecosystem, and complement the unit tests. For instance, we test each RPC interaction independently (client to vtgate, vtgate to vttablet, vttablet to MySQL, see previous sections). But is also good to have an end-to-end test that validates everything works together.

These tests almost always launch a topology service, a few mysqld instances, a few vttablets, a vtctld process, a few vtgates, ... They use the real production processes, and real replication. This setup is mandatory for properly testing re-sharding, cluster operations, ... They all however run on the same machine, so they might be limited by the environment.

Strategy

All the end to end test are placed under path go/test/endtoend. The main purpose of grouping them together is to make sure we have single place for reference and to combine similar test to run them in the same cluster and save test running time.

Setup

All the tests should be launching a real cluster just like the production setup and execute the tests on that setup followed by a teardown of all the services.

The cluster launch functions are provided under go/test/endtoend/cluster. This is still work in progress so feel free to add new function as required or update the existing ones.

In general the cluster is build in following order

  • Define Keyspace
  • Define Shards
  • Start topology service [default etcd]
  • Start vtctld client
  • Start required mysqld instances
  • Start corresponding vttablets (atleast 1 primary and 1 replica)
  • Start Vtgate

A good example to refer will be go/test/endtoend/clustertest

Pre-Requisite

Make sure you have vitess binary available in bin folder. If not, then you can run ./bootstrap.sh follow by make build & source build.env.

To make it easier to re-run test please add following to you bash profile.

export VTROOT=/<vitess path>/vitess
export VTDATAROOT=${VTROOT}/vtdataroot
export PATH=${VTROOT}/bin:${PATH}