diff --git a/ddl/column_test.go b/ddl/column_test.go index e3b10a9ed3..3fd3a85a2c 100644 --- a/ddl/column_test.go +++ b/ddl/column_test.go @@ -495,9 +495,7 @@ func (s *testIndexSuite) TestAddColumn(c *C) { done <- testCreateColumn(c, ctx, s.d, s.dbInfo, tblInfo, colName, &ColumnPosition{Type: ColumnPositionNone}, defaultColValue) }() - states := []model.SchemaState{model.StateDeleteOnly, model.StateWriteOnly, model.StateReorganization, model.StatePublic} - stateIndex := 0 - lastStateIndex := -1 + lastCheckState := model.StateNone col := &column.Col{} for { @@ -516,19 +514,14 @@ func (s *testIndexSuite) TestAddColumn(c *C) { } // Here means column state is not changed, so just skipped. - if stateIndex == lastStateIndex { + if lastCheckState == col.State { continue } - if stateIndex == len(states) { - return - } - - lastStateIndex = stateIndex - stateIndex++ - s.checkAddOrDropColumn(c, col.State, ctx, d, tblInfo, handle, col, row, defaultColValue, false) + lastCheckState = col.State + d.start() } } @@ -566,9 +559,7 @@ func (s *testIndexSuite) TestDropColumn(c *C) { done <- testDropColumn(c, ctx, s.d, s.dbInfo, tblInfo, colName, false) }() - states := []model.SchemaState{model.StateWriteOnly, model.StateDeleteOnly, model.StateReorganization} - stateIndex := 0 - lastStateIndex := -1 + lastCheckState := model.StateNone col := &column.Col{} for { @@ -587,19 +578,14 @@ func (s *testIndexSuite) TestDropColumn(c *C) { } // Here means column state is not changed, so just skipped. - if stateIndex == lastStateIndex { + if lastCheckState == col.State { continue } - if stateIndex == len(states) { - return - } - - lastStateIndex = stateIndex - stateIndex++ - s.checkAddOrDropColumn(c, col.State, ctx, d, tblInfo, handle, col, row, defaultColValue, true) + lastCheckState = col.State + d.start() } }