Skip to content

Commit

Permalink
fix watch keyspace test case (tikv#147)
Browse files Browse the repository at this point in the history
* fix watch keyspace test case

Signed-off-by: ystaticy <y_static_y@sina.com>
  • Loading branch information
ystaticy authored Jul 21, 2023
1 parent 8d64c3a commit a6b64c3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/integrations/client/keyspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,20 @@ func (suite *clientTestSuite) TestWatchKeyspaces() {
additionalKeyspaces := mustMakeTestKeyspaces(re, suite.srv, 30, 10)
re.NoError(err)
// Checks that all additional keyspaces are captured by watch channel.
for i := 0; i < 10; {
ksID := 0
for i := 0; i < 20; i++ {
loadedKeyspaces := <-watchChan
// Create keyspace need disable at first,and update to enabled after split succ.
// So it will watch 2 states.
if i%2 == 0 {
continue
}

re.NotEmpty(loadedKeyspaces)
for j := range loadedKeyspaces {
re.Equal(additionalKeyspaces[i+j], loadedKeyspaces[j])
re.Equal(additionalKeyspaces[ksID+j], loadedKeyspaces[j])
}
i += len(loadedKeyspaces)
ksID++
}
// Updates to state should also be captured.
expected, err := suite.srv.GetKeyspaceManager().UpdateKeyspaceState(initialKeyspaces[0].Name, keyspacepb.KeyspaceState_DISABLED, time.Now().Unix())
Expand Down

0 comments on commit a6b64c3

Please sign in to comment.