Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tikv/pd into real-cluster…
Browse files Browse the repository at this point in the history
…-test-2

Signed-off-by: okJiang <[email protected]>
  • Loading branch information
okJiang committed Oct 21, 2024
2 parents 42f29b5 + 003def6 commit 8e7a450
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/integrations/realcluster/real_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,18 @@ type realClusterSuite struct {
suiteName string
}

var tiupBin = os.Getenv("HOME") + "/.tiup/bin/tiup"
var (
playgroundLogDir = filepath.Join("tmp", "real_cluster", "playground")
tiupBin string
)

func init() {
var err error
tiupBin, err = exec.LookPath("tiup")
if err != nil {
panic(err)
}
}

// SetupSuite will run before the tests in the suite are run.
func (s *realClusterSuite) SetupSuite() {
Expand Down Expand Up @@ -111,8 +122,6 @@ func destroy(t *testing.T, tag string) {
func deployTiupPlayground(t *testing.T, tag string) {
curPath, err := os.Getwd()
require.NoError(t, err)

log.Info(curPath)
require.NoError(t, os.Chdir("../../.."))

if !fileExists("third_bin") || !fileExists("third_bin/tikv-server") || !fileExists("third_bin/tidb-server") || !fileExists("third_bin/tiflash") {
Expand All @@ -125,8 +134,9 @@ func deployTiupPlayground(t *testing.T, tag string) {
log.Info("complie pd binaries...")
require.NoError(t, runCommand("make", "pd-server"))
}
if !fileExists(filepath.Join(curPath, "playground")) {
require.NoError(t, os.Mkdir(filepath.Join(curPath, "playground"), 0755))

if !fileExists(playgroundLogDir) {
require.NoError(t, os.MkdirAll(playgroundLogDir, 0755))
}
// nolint:errcheck
go func() {
Expand All @@ -135,8 +145,10 @@ func deployTiupPlayground(t *testing.T, tag string) {
--without-monitor --tag `+tag+` --pd.binpath ./bin/pd-server \
--kv.binpath ./third_bin/tikv-server \
--db.binpath ./third_bin/tidb-server --tiflash.binpath ./third_bin/tiflash \
> `+filepath.Join(curPath, "playground", tag+".log")+` 2>&1 & `)
--pd.config ./tests/integrations/realcluster/pd.toml \
> `+filepath.Join(playgroundLogDir, tag+".log")+` 2>&1 & `)
}()

// Avoid to change the dir before execute `tiup playground`.
time.Sleep(10 * time.Second)
require.NoError(t, os.Chdir(curPath))
Expand Down

0 comments on commit 8e7a450

Please sign in to comment.