tests: Use testTmpDir var to specify tmp directory (#3459)

To be able to specify the directory where tests will be done.  This way,
it will be easier to run Minio tests on a mounted directory like NFS, ..
This commit is contained in:
Anis Elleuch
2016-12-16 07:25:05 +01:00
committed by Harshavardhana
parent 0db484c8f6
commit 8ceb969445
12 changed files with 43 additions and 45 deletions

View File

@@ -133,6 +133,9 @@ const (
var randN uint32
var randmu sync.Mutex
// Temp files created in default Tmp dir
var globalTestTmpDir = os.TempDir()
// reseed - returns a new seed every time the function is called.
func reseed() uint32 {
return uint32(time.Now().UnixNano() + int64(os.Getpid()))
@@ -1572,14 +1575,14 @@ func getListenBucketNotificationURL(endPoint, bucketName string, prefixes, suffi
// returns temp root directory. `
func getTestRoot() (string, error) {
return ioutil.TempDir(os.TempDir(), "api-")
return ioutil.TempDir(globalTestTmpDir, "api-")
}
// getRandomDisks - Creates a slice of N random disks, each of the form - minio-XXX
func getRandomDisks(N int) ([]string, error) {
var erasureDisks []string
for i := 0; i < N; i++ {
path, err := ioutil.TempDir(os.TempDir(), "minio-")
path, err := ioutil.TempDir(globalTestTmpDir, "minio-")
if err != nil {
// Remove directories created so far.
removeRoots(erasureDisks)