fix datacoord unstable ut (#28282)

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
pull/28241/head
wei liu 2023-11-08 18:44:58 +08:00 committed by GitHub
parent 618c58db4e
commit 12a09231f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -4741,10 +4741,10 @@ func TestDataNodeTtChannel(t *testing.T) {
func TestUpdateAutoBalanceConfigLoop(t *testing.T) {
Params.Save(Params.DataCoordCfg.CheckAutoBalanceConfigInterval.Key, "1")
defer Params.Reset(Params.DataCoordCfg.CheckAutoBalanceConfigInterval.Key)
Params.Save(Params.DataCoordCfg.AutoBalance.Key, "false")
defer Params.Reset(Params.DataCoordCfg.AutoBalance.Key)
t.Run("test old node exist", func(t *testing.T) {
Params.Save(Params.DataCoordCfg.AutoBalance.Key, "false")
defer Params.Reset(Params.DataCoordCfg.AutoBalance.Key)
oldSessions := make(map[string]*sessionutil.Session)
oldSessions["s1"] = &sessionutil.Session{}
@ -4763,6 +4763,8 @@ func TestUpdateAutoBalanceConfigLoop(t *testing.T) {
})
t.Run("test all old node down", func(t *testing.T) {
Params.Save(Params.DataCoordCfg.AutoBalance.Key, "false")
defer Params.Reset(Params.DataCoordCfg.AutoBalance.Key)
server := &Server{}
mockSession := sessionutil.NewMockSession(t)
mockSession.EXPECT().GetSessionsWithVersionRange(mock.Anything, mock.Anything).Return(nil, 0, nil).Maybe()

View File

@ -362,10 +362,10 @@ func (suite *ServerSuite) TestUpdateAutoBalanceConfigLoop() {
Params.Save(Params.QueryCoordCfg.CheckAutoBalanceConfigInterval.Key, "1")
defer Params.Reset(Params.QueryCoordCfg.CheckAutoBalanceConfigInterval.Key)
Params.Save(Params.QueryCoordCfg.AutoBalance.Key, "false")
defer Params.Reset(Params.QueryCoordCfg.AutoBalance.Key)
suite.Run("test old node exist", func() {
Params.Save(Params.QueryCoordCfg.AutoBalance.Key, "false")
defer Params.Reset(Params.QueryCoordCfg.AutoBalance.Key)
server := &Server{}
mockSession := sessionutil.NewMockSession(suite.T())
server.session = mockSession
@ -384,6 +384,8 @@ func (suite *ServerSuite) TestUpdateAutoBalanceConfigLoop() {
})
suite.Run("all old node down", func() {
Params.Save(Params.QueryCoordCfg.AutoBalance.Key, "false")
defer Params.Reset(Params.QueryCoordCfg.AutoBalance.Key)
server := &Server{}
mockSession := sessionutil.NewMockSession(suite.T())
server.session = mockSession