Skip to content

Commit

Permalink
add Makefile for msc
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Jan 12, 2023
1 parent 40b6daf commit fb48c14
Show file tree
Hide file tree
Showing 3 changed files with 47 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
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 fb48c14

Please sign in to comment.