@@ -3533,15 +3533,33 @@ func TestClientDisconnectCancelsAutocommitInsertPrewrite(t *testing.T) {
35333533 if prepared {
35343534 name = "prepared"
35353535 }
3536- t .Run (name , func (t * testing.T ) {
3537- ts .RunTests (t , nil , func (dbt * testkit.DBTestKit ) {
3538- tableName := "issue57531_prewrite_" + name
3539- dbt .MustExec ("drop table if exists " + tableName )
3540- dbt .MustExec ("create table " + tableName + " (a int primary key, b int)" )
3541- testfailpoint .Enable (t , "github.com/pingcap/tidb/pkg/store/mockstore/unistore/rpcPrewriteResult" , `return("notLeader")` )
3542- runClientDisconnectAutocommitInsert (t , dbt , tableName , fmt .Sprintf ("insert into %s values (1, 1)" , tableName ), prepared )
3536+ for _ , insertCase := range []struct {
3537+ name string
3538+ buildSQL func (tableName string ) string
3539+ }{
3540+ {
3541+ name : "single_row" ,
3542+ buildSQL : func (tableName string ) string {
3543+ return fmt .Sprintf ("insert into %s values (1, 1)" , tableName )
3544+ },
3545+ },
3546+ {
3547+ name : "multi_rows" ,
3548+ buildSQL : func (tableName string ) string {
3549+ return fmt .Sprintf ("insert into %s values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5)" , tableName )
3550+ },
3551+ },
3552+ } {
3553+ t .Run (name + "/" + insertCase .name , func (t * testing.T ) {
3554+ ts .RunTests (t , nil , func (dbt * testkit.DBTestKit ) {
3555+ tableName := "issue57531_prewrite_" + name + "_" + insertCase .name
3556+ dbt .MustExec ("drop table if exists " + tableName )
3557+ dbt .MustExec ("create table " + tableName + " (a int primary key, b int)" )
3558+ testfailpoint .Enable (t , "github.com/pingcap/tidb/pkg/store/mockstore/unistore/rpcPrewriteResult" , `return("notLeader")` )
3559+ runClientDisconnectAutocommitInsert (t , dbt , tableName , insertCase .buildSQL (tableName ), prepared )
3560+ })
35433561 })
3544- })
3562+ }
35453563 }
35463564}
35473565
0 commit comments