File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Copyright 2025 PingCAP, Inc.
2+ // SPDX-License-Identifier: Apache-2.0
3+
4+ package config
5+
6+ import (
7+ "testing"
8+
9+ "github.com/stretchr/testify/require"
10+ )
11+
12+ func TestCheckBalance (t * testing.T ) {
13+ balances := []Balance {
14+ {
15+ Policy : "test" ,
16+ },
17+ {
18+ RoutingPolicy : "test" ,
19+ },
20+ {
21+ Status : Factor {MigrationsPerSecond : - 1 },
22+ },
23+ {
24+ Health : Factor {MigrationsPerSecond : - 1 },
25+ },
26+ {
27+ Memory : Factor {MigrationsPerSecond : - 1 },
28+ },
29+ {
30+ CPU : Factor {MigrationsPerSecond : - 1 },
31+ },
32+ {
33+ Location : Factor {MigrationsPerSecond : - 1 },
34+ },
35+ {
36+ ConnCount : ConnCountFactor {Factor : Factor {MigrationsPerSecond : - 1 }},
37+ },
38+ {
39+ ConnCount : ConnCountFactor {CountRatioThreshold : - 1 },
40+ },
41+ }
42+
43+ for i , balance := range balances {
44+ require .Error (t , balance .Check (), "%d" , i )
45+ }
46+
47+ balance := Balance {}
48+ require .NoError (t , (& balance ).Check ())
49+ balance = DefaultBalance ()
50+ require .NoError (t , (& balance ).Check ())
51+ }
You can’t perform that action at this time.
0 commit comments