From 08f6e98362204c4473562f539333366bb658d836 Mon Sep 17 00:00:00 2001 From: nolouch Date: Mon, 10 Jun 2019 10:57:39 +0800 Subject: [PATCH 1/2] config: disable label check by default Signed-off-by: nolouch --- server/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/config.go b/server/config.go index ce2a3ae700c..36cda4aebcc 100644 --- a/server/config.go +++ b/server/config.go @@ -198,7 +198,7 @@ const ( defaultLeaderPriorityCheckInterval = time.Minute defaultUseRegionStorage = true - defaultStrictlyMatchLabel = true + defaultStrictlyMatchLabel = false ) func adjustString(v *string, defValue string) { From 820094d209a641e38f96bb825c26209f3c6ea179 Mon Sep 17 00:00:00 2001 From: nolouch Date: Mon, 10 Jun 2019 13:22:17 +0800 Subject: [PATCH 2/2] fix tests Signed-off-by: nolouch --- server/api/store_test.go | 10 ++++++++-- server/schedule/mockcluster.go | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/server/api/store_test.go b/server/api/store_test.go index 30bdab57b50..dccd56bdd17 100644 --- a/server/api/store_test.go +++ b/server/api/store_test.go @@ -147,6 +147,12 @@ func (s *testStoreSuite) TestStoreLabel(c *C) { c.Assert(err, IsNil) c.Assert(info.Store.Labels, HasLen, 0) + // Test merge. + // enable label match check. + labelCheck := map[string]string{"strictly-match-label": "true"} + lc, _ := json.Marshal(labelCheck) + err = postJSON(s.urlPrefix+"/config", lc) + c.Assert(err, IsNil) // Test set. labels := map[string]string{"zone": "cn", "host": "local"} b, err := json.Marshal(labels) @@ -169,8 +175,8 @@ func (s *testStoreSuite) TestStoreLabel(c *C) { // Test merge. // disable label match check. - labelCheck := map[string]string{"strictly-match-label": "false"} - lc, _ := json.Marshal(labelCheck) + labelCheck = map[string]string{"strictly-match-label": "false"} + lc, _ = json.Marshal(labelCheck) err = postJSON(s.urlPrefix+"/config", lc) c.Assert(err, IsNil) diff --git a/server/schedule/mockcluster.go b/server/schedule/mockcluster.go index ff0d94f4a8e..1ce30df7121 100644 --- a/server/schedule/mockcluster.go +++ b/server/schedule/mockcluster.go @@ -551,7 +551,7 @@ const ( defaultLowSpaceRatio = 0.8 defaultHighSpaceRatio = 0.6 defaultHotRegionCacheHitsThreshold = 3 - defaultStrictlyMatchLabel = true + defaultStrictlyMatchLabel = false ) // MockSchedulerOptions is a mock of SchedulerOptions