From 8da8967badae48a3f69e6d0a0cda9858417fc62e Mon Sep 17 00:00:00 2001 From: husharp Date: Mon, 10 Jul 2023 15:29:40 +0800 Subject: [PATCH] test ci Signed-off-by: husharp --- client/Makefile | 6 +++--- .../resource_group/controller/limiter_test.go | 10 +++++++++- .../resource_group/controller/model_test.go | 20 ------------------- tests/integrations/tso/Makefile | 4 ++-- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/client/Makefile b/client/Makefile index b55b6fc8d9d..2916ed444a2 100644 --- a/client/Makefile +++ b/client/Makefile @@ -19,13 +19,13 @@ SHELL := env PATH='$(PATH)' GOBIN='$(GO_TOOLS_BIN_PATH)' $(shell which bash) default: static tidy test test: - CGO_ENABLE=1 go test -race -cover + CGO_ENABLE=1 go test ./... -race -cover basic-test: - CGO_ENABLE=1 go test + CGO_ENABLE=1 go test ./... ci-test-job: - CGO_ENABLED=1 go test -race -covermode=atomic -coverprofile=covprofile -coverpkg=../... github.com/tikv/pd/client + CGO_ENABLED=1 go test ./... -race -covermode=atomic -coverprofile=covprofile -coverpkg=../... github.com/tikv/pd/client install-tools: cd .. && $(MAKE) install-tools diff --git a/client/resource_group/controller/limiter_test.go b/client/resource_group/controller/limiter_test.go index 2e05f66ab67..b8b96ae13d6 100644 --- a/client/resource_group/controller/limiter_test.go +++ b/client/resource_group/controller/limiter_test.go @@ -109,11 +109,19 @@ func TestReconfig(t *testing.T) { args := tokenBucketReconfigureArgs{ NewTokens: 6., NewRate: 2, - NewBurst: -1, } lim.Reconfigure(t1, args) checkTokens(re, lim, t1, 5) checkTokens(re, lim, t2, 7) + + args = tokenBucketReconfigureArgs{ + NewTokens: 6., + NewRate: 2, + NewBurst: -1, + } + lim.Reconfigure(t1, args) + checkTokens(re, lim, t1, 6) + checkTokens(re, lim, t2, 6) re.Equal(int64(-1), lim.GetBurst()) } diff --git a/client/resource_group/controller/model_test.go b/client/resource_group/controller/model_test.go index 94007485520..594091da364 100644 --- a/client/resource_group/controller/model_test.go +++ b/client/resource_group/controller/model_test.go @@ -37,14 +37,6 @@ func TestGetRUValueFromConsumption(t *testing.T) { result = getRUValueFromConsumption(custom, typ) re.Equal(expected, result) - - // When typ is not RU - custom = &rmpb.Consumption{RRU: 2.5, WRU: 3.5} - typ = rmpb.RequestUnitType_RU - expected = float64(0) - - result = getRUValueFromConsumption(custom, typ) - re.Equal(expected, result) } func TestGetRUTokenBucketSetting(t *testing.T) { @@ -69,18 +61,6 @@ func TestGetRUTokenBucketSetting(t *testing.T) { if result != expected { t.Errorf("Expected nil but got %v", result) } - - // When typ is not RU - group = &rmpb.ResourceGroup{ - RUSettings: &rmpb.GroupRequestUnitSettings{ - RU: &rmpb.TokenBucket{Settings: &rmpb.TokenLimitSettings{FillRate: 100}}, - }, - } - typ = rmpb.RequestUnitType_RU - expected = nil - - result = getRUTokenBucketSetting(group, typ) - re.Equal(expected, result) } func TestGetRawResourceValueFromConsumption(t *testing.T) { diff --git a/tests/integrations/tso/Makefile b/tests/integrations/tso/Makefile index 4573863039c..38f5cfa164a 100644 --- a/tests/integrations/tso/Makefile +++ b/tests/integrations/tso/Makefile @@ -28,11 +28,11 @@ tidy: git diff --quiet go.mod go.sum test: failpoint-enable - CGO_ENABLED=1 go test -v -tags deadlock -race -cover || { $(MAKE) failpoint-disable && exit 1; } + CGO_ENABLED=1 go test ./... -v -tags deadlock -race -cover || { $(MAKE) failpoint-disable && exit 1; } $(MAKE) failpoint-disable ci-test-job: - CGO_ENABLED=1 go test -v -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=$(ROOT_PATH)/... github.com/tikv/pd/tests/integrations/tso + CGO_ENABLED=1 go test ./... -v -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=$(ROOT_PATH)/... github.com/tikv/pd/tests/integrations/tso install-tools: cd $(ROOT_PATH) && $(MAKE) install-tools