diff --git a/.github/workflows/pd-tests.yaml b/.github/workflows/pd-tests.yaml index f2f3b0f43e0..83d4651ca3a 100644 --- a/.github/workflows/pd-tests.yaml +++ b/.github/workflows/pd-tests.yaml @@ -46,8 +46,7 @@ jobs: WORKER_ID: ${{ matrix.worker_id }} WORKER_COUNT: 10 run: | - [ $WORKER_ID -ne $WORKER_COUNT ] && make ci-test-job JOB_COUNT=$(($WORKER_COUNT-1)) JOB_INDEX=$WORKER_ID - [ $WORKER_ID -eq $WORKER_COUNT ] && make ci-test-job-submod + make ci-test-job JOB_COUNT=$(($WORKER_COUNT)) JOB_INDEX=$WORKER_ID mv covprofile covprofile_$WORKER_ID sed -i "/failpoint_binding/d" covprofile_$WORKER_ID - name: Upload coverage result ${{ matrix.worker_id }} diff --git a/Makefile b/Makefile index 14de2eb5263..84b7ce37ee0 100644 --- a/Makefile +++ b/Makefile @@ -216,12 +216,7 @@ basic-test: install-tools ci-test-job: install-tools dashboard-ui @$(FAILPOINT_ENABLE) CGO_ENABLED=1 go test -timeout=15m -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=./... $(shell ./scripts/ci-subtask.sh $(JOB_COUNT) $(JOB_INDEX)) - @$(FAILPOINT_DISABLE) - -ci-test-job-submod: install-tools dashboard-ui - @$(FAILPOINT_ENABLE) - @ for mod in $(SUBMODULES); do cd $$mod && $(MAKE) ci-test-job && cd $(ROOT_PATH) > /dev/null && cat $$mod/covprofile >> covprofile; done - @$(FAILPOINT_DISABLE) + @ for mod in $(shell ./scripts/ci-subtask.sh $(JOB_COUNT) $(JOB_INDEX) 1); do cd $$mod && $(MAKE) ci-test-job && cd $(ROOT_PATH) > /dev/null && cat $$mod/covprofile >> covprofile; done TSO_INTEGRATION_TEST_PKGS := $(PD_PKG)/tests/server/tso diff --git a/pd.code-workspace b/pd.code-workspace index 6a5d85d60fe..c4603084a93 100644 --- a/pd.code-workspace +++ b/pd.code-workspace @@ -10,15 +10,15 @@ }, { "name": "pd-client-tests", - "path": "tests/client" + "path": "tests/integrations/client" }, { "name": "mcs-tests", - "path": "tests/mcs" + "path": "tests/integrations/mcs" }, { "name": "tso-tests", - "path": "tests/tso" + "path": "tests/integrations/tso" }, { "name": "pd-tso-bench", diff --git a/pkg/utils/grpcutil/grpcutil_test.go b/pkg/utils/grpcutil/grpcutil_test.go index ac3ba3da3fc..ea1de4fb681 100644 --- a/pkg/utils/grpcutil/grpcutil_test.go +++ b/pkg/utils/grpcutil/grpcutil_test.go @@ -24,9 +24,9 @@ func TestToTLSConfig(t *testing.T) { t.Parallel() re := require.New(t) tlsConfig := TLSConfig{ - KeyPath: "../../../tests/client/cert/pd-server-key.pem", - CertPath: "../../../tests/client/cert/pd-server.pem", - CAPath: "../../../tests/client/cert/ca.pem", + KeyPath: "../../../tests/integrations/client/cert/pd-server-key.pem", + CertPath: "../../../tests/integrations/client/cert/pd-server.pem", + CAPath: "../../../tests/integrations/client/cert/ca.pem", } // test without bytes _, err := tlsConfig.ToTLSConfig() diff --git a/scripts/ci-subtask.sh b/scripts/ci-subtask.sh index 6a2ebc0248a..9628f2688c5 100755 --- a/scripts/ci-subtask.sh +++ b/scripts/ci-subtask.sh @@ -1,29 +1,50 @@ #!/bin/bash -# ./ci-subtask.sh +# ./ci-subtask.sh -packages=(`go list ./...`) -dirs=(`find . -iname "*_test.go" -exec dirname {} \; | sort -u | sed -e "s/^\./github.com\/tikv\/pd/"`) -tasks=($(comm -12 <(printf "%s\n" "${packages[@]}") <(printf "%s\n" "${dirs[@]}"))) +if [[ $3 ]]; then + # Get integration test list. + makefile_dirs=($(find . -iname "Makefile" -exec dirname {} \; | sort -u)) + submod_dirs=($(find . -iname "go.mod" -exec dirname {} \; | sort -u)) + integration_tasks=$(comm -12 <(printf "%s\n" "${makefile_dirs[@]}") <(printf "%s\n" "${submod_dirs[@]}") | grep "./tests/integrations/*") + # Currently, we only have 3 integration tests, so we can hardcode the task index. + for t in ${integration_tasks[@]}; do + if [[ "$t" = "./tests/integrations/client" && "$2" = 9 ]]; then + printf "%s " "$t" + break + elif [[ "$t" = "./tests/integrations/tso" && "$2" = 7 ]]; then + printf "%s " "$t" + break + elif [[ "$t" = "./tests/integrations/mcs" && "$2" = 2 ]]; then + printf "%s " "$t" + break + fi + done +else + # Get package test list. + packages=($(go list ./...)) + dirs=($(find . -iname "*_test.go" -exec dirname {} \; | sort -u | sed -e "s/^\./github.com\/tikv\/pd/")) + tasks=($(comm -12 <(printf "%s\n" "${packages[@]}") <(printf "%s\n" "${dirs[@]}"))) -weight () { - [[ $1 == "github.com/tikv/pd/server/api" ]] && return 30 - [[ $1 == "github.com/tikv/pd/pkg/schedule" ]] && return 30 - [[ $1 =~ "pd/tests" ]] && return 5 - return 1 -} + weight() { + [[ $1 == "github.com/tikv/pd/server/api" ]] && return 30 + [[ $1 == "github.com/tikv/pd/pkg/schedule" ]] && return 30 + [[ $1 =~ "pd/tests" ]] && return 5 + return 1 + } -scores=(`seq "$1" | xargs -I{} echo 0`) + scores=($(seq "$1" | xargs -I{} echo 0)) -res=() -for t in ${tasks[@]}; do - min_i=0 - for i in ${!scores[@]}; do - [[ ${scores[i]} -lt ${scores[$min_i]} ]] && min_i=$i + res=() + for t in ${tasks[@]}; do + min_i=0 + for i in ${!scores[@]}; do + [[ ${scores[i]} -lt ${scores[$min_i]} ]] && min_i=$i + done + weight $t + scores[$min_i]=$((${scores[$min_i]} + $?)) + [[ $(($min_i + 1)) -eq $2 ]] && res+=($t) done - weight $t - scores[$min_i]=$((${scores[$min_i]} + $?)) - [[ $(($min_i+1)) -eq $2 ]] && res+=($t) -done -printf "%s " "${res[@]}" + printf "%s " "${res[@]}" +fi diff --git a/tests/client/Makefile b/tests/integrations/client/Makefile similarity index 68% rename from tests/client/Makefile rename to tests/integrations/client/Makefile index 5663a2f3b45..e8c2f30e2fa 100644 --- a/tests/client/Makefile +++ b/tests/integrations/client/Makefile @@ -12,37 +12,35 @@ # See the License for the specific language governing permissions and # limitations under the License. -GO_TOOLS_BIN_PATH := $(shell pwd)/../../.tools/bin +ROOT_PATH := ../../.. +GO_TOOLS_BIN_PATH := $(ROOT_PATH)/.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 . + @ revive -formatter friendly -config $(ROOT_PATH)/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 -v -tags deadlock -race -cover || { $(MAKE) disable-codegen && exit 1; } - $(MAKE) disable-codegen +test: failpoint-enable + CGO_ENABLED=1 go test -v -tags deadlock -race -cover || { $(MAKE) failpoint-disable && exit 1; } + $(MAKE) failpoint-disable -basic-test: - # skip - -ci-test-job: enable-codegen - CGO_ENABLED=1 go test -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=../../... github.com/tikv/pd/tests/client +ci-test-job: + CGO_ENABLED=1 go test -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=$(ROOT_PATH)/... github.com/tikv/pd/tests/integrations/client install-tools: - cd ../../ && $(MAKE) install-tools + cd $(ROOT_PATH) && $(MAKE) install-tools -enable-codegen: - cd ../../ && $(MAKE) failpoint-enable +failpoint-enable: + cd $(ROOT_PATH) && $(MAKE) failpoint-enable go mod tidy -disable-codegen: - cd ../../ && $(MAKE) failpoint-disable +failpoint-disable: + cd $(ROOT_PATH) && $(MAKE) failpoint-disable go mod tidy diff --git a/tests/client/cert-expired/ca-config.json b/tests/integrations/client/cert-expired/ca-config.json similarity index 100% rename from tests/client/cert-expired/ca-config.json rename to tests/integrations/client/cert-expired/ca-config.json diff --git a/tests/client/cert-expired/ca-csr.json b/tests/integrations/client/cert-expired/ca-csr.json similarity index 100% rename from tests/client/cert-expired/ca-csr.json rename to tests/integrations/client/cert-expired/ca-csr.json diff --git a/tests/client/cert-expired/ca-key.pem b/tests/integrations/client/cert-expired/ca-key.pem similarity index 100% rename from tests/client/cert-expired/ca-key.pem rename to tests/integrations/client/cert-expired/ca-key.pem diff --git a/tests/client/cert-expired/ca.csr b/tests/integrations/client/cert-expired/ca.csr similarity index 100% rename from tests/client/cert-expired/ca.csr rename to tests/integrations/client/cert-expired/ca.csr diff --git a/tests/client/cert-expired/ca.pem b/tests/integrations/client/cert-expired/ca.pem similarity index 100% rename from tests/client/cert-expired/ca.pem rename to tests/integrations/client/cert-expired/ca.pem diff --git a/tests/client/cert-expired/client-key.pem b/tests/integrations/client/cert-expired/client-key.pem similarity index 100% rename from tests/client/cert-expired/client-key.pem rename to tests/integrations/client/cert-expired/client-key.pem diff --git a/tests/client/cert-expired/client.csr b/tests/integrations/client/cert-expired/client.csr similarity index 100% rename from tests/client/cert-expired/client.csr rename to tests/integrations/client/cert-expired/client.csr diff --git a/tests/client/cert-expired/client.pem b/tests/integrations/client/cert-expired/client.pem similarity index 100% rename from tests/client/cert-expired/client.pem rename to tests/integrations/client/cert-expired/client.pem diff --git a/tests/client/cert-expired/gencerts.sh b/tests/integrations/client/cert-expired/gencerts.sh similarity index 100% rename from tests/client/cert-expired/gencerts.sh rename to tests/integrations/client/cert-expired/gencerts.sh diff --git a/tests/client/cert-expired/pd-server-key.pem b/tests/integrations/client/cert-expired/pd-server-key.pem similarity index 100% rename from tests/client/cert-expired/pd-server-key.pem rename to tests/integrations/client/cert-expired/pd-server-key.pem diff --git a/tests/client/cert-expired/pd-server.csr b/tests/integrations/client/cert-expired/pd-server.csr similarity index 100% rename from tests/client/cert-expired/pd-server.csr rename to tests/integrations/client/cert-expired/pd-server.csr diff --git a/tests/client/cert-expired/pd-server.pem b/tests/integrations/client/cert-expired/pd-server.pem similarity index 100% rename from tests/client/cert-expired/pd-server.pem rename to tests/integrations/client/cert-expired/pd-server.pem diff --git a/tests/client/cert/ca-config.json b/tests/integrations/client/cert/ca-config.json similarity index 100% rename from tests/client/cert/ca-config.json rename to tests/integrations/client/cert/ca-config.json diff --git a/tests/client/cert/ca-csr.json b/tests/integrations/client/cert/ca-csr.json similarity index 100% rename from tests/client/cert/ca-csr.json rename to tests/integrations/client/cert/ca-csr.json diff --git a/tests/client/cert/ca-key.pem b/tests/integrations/client/cert/ca-key.pem similarity index 100% rename from tests/client/cert/ca-key.pem rename to tests/integrations/client/cert/ca-key.pem diff --git a/tests/client/cert/ca.csr b/tests/integrations/client/cert/ca.csr similarity index 100% rename from tests/client/cert/ca.csr rename to tests/integrations/client/cert/ca.csr diff --git a/tests/client/cert/ca.pem b/tests/integrations/client/cert/ca.pem similarity index 100% rename from tests/client/cert/ca.pem rename to tests/integrations/client/cert/ca.pem diff --git a/tests/client/cert/client-key.pem b/tests/integrations/client/cert/client-key.pem similarity index 100% rename from tests/client/cert/client-key.pem rename to tests/integrations/client/cert/client-key.pem diff --git a/tests/client/cert/client.csr b/tests/integrations/client/cert/client.csr similarity index 100% rename from tests/client/cert/client.csr rename to tests/integrations/client/cert/client.csr diff --git a/tests/client/cert/client.pem b/tests/integrations/client/cert/client.pem similarity index 100% rename from tests/client/cert/client.pem rename to tests/integrations/client/cert/client.pem diff --git a/tests/client/cert/gencerts.sh b/tests/integrations/client/cert/gencerts.sh similarity index 100% rename from tests/client/cert/gencerts.sh rename to tests/integrations/client/cert/gencerts.sh diff --git a/tests/client/cert/pd-server-key.pem b/tests/integrations/client/cert/pd-server-key.pem similarity index 100% rename from tests/client/cert/pd-server-key.pem rename to tests/integrations/client/cert/pd-server-key.pem diff --git a/tests/client/cert/pd-server.csr b/tests/integrations/client/cert/pd-server.csr similarity index 100% rename from tests/client/cert/pd-server.csr rename to tests/integrations/client/cert/pd-server.csr diff --git a/tests/client/cert/pd-server.pem b/tests/integrations/client/cert/pd-server.pem similarity index 100% rename from tests/client/cert/pd-server.pem rename to tests/integrations/client/cert/pd-server.pem diff --git a/tests/client/client_test.go b/tests/integrations/client/client_test.go similarity index 100% rename from tests/client/client_test.go rename to tests/integrations/client/client_test.go diff --git a/tests/client/client_tls_test.go b/tests/integrations/client/client_tls_test.go similarity index 100% rename from tests/client/client_tls_test.go rename to tests/integrations/client/client_tls_test.go diff --git a/tests/client/global_config_test.go b/tests/integrations/client/global_config_test.go similarity index 100% rename from tests/client/global_config_test.go rename to tests/integrations/client/global_config_test.go diff --git a/tests/client/go.mod b/tests/integrations/client/go.mod similarity index 98% rename from tests/client/go.mod rename to tests/integrations/client/go.mod index 7e12db678e0..5a2d09be935 100644 --- a/tests/client/go.mod +++ b/tests/integrations/client/go.mod @@ -1,7 +1,15 @@ -module github.com/tikv/pd/tests/client +module github.com/tikv/pd/tests/integrations/client go 1.20 +replace ( + github.com/tikv/pd => ../../../ + github.com/tikv/pd/client => ../../../client +) + +// reset grpc and protobuf deps in order to import client and server at the same time +replace google.golang.org/grpc v1.51.0 => google.golang.org/grpc v1.26.0 + require ( github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00 github.com/pingcap/kvproto v0.0.0-20230317010544-b47a4830141f @@ -163,11 +171,3 @@ require ( moul.io/zapgorm2 v1.1.0 // indirect sigs.k8s.io/yaml v1.2.0 // indirect ) - -replace ( - github.com/tikv/pd => ../../ - github.com/tikv/pd/client => ../../client -) - -// reset grpc and protobuf deps in order to import client and server at the same time -replace google.golang.org/grpc v1.51.0 => google.golang.org/grpc v1.26.0 diff --git a/tests/client/go.sum b/tests/integrations/client/go.sum similarity index 100% rename from tests/client/go.sum rename to tests/integrations/client/go.sum diff --git a/tests/client/keyspace_test.go b/tests/integrations/client/keyspace_test.go similarity index 100% rename from tests/client/keyspace_test.go rename to tests/integrations/client/keyspace_test.go diff --git a/tests/mcs/Makefile b/tests/integrations/mcs/Makefile similarity index 64% rename from tests/mcs/Makefile rename to tests/integrations/mcs/Makefile index 86dc5f58bd2..8be9ad22429 100644 --- a/tests/mcs/Makefile +++ b/tests/integrations/mcs/Makefile @@ -12,34 +12,35 @@ # See the License for the specific language governing permissions and # limitations under the License. -GO_TOOLS_BIN_PATH := $(shell pwd)/../../.tools/bin +ROOT_PATH := ../../.. +GO_TOOLS_BIN_PATH := $(ROOT_PATH)/.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 . + @ revive -formatter friendly -config $(ROOT_PATH)/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 +test: failpoint-enable + CGO_ENABLED=1 go test ./... -v -tags deadlock -race -cover || { $(MAKE) failpoint-disable && exit 1; } + $(MAKE) failpoint-disable -ci-test-job: enable-codegen - CGO_ENABLED=1 go test ./... -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=../../... github.com/tikv/pd/tests/mcs +ci-test-job: + CGO_ENABLED=1 go test ./... -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=$(ROOT_PATH)/... github.com/tikv/pd/tests/integrations/mcs install-tools: - cd ../../ && $(MAKE) install-tools + cd $(ROOT_PATH) && $(MAKE) install-tools -enable-codegen: - cd ../../ && $(MAKE) failpoint-enable +failpoint-enable: + cd $(ROOT_PATH) && $(MAKE) failpoint-enable go mod tidy -disable-codegen: - cd ../../ && $(MAKE) failpoint-disable +failpoint-disable: + cd $(ROOT_PATH) && $(MAKE) failpoint-disable go mod tidy diff --git a/tests/mcs/discovery/register_test.go b/tests/integrations/mcs/discovery/register_test.go similarity index 99% rename from tests/mcs/discovery/register_test.go rename to tests/integrations/mcs/discovery/register_test.go index a658d5ef4e4..09d53289c03 100644 --- a/tests/mcs/discovery/register_test.go +++ b/tests/integrations/mcs/discovery/register_test.go @@ -25,7 +25,7 @@ import ( "github.com/tikv/pd/pkg/utils/tempurl" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/tests" - "github.com/tikv/pd/tests/mcs" + "github.com/tikv/pd/tests/integrations/mcs" "go.uber.org/goleak" ) diff --git a/tests/mcs/go.mod b/tests/integrations/mcs/go.mod similarity index 98% rename from tests/mcs/go.mod rename to tests/integrations/mcs/go.mod index d5eda55e6e5..cefac1b9797 100644 --- a/tests/mcs/go.mod +++ b/tests/integrations/mcs/go.mod @@ -1,7 +1,15 @@ -module github.com/tikv/pd/tests/mcs +module github.com/tikv/pd/tests/integrations/mcs go 1.20 +replace ( + github.com/tikv/pd => ../../../ + github.com/tikv/pd/client => ../../../client +) + +// reset grpc and protobuf deps in order to import client and server at the same time +replace google.golang.org/grpc v1.51.0 => google.golang.org/grpc v1.26.0 + require ( github.com/pingcap/failpoint v0.0.0-20210918120811-547c13e3eb00 github.com/pingcap/kvproto v0.0.0-20230317010544-b47a4830141f @@ -163,11 +171,3 @@ require ( moul.io/zapgorm2 v1.1.0 // indirect sigs.k8s.io/yaml v1.2.0 // indirect ) - -replace ( - github.com/tikv/pd => ../../ - github.com/tikv/pd/client => ../../client -) - -// reset grpc and protobuf deps in order to import client and server at the same time -replace google.golang.org/grpc v1.51.0 => google.golang.org/grpc v1.26.0 diff --git a/tests/mcs/go.sum b/tests/integrations/mcs/go.sum similarity index 100% rename from tests/mcs/go.sum rename to tests/integrations/mcs/go.sum diff --git a/tests/mcs/resource_manager/resource_manager_test.go b/tests/integrations/mcs/resource_manager/resource_manager_test.go similarity index 100% rename from tests/mcs/resource_manager/resource_manager_test.go rename to tests/integrations/mcs/resource_manager/resource_manager_test.go diff --git a/tests/mcs/resource_manager/server_test.go b/tests/integrations/mcs/resource_manager/server_test.go similarity index 98% rename from tests/mcs/resource_manager/server_test.go rename to tests/integrations/mcs/resource_manager/server_test.go index dbc2dcb400e..7547e5c009c 100644 --- a/tests/mcs/resource_manager/server_test.go +++ b/tests/integrations/mcs/resource_manager/server_test.go @@ -27,7 +27,7 @@ import ( "github.com/tikv/pd/client/grpcutil" "github.com/tikv/pd/pkg/utils/tempurl" "github.com/tikv/pd/tests" - "github.com/tikv/pd/tests/mcs" + "github.com/tikv/pd/tests/integrations/mcs" ) func TestResourceManagerServer(t *testing.T) { diff --git a/tests/mcs/testutil.go b/tests/integrations/mcs/testutil.go similarity index 100% rename from tests/mcs/testutil.go rename to tests/integrations/mcs/testutil.go diff --git a/tests/mcs/tso/server_test.go b/tests/integrations/mcs/tso/server_test.go similarity index 99% rename from tests/mcs/tso/server_test.go rename to tests/integrations/mcs/tso/server_test.go index 39a6265474e..882ef3db56a 100644 --- a/tests/mcs/tso/server_test.go +++ b/tests/integrations/mcs/tso/server_test.go @@ -36,7 +36,7 @@ import ( "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/utils/tsoutil" "github.com/tikv/pd/tests" - "github.com/tikv/pd/tests/mcs" + "github.com/tikv/pd/tests/integrations/mcs" "go.etcd.io/etcd/clientv3" "go.uber.org/goleak" "google.golang.org/grpc" diff --git a/tests/tso/Makefile b/tests/integrations/tso/Makefile similarity index 60% rename from tests/tso/Makefile rename to tests/integrations/tso/Makefile index 655cc0e62d1..820bbf33ccf 100644 --- a/tests/tso/Makefile +++ b/tests/integrations/tso/Makefile @@ -12,34 +12,35 @@ # See the License for the specific language governing permissions and # limitations under the License. -GO_TOOLS_BIN_PATH := $(shell pwd)/../../.tools/bin +ROOT_PATH := ../../.. +GO_TOOLS_BIN_PATH := $(ROOT_PATH)/.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 . + @ revive -formatter friendly -config $(ROOT_PATH)/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 +test: failpoint-enable + CGO_ENABLED=1 go test -v -tags deadlock -race -cover || { $(MAKE) failpoint-disable && exit 1; } + $(MAKE) failpoint-disable -ci-test-job: enable-codegen - CGO_ENABLED=1 go test ./... -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=../../... github.com/tikv/pd/tests/tso +ci-test-job: + CGO_ENABLED=1 go test -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=$(ROOT_PATH)/... github.com/tikv/pd/tests/integrations/tso install-tools: - cd ../../ && $(MAKE) install-tools + cd $(ROOT_PATH) && $(MAKE) install-tools -enable-codegen: - cd ../../ && $(MAKE) failpoint-enable +failpoint-enable: + cd $(ROOT_PATH) && $(MAKE) failpoint-enable go mod tidy -disable-codegen: - cd ../../ && $(MAKE) failpoint-disable +failpoint-disable: + cd $(ROOT_PATH) && $(MAKE) failpoint-disable go mod tidy diff --git a/tests/tso/client_test.go b/tests/integrations/tso/client_test.go similarity index 99% rename from tests/tso/client_test.go rename to tests/integrations/tso/client_test.go index 8e38e0fce1b..a79ed60b66d 100644 --- a/tests/tso/client_test.go +++ b/tests/integrations/tso/client_test.go @@ -29,7 +29,7 @@ import ( "github.com/tikv/pd/pkg/utils/tempurl" "github.com/tikv/pd/pkg/utils/tsoutil" "github.com/tikv/pd/tests" - "github.com/tikv/pd/tests/mcs" + "github.com/tikv/pd/tests/integrations/mcs" ) type tsoClientTestSuite struct { diff --git a/tests/tso/consistency_test.go b/tests/integrations/tso/consistency_test.go similarity index 99% rename from tests/tso/consistency_test.go rename to tests/integrations/tso/consistency_test.go index b4222ff6abb..70000d2abd4 100644 --- a/tests/tso/consistency_test.go +++ b/tests/integrations/tso/consistency_test.go @@ -30,7 +30,7 @@ import ( pd "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/utils/tsoutil" "github.com/tikv/pd/tests" - "github.com/tikv/pd/tests/mcs" + "github.com/tikv/pd/tests/integrations/mcs" "google.golang.org/grpc" ) diff --git a/tests/tso/go.mod b/tests/integrations/tso/go.mod similarity index 97% rename from tests/tso/go.mod rename to tests/integrations/tso/go.mod index e3bc0f9511c..b35bddd5e5c 100644 --- a/tests/tso/go.mod +++ b/tests/integrations/tso/go.mod @@ -1,11 +1,11 @@ -module github.com/tikv/pd/tests/tso +module github.com/tikv/pd/tests/integrations/tso go 1.20 replace ( - github.com/tikv/pd => ../../ - github.com/tikv/pd/client => ../../client - github.com/tikv/pd/tests/mcs => ../mcs + github.com/tikv/pd => ../../../ + github.com/tikv/pd/client => ../../../client + github.com/tikv/pd/tests/integrations/mcs => ../mcs ) // reset grpc and protobuf deps in order to import client and server at the same time @@ -17,7 +17,7 @@ require ( github.com/stretchr/testify v1.8.2 github.com/tikv/pd v0.0.0-00010101000000-000000000000 github.com/tikv/pd/client v0.0.0-00010101000000-000000000000 - github.com/tikv/pd/tests/mcs v0.0.0-20230320064440-220dbed05897 + github.com/tikv/pd/tests/integrations/mcs v0.0.0-00010101000000-000000000000 google.golang.org/grpc v1.51.0 ) diff --git a/tests/tso/go.sum b/tests/integrations/tso/go.sum similarity index 100% rename from tests/tso/go.sum rename to tests/integrations/tso/go.sum diff --git a/tests/tso/server_test.go b/tests/integrations/tso/server_test.go similarity index 99% rename from tests/tso/server_test.go rename to tests/integrations/tso/server_test.go index 3b33253a424..1a73db2ff43 100644 --- a/tests/tso/server_test.go +++ b/tests/integrations/tso/server_test.go @@ -28,7 +28,7 @@ import ( "github.com/tikv/pd/pkg/utils/tempurl" pd "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/tests" - "github.com/tikv/pd/tests/mcs" + "github.com/tikv/pd/tests/integrations/mcs" "google.golang.org/grpc" ) diff --git a/tests/tso/testutil.go b/tests/integrations/tso/testutil.go similarity index 100% rename from tests/tso/testutil.go rename to tests/integrations/tso/testutil.go