fix datacoord unstable ut (#28281)

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
pull/28285/head
wei liu 2023-11-08 18:43:31 +08:00 committed by GitHub
parent 9f9726f8b7
commit 7f78e1dd46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -4756,10 +4756,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.NewSession(context.Background())
@ -4778,6 +4778,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