diff --git a/tests/integrations/realcluster/real_cluster.go b/tests/integrations/realcluster/real_cluster.go index 99eca006954..21284f285b0 100644 --- a/tests/integrations/realcluster/real_cluster.go +++ b/tests/integrations/realcluster/real_cluster.go @@ -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() { @@ -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") { @@ -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)