Skip to content

Commit

Permalink
Add more test cases.
Browse files Browse the repository at this point in the history
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
  • Loading branch information
binshi-bing committed Jun 30, 2023
1 parent 5dd5562 commit e7c29da
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions pkg/keyspace/tso_keyspace_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ func TestBuildSplitKeyspaces(t *testing.T) {
err: ErrKeyspaceNotInKeyspaceGroup,
},
{
old: []uint32{1, 2},
new: []uint32{2, 2},
old: []uint32{1, 2},
new: []uint32{2, 2},
expectedOld: []uint32{1},
expectedNew: []uint32{2},
},
Expand All @@ -510,20 +510,41 @@ func TestBuildSplitKeyspaces(t *testing.T) {
expectedOld: []uint32{1, 5},
expectedNew: []uint32{2, 3, 4},
},
{
old: []uint32{1, 2, 3, 4, 5},
startKeyspaceID: 5,
endKeyspaceID: 6,
expectedOld: []uint32{1, 2, 3, 4},
expectedNew: []uint32{5},
},
{
old: []uint32{1, 2, 3, 4, 5},
startKeyspaceID: 2,
endKeyspaceID: 6,
expectedOld: []uint32{1},
expectedNew: []uint32{2, 3, 4, 5},
},
{
old: []uint32{1, 2, 3, 4, 5},
startKeyspaceID: 1,
endKeyspaceID: 1,
expectedOld: []uint32{2, 3, 4, 5},
expectedNew: []uint32{1},
},
{
old: []uint32{1, 2, 3, 4, 5},
startKeyspaceID: 0,
endKeyspaceID: 6,
expectedOld: []uint32{},
expectedNew: []uint32{1, 2, 3, 4, 5},
},
{
old: []uint32{1, 2, 3, 4, 5},
startKeyspaceID: 7,
endKeyspaceID: 10,
expectedOld: []uint32{1, 2, 3, 4, 5},
expectedNew: []uint32{},
},
{
old: []uint32{1, 2, 3, 4, 5},
err: ErrKeyspaceNotInKeyspaceGroup,
Expand Down

0 comments on commit e7c29da

Please sign in to comment.