Skip to content

Commit

Permalink
realclustertest: update binary dir (#8731)
Browse files Browse the repository at this point in the history
ref #8683

Signed-off-by: okJiang <[email protected]>
  • Loading branch information
okJiang authored Oct 21, 2024
1 parent e01a7dd commit 003def6
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions tests/integrations/realcluster/real_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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 @@ -115,8 +126,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 @@ -129,19 +138,20 @@ 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 runCommand("sh", "-c",
tiupBin+` playground nightly --kv 3 --tiflash 1 --db 1 --pd 3 \
go func() {
runCommand("sh", "-c",
tiupBin+` playground nightly --kv 3 --tiflash 1 --db 1 --pd 3 \
--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 \
--kv.binpath ./bin/tikv-server \
--db.binpath ./bin/tidb-server --tiflash.binpath ./bin/tiflash \
--kv.binpath ./third_bin/tikv-server \
--db.binpath ./third_bin/tidb-server --tiflash.binpath ./third_bin/tiflash \
--pd.config ./tests/integrations/realcluster/pd.toml \
> `+filepath.Join(curPath, "playground", tag+".log")+` 2>&1 & `)
> `+filepath.Join(playgroundLogDir, tag+".log")+` 2>&1 & `)
}()

// Avoid to change the dir before execute `tiup playground`.
time.Sleep(10 * time.Second)
Expand Down

0 comments on commit 003def6

Please sign in to comment.