From 53e75d316f6a38e333aa7c9251d65d92889b3b75 Mon Sep 17 00:00:00 2001 From: luancheng Date: Tue, 28 Jul 2020 11:45:57 +0800 Subject: [PATCH] address comment --- session/session_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/session/session_test.go b/session/session_test.go index 12c26900ab655..71ed2280532fb 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -18,6 +18,7 @@ import ( "flag" "fmt" "os" + "path" "strings" "sync" "sync/atomic" @@ -3243,14 +3244,16 @@ func (s *testBackupRestoreSuite) TestBackupAndRestore(c *C) { tk.MustQuery("select count(*) from t1").Check(testkit.Rows("3")) - os.RemoveAll("/tmp/bk1") - // backup database - tk.MustQuery("backup database br to 'local:///tmp/bk1'") - // remove database + tmpDir := path.Join(os.TempDir(), "bk1") + os.RemoveAll(tmpDir) + // backup database to tmp dir + tk.MustQuery("backup database br to 'local://" + tmpDir + "'") + + // remove database for recovery tk.MustExec("drop database br") // restore database with backup data - tk.MustQuery("restore database br from 'local:///tmp/bk1'") + tk.MustQuery("restore database br from 'local://" + tmpDir + "'") tk.MustExec("use br") tk.MustQuery("select count(*) from t1").Check(testkit.Rows("3")) tk.MustExec("drop database br")