2.3 KiB
#+title Spider Development Documentation
Testing
Run spider test suites
Spider has sub-suites. Assuming temporary WIP spider tests are placed under the spider/temp suite, to run a test on all spider tests, do
./mysql-test/mtr --suite spider,spider/*,spider/*/* \
--skip-test="spider/temp.*|.*/t\..*" --parallel=auto --big-test \
--force --max-test-fail=0
Tests should be run normally, but also with –ps-protocol, –view-protocol and ASAN.
For 10.11+ tests should also be run with –mysqld=–loose-disable-spider-group-by-handler. This will be done automatically after MDEV-37810.
Where to place new tests
- spider/bugfix suite for bugfixes
- spider/feature suite for new features
- spider suite for all else, such as generic tests to improve coverage
Use engine defined attributes in tests whenever possible
In versions of at least 10.11, when writing new tests or updating existing tests, use engine defined attributes for spider table connection info instead of table comments
# Do this for 10.11+
CREATE TABLE t (c int) ENGINE=SPIDER REMOTE_SERVER=s1 REMOTE_TABLE=t1;
# Do this for 10.6
CREATE TABLE t (c int) ENGINE=SPIDER COMMENT='srv "s1", table "t1"';
However, if the spider table has connection info that is not REMOTE_SERVER, REMOTE_TABLE, or REMOTE_DATABASE, comments are still needed for 10.11:
# Do this for 10.6 and 10.11
CREATE TABLE t (c int) ENGINE=SPIDER COMMENT='srv "s1", table "t1", read_only_mode "1"';
# Do this for 11.4+
CREATE TABLE t (c int) ENGINE=SPIDER REMOTE_SERVER=s1 REMOTE_TABLE=t1 READ_ONLY=1;
Don't mix engine defined attributes with COMMENT, unless the mixing is part of the test.
# Don't do this
CREATE TABLE t (c int) ENGINE=SPIDER REMOTE_SERVER=s1 REMOTE_TABLE=t1 COMMENT='read_only_mode "1"';
WRAPPER by default is mysql, so it is ok to do the following conversion in 10.11+:
# From
CREATE TABLE t (c int) ENGINE=SPIDER COMMENT='wrapper "mysql", srv "s1", table "t1"';
# to
CREATE TABLE t (c int) ENGINE=SPIDER REMOTE_SERVER=s1 REMOTE_TABLE=t1;