Skip to content

Commit 4e41699

Browse files
authored
tests: Add How to debug integration test in README.md (#50817)
1 parent 62e6bb3 commit 4e41699

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

tests/integrationtest/README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,39 @@ It will identify execute plan change.
5151

5252
### Generate New Result from Execute
5353

54-
First, add new test query in `t/` folder.
54+
Add a new test file in `t/` folder, file name should ended with `.test`. Or add new test queries at the end of some files. Then run shell below, it will generate results based on last execution.
5555

5656
```sh
5757
cd tests/integrationtest
5858
./run-tests.sh -r [casename]
59-
``
60-
It will generate result base on last execution, and then we can reuse them or open editor to do some modify.
59+
```
60+
61+
## How to debug integration test
62+
63+
### Visual Studio Code
64+
65+
1. Add or create a configuration to `.vscode/launch.json`, an example is shown below. If you want to change some configurations, such as using `TiKV` to run integration tests or others, you can modify `pkg/config/config.toml.example`.
66+
67+
```json
68+
{
69+
"version": "0.2.0",
70+
"configurations": [
71+
{
72+
"name": "Launch Package",
73+
"type": "go",
74+
"request": "launch",
75+
"mode": "auto",
76+
"program": "${fileWorkspaceFolder}/cmd/tidb-server",
77+
"args": ["--config=${fileWorkspaceFolder}/pkg/config/config.toml.example"]
78+
}
79+
]
80+
}
81+
```
82+
83+
2. To run `TiDB-Server`, you could bring up **Run and Debug** view, select the **Run and Debug** icon in the **Activity Bar** on the side of VS Code. You can also use shortcut **F5**.
84+
85+
3. Use any mysql client application you like to run SQLs in integration test, the default port is `4000` and default user is `root` without password. Taking `mysql` as an example, you can use `mysql --comments --host 127.0.0.1 --port 4000 -u root` command to do this.
86+
87+
### Goland
88+
89+
You could follow https://pingcap.github.io/tidb-dev-guide/get-started/setup-an-ide.html#run-or-debug to run a `TiDB-Server` with or without `TiKV`. Then use any mysql client application you like to run SQLs.

0 commit comments

Comments
 (0)