-
Notifications
You must be signed in to change notification settings - Fork 720
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: husharp <[email protected]>
- Loading branch information
Showing
22 changed files
with
501 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: PD Real Test | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- release-* | ||
pull_request: | ||
branches: | ||
- master | ||
- release-* | ||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
jobs: | ||
real-cluster: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.21' | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Restore cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
**/.tools | ||
**/.dashboard_download_cache | ||
key: ${{ runner.os }}-go-${{ matrix.worker_id }}-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Test | ||
run: make check | ||
working-directory: tests/integrations/real |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# 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. | ||
|
||
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) | ||
|
||
check: static deploy test clean | ||
|
||
static: install-tools | ||
@ echo "gofmt ..." | ||
@ gofmt -s -l -d . 2>&1 | awk '{ print } END { if (NR > 0) { exit 1 } }' | ||
@ echo "golangci-lint ..." | ||
@ golangci-lint run -c $(ROOT_PATH)/.golangci.yml --verbose ./... --allow-parallel-runners | ||
@ echo "revive ..." | ||
@ 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 | ||
|
||
deploy: clean | ||
echo "deploying..." | ||
./deploy.sh | ||
echo "wait tiup cluster ready..." | ||
./wait_tiup.sh 15 20 | ||
echo "check cluster status..." | ||
pid=$$(ps -ef | grep 'tiup' | grep -v grep | awk '{print $$2}' | head -n 1); \ | ||
echo $$pid; | ||
lsof -i:4000 | ||
|
||
test: | ||
CGO_ENABLED=1 go test ./... -v -tags deadlock -race -cover || { exit 1; } | ||
|
||
clean: | ||
pid=$$(ps -ef | grep 'tiup' | grep -v grep | awk '{print $$2}' | head -n 1); \ | ||
if [ ! -z "$$pid" ]; then \ | ||
echo $$pid; \ | ||
kill $$pid; \ | ||
fi | ||
rm -rf playground.log | ||
|
||
install-tools: | ||
cd $(ROOT_PATH) && $(MAKE) install-tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2023 TiKV 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. | ||
|
||
package real | ||
|
||
import ( | ||
flag "github.com/spf13/pflag" | ||
"github.com/stretchr/testify/suite" | ||
"testing" | ||
) | ||
|
||
var ( | ||
withTiKV = flag.Bool("with-tikv", false, "run tests with TiKV cluster started. (not use the mock server)") | ||
// pdAddrs = flag.String("pd-addrs", "127.0.0.1:2379", "pd addrs") | ||
) | ||
|
||
func TestPDAPI(t *testing.T) { | ||
if !*withTiKV { | ||
t.Skip("skipping TestPDAPI because with-tikv is not enabled") | ||
} | ||
suite.Run(t, new(apiTestSuite)) | ||
} | ||
|
||
type apiTestSuite struct { | ||
suite.Suite | ||
} | ||
|
||
func (s *apiTestSuite) SetupTest() { | ||
// addrs := strings.Split(*pdAddrs, ",") | ||
// pdClient, err := pd.NewClient(addrs, pd.SecurityOption{}) | ||
|
||
} | ||
|
||
func (s *apiTestSuite) TestGetStoresMinResolvedTS() { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
TIUP_BIN_DIR=$HOME/.tiup/bin/tiup | ||
|
||
make clean | ||
cd ../../../ | ||
rm -rf bin | ||
make pd-server-basic | ||
|
||
# Install TiUP | ||
echo "install tiup" | ||
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh | ||
$TIUP_BIN_DIR update playground | ||
|
||
# Run TiUP | ||
#tiup playground nightly --kv 3 --tiflash 0 --db 3 --without-monitor --pd.binpath ./bin/pd-server | ||
$TIUP_BIN_DIR playground nightly --kv 3 --tiflash 0 --db 1 --without-monitor --pd.binpath ./bin/pd-server > ./tests/integrations/real/playground.log 2>&1 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module github.com/tikv/pd/tests/integrations/real | ||
|
||
go 1.21 | ||
|
||
require ( | ||
github.com/DATA-DOG/go-sqlmock v1.5.0 | ||
github.com/go-sql-driver/mysql v1.7.1 | ||
github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 | ||
github.com/spf13/pflag v1.0.5 | ||
github.com/stretchr/testify v1.8.4 | ||
gorm.io/driver/mysql v1.5.2 | ||
gorm.io/gorm v1.25.5 | ||
moul.io/zapgorm2 v1.3.0 | ||
) | ||
|
||
require ( | ||
github.com/benbjohnson/clock v1.3.0 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/jinzhu/inflection v1.0.0 // indirect | ||
github.com/jinzhu/now v1.1.5 // indirect | ||
github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
go.uber.org/atomic v1.10.0 // indirect | ||
go.uber.org/multierr v1.11.0 // indirect | ||
go.uber.org/zap v1.24.0 // indirect | ||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect | ||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.