@@ -26,6 +26,7 @@ import (
26
26
27
27
"github.com/pingcap/failpoint"
28
28
"github.com/pingcap/kvproto/pkg/kvrpcpb"
29
+ "github.com/pingcap/tidb/pkg/config"
29
30
"github.com/pingcap/tidb/pkg/domain/infosync"
30
31
"github.com/pingcap/tidb/pkg/meta/model"
31
32
"github.com/pingcap/tidb/pkg/parser/auth"
@@ -36,7 +37,6 @@ import (
36
37
"github.com/pingcap/tidb/pkg/testkit"
37
38
"github.com/pingcap/tidb/pkg/testkit/testfailpoint"
38
39
"github.com/pingcap/tidb/pkg/util/logutil"
39
- "github.com/pingcap/tidb/pkg/util/stringutil"
40
40
"github.com/stretchr/testify/require"
41
41
"github.com/tikv/client-go/v2/tikv"
42
42
"github.com/tikv/client-go/v2/tikvrpc"
@@ -370,10 +370,19 @@ func TestForAnalyzeStatus(t *testing.T) {
370
370
}
371
371
372
372
func TestForServersInfo (t * testing.T ) {
373
+ globalCfg := config .GetGlobalConfig ()
374
+ t .Cleanup (func () {
375
+ config .StoreGlobalConfig (globalCfg )
376
+ })
377
+ newCfg := * globalCfg
378
+ newCfg .Labels = map [string ]string {"dc" : "dc1" }
379
+ config .StoreGlobalConfig (& newCfg )
380
+
373
381
store := testkit .CreateMockStore (t )
374
382
tk := testkit .NewTestKit (t , store )
375
383
rows := tk .MustQuery ("select * from information_schema.TIDB_SERVERS_INFO" ).Rows ()
376
384
require .Len (t , rows , 1 )
385
+ require .Len (t , rows [0 ], 8 )
377
386
378
387
info , err := infosync .GetServerInfo ()
379
388
require .NoError (t , err )
@@ -385,7 +394,7 @@ func TestForServersInfo(t *testing.T) {
385
394
require .Equal (t , info .Lease , rows [0 ][4 ])
386
395
require .Equal (t , info .Version , rows [0 ][5 ])
387
396
require .Equal (t , info .GitHash , rows [0 ][6 ])
388
- require .Equal (t , stringutil . BuildStringFromLabels ( info . Labels ) , rows [0 ][8 ])
397
+ require .Equal (t , "dc=dc1" , rows [0 ][7 ])
389
398
}
390
399
391
400
func TestTiFlashSystemTableWithTiFlashV620 (t * testing.T ) {
0 commit comments