vitess.io/vitess@v0.16.2/go/test/endtoend/README.md (about)

     1  This document describe the testing strategy we use for all Vitess components, and the progression in scope / complexity.
     2  
     3  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. 
     4  
     5  
     6  ## End to End Tests
     7  
     8  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.
     9  
    10  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.
    11  
    12  
    13  ## Strategy 
    14  
    15  All the end to end test are placed under path go/test/endtoend. 
    16  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.  
    17  
    18  
    19  ### Setup
    20  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.
    21  
    22  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.   
    23  
    24  In general the cluster is build in following order
    25  - Define Keyspace
    26  - Define Shards
    27  - Start topology service [default etcd]
    28  - Start vtctld client
    29  - Start required mysqld instances
    30  - Start corresponding vttablets (atleast 1 primary and 1 replica)
    31  - Start Vtgate 
    32  
    33  A good example to refer will be  go/test/endtoend/clustertest
    34  
    35  ### Pre-Requisite 
    36  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`.
    37  
    38  To make it easier to re-run test please add following to you bash profile. 
    39   
    40  ```
    41  export VTROOT=/<vitess path>/vitess
    42  export VTDATAROOT=${VTROOT}/vtdataroot
    43  export PATH=${VTROOT}/bin:${PATH}
    44  ```