pingcap / pingcap/tidb

tests/realtikvtest: avoid FailNow in failpoint callbacks

Open
#65,901 0 comments 0 reactions 0 assignees View on GitHub
component/test severity/minor type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step (Required)

1. Start a minimal playground cluster:

```bash
tiup playground nightly --db=0 --kv=1 --tiflash=0 --without-monitor
```

2. Enable failpoints:

```bash
make failpoint-enable
```

3. Run one of the tests (reproduces intermittently depending on timing):

```bash
go test -v -run '^TestAlterJobOnDXF$' -count=1 -tags=intest ./tests/realtikvtest/addindextest2
# or
go test -v -run '^TestAlterJobOnDXFWithGlobalSort$' -count=1 -tags=intest ./tests/realtikvtest/addindextest2
```

### 2. What did you expect to see? (Required)

- The test should report assertion failures reliably.
- The test should not hang or become flaky due to assertion handling.

### 3. What did you see instead (Required)

Some failpoint callbacks are executed in background goroutines (e.g. DDL/dist-task worker goroutines). If these callbacks use `testify/require` (or `TestKit.MustExec` / `MustQuery`, which rely on `require`), they may call `t.FailNow()`.

Calling `FailNow` (and `Fatal/Fatalf/SkipNow`) from a non-test goroutine only exits that goroutine, potentially leaving the DDL pipeline in an unexpected state and causing the test to behave flaky or hang.

### 4. What is your TiDB version? (Required)

Commit: e94da4255da9af613ae0264a288404e076ee5e38

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.