Better way to debug single unit test in tidb

Goland cannot recognize our tidb unit test function because we are using a forked go-check lib named “”. Every time I want to debug a single unit test I should take the following steps:

  1. create a new debug configuration
  2. fill the package path and add a program argument like “-check.f TestFoo”
  3. press “OK” to save the configuration
  4. press the debug button on the tool bar

HoweverI found it’s much more convenient to debug when we using the official go-check lib. The only thing we should do is simply clicking the triangle button on the left. Some way to achieve a better experience when debugging tidb unit test?

1 Like

If you don’t mind using dlv, there is a simple command to debug a test

dlv test -- -check.f TestIssue24210

It’s runnable, but not as friendly as GoLand.
IMHO, the debugger should be easy to navigate, which is the killer feature of GUI.

Sure, but I am fine with command line, it is more friendly to working remotely :slight_smile:

Maybe we can issue a feature request to tide

If I run from root path of tidb repo, I got

➜  tidb git:(master) dlv test -- -check.f TestGetBundle
no Go files in /Users/tison/go/src/
exit status 1

@lcwangchao FYI there was an attempt to use testify in pingcap/tidb as a replacement of pingcap/check.

I did ever use testify in pingcap/errors [1] and it works well with richer matchers and default parallelism support.

I think the modification from gocheck to pingcap/check mainly focuses on parallelism. It is possibly we switch to testify to live with a stronger community instead of a lack of maintenance version of a smaller community.

  • testify has 188 contributors and latest updated at Apr. 27
  • go-check has 13 contributors and latest updated at last year.

If you think this direction is good to go, maybe we can draft a pre-RFC to collect wider input.



you need to use it in the corresponding package directory, say executor/

Switching to testify LGTM.