This topic describes how to use mysqltest for case testing in OceanBase Database.
Prerequisites
You have started an OceanBase cluster by using OceanBase Deployer (OBD). For more information, see Use OBD to start an OceanBase cluster.
Terms
Test case: the minimum unit for running mysqltest. A test case contains at least a test file and a result file.
Suite: a set of test cases.
Use mysqltest
Full test
Run the following command to run all test cases in mysql_test/test_suite:
obd test mysqltest <deploy name> --all --auto-retry
# To run the OBD command in another directory instead of the current directory, use the --suite-dir option.
# Some test cases contain a relative path. If you run the OBD command in another directory instead of the current directory, the test case may fail.
The
deploy nameparameter specifies the deployment configuration name, which can be understood as the configuration file name.The
--suite-diroption specifies the directory where the suite is located. Default value:./mysql_test/test_suite.The
--alloption specifies to run all suites in the directory specified by the--suite-diroption.If the
--auto-retryoption is specified, when a test case fails, mysqltest will automatically deploy the cluster again and run the test case again.
Single suite
Run the following command to run the specified suite in mysql_test/test_suite:
obd test mysqltest <deploy name> --suite <suite_name> --auto-retry
# To run the OBD command in another directory instead of the current directory, use the --suite-dir option.
# Some test cases contain a relative path. If you run the OBD command in another directory instead of the current directory, the test case may fail.
The
deploy nameparameter specifies the deployment configuration name, which can be understood as the configuration file name.The
--suite-diroption specifies the directory where the suite is located. Default value:./mysql_test/test_suite.The
--suiteoption specifies a set of suites, which are separated with commas (,).If the
--auto-retryoption is specified, when a test case fails, mysqltest will automatically deploy the cluster again and run the test case again.
Single test case
Run the following command to run a specified test case, such as mysql_test/test_suite/alter/t/alter_log_archive_option.test:
obd test mysqltest <deploy name> --test-dir ./mysql_test/test_suite/alter/t --result-dir ./mysql_test/test_suite/alter/r --test-set alter_log_archive_option --auto-retry
# If the OBD command is run in another directory instead of the current directory, adjust the --test-dir and --result-dir options.
# Some test cases contain a relative path. If you run the OBD command in another directory instead of the current directory, the test case may fail.
The
deploy nameparameter specifies the deployment configuration name, which can be understood as the configuration file name.The
--test-diroption specifies the directory where the test file is located. Default value:./t.The
--result-diroption specifies the directory where the result file is located. Default value:./r.The
--test-setoption specifies a set of test cases, which are separated with commas (,).If the
--auto-retryoption is specified, when a test case fails, mysqltest will automatically deploy the cluster again and run the test case again.