Skip to content

Commit

Permalink
*: add Makefile for msc (#5856)
Browse files Browse the repository at this point in the history
ref #5851

Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
  • Loading branch information
rleungx and ti-chi-bot authored Jan 13, 2023
1 parent 364a1e1 commit 6be27aa
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
5 changes: 1 addition & 4 deletions tests/client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tidy:
git diff go.mod go.sum | cat
git diff --quiet go.mod go.sum

test: enable-codegen dashboard-ui
test: enable-codegen
CGO_ENABLED=1 go test -tags deadlock -race -cover || { $(MAKE) disable-codegen && exit 1; }
$(MAKE) disable-codegen

Expand All @@ -46,6 +46,3 @@ enable-codegen:
disable-codegen:
cd ../../ && $(MAKE) failpoint-disable
go mod tidy

dashboard-ui:
cd ../../ && $(MAKE) dashboard-ui
45 changes: 45 additions & 0 deletions tests/msc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2023 TiKV Project Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

GO_TOOLS_BIN_PATH := $(shell pwd)/../../.tools/bin
PATH := $(GO_TOOLS_BIN_PATH):$(PATH)
SHELL := env PATH='$(PATH)' GOBIN='$(GO_TOOLS_BIN_PATH)' $(shell which bash)

static: install-tools
@ gofmt -s -l -d . 2>&1 | awk '{ print } END { if (NR > 0) { exit 1 } }'
@ golangci-lint run ./...
@ revive -formatter friendly -config ../../revive.toml .

tidy:
@ go mod tidy
git diff go.mod go.sum | cat
git diff --quiet go.mod go.sum

test: enable-codegen
CGO_ENABLED=1 go test ./... -tags deadlock -race -cover || { $(MAKE) disable-codegen && exit 1; }
$(MAKE) disable-codegen

ci-test-job: enable-codegen
CGO_ENABLED=1 go test ./... -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=../../... github.com/tikv/pd/tests/msc

install-tools:
cd ../../ && $(MAKE) install-tools

enable-codegen:
cd ../../ && $(MAKE) failpoint-enable
go mod tidy

disable-codegen:
cd ../../ && $(MAKE) failpoint-disable
go mod tidy
1 change: 1 addition & 0 deletions tests/msc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ require (
github.com/shirou/gopsutil v3.21.3+incompatible // indirect
github.com/shurcooL/httpgzip v0.0.0-20190720172056-320755c1c1b0 // indirect
github.com/sirupsen/logrus v1.6.0 // indirect
github.com/smallnest/chanx v0.0.0-20221229104322-eb4c998d2072 // indirect
github.com/soheilhy/cmux v0.1.4 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.4.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions tests/msc/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/smallnest/chanx v0.0.0-20221229104322-eb4c998d2072 h1:Txo4SXVJq/OgEjwgkWoxkMoTjGlcrgsQE/XSghjmu0w=
github.com/smallnest/chanx v0.0.0-20221229104322-eb4c998d2072/go.mod h1:+4nWMF0+CqEcU74SnX2NxaGqZ8zX4pcQ8Jcs77DbX5A=
github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
Expand Down
2 changes: 1 addition & 1 deletion tests/msc/resource_manager/resource_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func (suite *resourceManagerClientTestSuite) SetupSuite() {
leader := suite.cluster.GetServer(leaderName)
suite.client, err = pd.NewClientWithContext(suite.ctx, []string{leader.GetAddr()}, pd.SecurityOption{})
re.NoError(err)

}

func (suite *resourceManagerClientTestSuite) TearDownSuite() {
suite.client.Close()
suite.clean()
Expand Down

0 comments on commit 6be27aa

Please sign in to comment.