ddl: update test.
This commit is contained in:
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user