diff --git a/.golangci.yml b/.golangci.yml index 68cc82bd373..d5b2e4e7f5a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -29,7 +29,6 @@ linters-settings: excludes: - G402 - G404 - - G601 testifylint: enable: - bool-compare diff --git a/tests/server/api/rule_test.go b/tests/server/api/rule_test.go index 2cbabe16d0f..f4d85d60361 100644 --- a/tests/server/api/rule_test.go +++ b/tests/server/api/rule_test.go @@ -228,14 +228,14 @@ func (suite *ruleTestSuite) checkGet(cluster *tests.TestCluster) { code: http.StatusNotFound, }, } - for _, testCase := range testCases { + for i, testCase := range testCases { suite.T().Log(testCase.name) var resp placement.Rule url := fmt.Sprintf("%s/rule/%s/%s", urlPrefix, testCase.rule.GroupID, testCase.rule.ID) if testCase.found { tu.Eventually(re, func() bool { err = tu.ReadGetJSON(re, tests.TestDialClient, url, &resp) - return compareRule(&resp, &testCase.rule) + return compareRule(&resp, &testCases[i].rule) }) } else { err = tu.CheckGetJSON(tests.TestDialClient, url, nil, tu.Status(re, testCase.code)) diff --git a/tools/pd-api-bench/config/config.go b/tools/pd-api-bench/config/config.go index d1048c0da72..35377c12f33 100644 --- a/tools/pd-api-bench/config/config.go +++ b/tools/pd-api-bench/config/config.go @@ -96,18 +96,21 @@ func (c *Config) Parse(arguments []string) error { // InitCoordinator set case config from config itself. func (c *Config) InitCoordinator(co *cases.Coordinator) { for name, cfg := range c.HTTP { + cfg := cfg err := co.SetHTTPCase(name, &cfg) if err != nil { log.Error("create HTTP case failed", zap.Error(err)) } } for name, cfg := range c.GRPC { + cfg := cfg err := co.SetGRPCCase(name, &cfg) if err != nil { log.Error("create gRPC case failed", zap.Error(err)) } } for name, cfg := range c.ETCD { + cfg := cfg err := co.SetETCDCase(name, &cfg) if err != nil { log.Error("create etcd case failed", zap.Error(err)) diff --git a/tools/pd-api-bench/main.go b/tools/pd-api-bench/main.go index d62d83437b6..747fbaa10c1 100644 --- a/tools/pd-api-bench/main.go +++ b/tools/pd-api-bench/main.go @@ -255,6 +255,7 @@ func runHTTPServer(cfg *config.Config, co *cases.Coordinator) { return } for name, cfg := range input { + cfg := cfg co.SetHTTPCase(name, &cfg) } c.String(http.StatusOK, "") @@ -272,6 +273,7 @@ func runHTTPServer(cfg *config.Config, co *cases.Coordinator) { return } for name, cfg := range input { + cfg := cfg co.SetGRPCCase(name, &cfg) } c.String(http.StatusOK, "") @@ -289,6 +291,7 @@ func runHTTPServer(cfg *config.Config, co *cases.Coordinator) { return } for name, cfg := range input { + cfg := cfg co.SetETCDCase(name, &cfg) } c.String(http.StatusOK, "")