-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lightning: move tests out of br (#52289)
ref #52182
- Loading branch information
Showing
853 changed files
with
686 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Integration tests | ||
|
||
This folder contains all tests which relies on external processes such as TiDB. | ||
|
||
## Preparations | ||
|
||
1. The following executables must be copied or linked into these locations: | ||
|
||
* `bin/tidb-server` | ||
* `bin/tikv-server` | ||
* `bin/pd-server` | ||
* `bin/pd-ctl` | ||
* `bin/minio` | ||
* `bin/mc` | ||
* `bin/tiflash` | ||
|
||
The versions must be ≥2.1.0. | ||
|
||
What's more, there must be dynamic link library for TiFlash, see make target `bin` to learn more. | ||
You can install most of dependencies by running `download_tools.sh`. | ||
|
||
2. `make build_for_lightning_integration_test` | ||
|
||
3. The following programs must be installed: | ||
|
||
* `mysql` (the CLI client) | ||
* `curl` | ||
* `openssl` | ||
* `wget` | ||
* `lsof` | ||
|
||
4. The user executing the tests must have permission to create the folder | ||
`/tmp/lightning_test`. All test artifacts will be written into this folder. | ||
|
||
## Running | ||
|
||
Run `make lightning_integration_test` to execute all the integration tests. | ||
- Logs will be written into `/tmp/lightning_test` directory. | ||
|
||
Run `tests/run.sh --debug` to pause immediately after all servers are started. | ||
|
||
If you only want to run some tests, you can use: | ||
```shell | ||
TEST_NAME="lightning_gcs lightning_view" lightning/tests/run.sh | ||
``` | ||
|
||
Case names are separated by spaces. | ||
|
||
## Writing new tests | ||
|
||
1. New integration tests can be written as shell scripts in `tests/TEST_NAME/run.sh`. | ||
- `TEST_NAME` should start with `lightning_`. | ||
- The script should exit with a nonzero error code on failure. | ||
2. Add TEST_NAME to existing group in [run_group_lightning_tests.sh](./run_group_lightning_tests.sh)(Recommended), or add a new group for it. | ||
3. If you add a new group, the name of the new group must be added to CI [lightning-integration-test](https://github.com/PingCAP-QE/ci/blob/main/pipelines/pingcap/tidb/latest/pull_lightning_integration_test.groovy). | ||
|
||
Several convenient commands are provided in [utils](../../tests/_utils/): | ||
|
||
* `run_sql <SQL>` — Executes an SQL query on the TiDB database | ||
* `run_lightning [CONFIG]` — Starts `tidb-lightning` using `tests/TEST_NAME/CONFIG.toml` | ||
* `check_contains <TEXT>` — Checks if the previous `run_sql` result contains the given text | ||
(in `-E` format) | ||
* `check_not_contains <TEXT>` — Checks if the previous `run_sql` result does not contain the given | ||
text (in `-E` format) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
lease = 360 | ||
tso-save-interval = "360s" | ||
|
||
[replication] | ||
enable-placement-rules = true | ||
|
||
[security] | ||
cacert-path = "/tmp/lightning_test/certs/ca.pem" | ||
cert-path = "/tmp/lightning_test/certs/pd.pem" | ||
key-path = "/tmp/lightning_test/certs/pd.key" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# config of tidb | ||
|
||
# Schema lease duration | ||
# There are lot of ddl in the tests, setting this | ||
# to 360s to test whther BR is gracefully shutdown. | ||
lease = "360s" | ||
[security] | ||
ssl-ca = "/tmp/lightning_test/certs/ca.pem" | ||
ssl-cert = "/tmp/lightning_test/certs/tidb.pem" | ||
ssl-key = "/tmp/lightning_test/certs/tidb.key" | ||
cluster-ssl-ca = "/tmp/lightning_test/certs/ca.pem" | ||
cluster-ssl-cert = "/tmp/lightning_test/certs/tidb.pem" | ||
cluster-ssl-key = "/tmp/lightning_test/certs/tidb.key" | ||
|
||
# experimental section controls the features that are still experimental: their semantics, | ||
# interfaces are subject to change, using these features in the production environment is not recommended. | ||
[experimental] | ||
# enable creating expression index. | ||
allow-expression-index = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# config of tikv | ||
[storage] | ||
reserve-space = "1KB" | ||
data-dir = "/tmp/lightning_test/tikv1/" | ||
|
||
[coprocessor] | ||
region-max-keys = 100 | ||
region-split-keys = 60 | ||
|
||
[rocksdb] | ||
max-open-files = 4096 | ||
[raftdb] | ||
max-open-files = 4096 | ||
|
||
[raftstore] | ||
# true (default value) for high reliability, this can prevent data loss when power failure. | ||
sync-log = false | ||
capacity = "10GB" | ||
# Speed up TiKV region heartbeat | ||
pd-heartbeat-tick-interval = "1s" | ||
|
||
[cdc] | ||
hibernate-regions-compatible=false | ||
|
||
[security] | ||
ca-path = "/tmp/lightning_test/certs/ca.pem" | ||
cert-path = "/tmp/lightning_test/certs/tikv.pem" | ||
key-path = "/tmp/lightning_test/certs/tikv.key" | ||
|
||
[security.encryption] | ||
data-encryption-method = "aes256-ctr" | ||
|
||
[security.encryption.master-key] | ||
type = "file" | ||
path = "/tmp/lightning_test/master-key-file" |
Oops, something went wrong.