Provide new pkgs/utils for generic functions

This commit is contained in:
Harshavardhana 2014-12-13 01:14:36 -08:00
parent fb1537248b
commit 20d46a1977
5 changed files with 14 additions and 23 deletions

View File

@ -8,7 +8,7 @@ import (
"strings"
"github.com/gorilla/mux"
"github.com/minio-io/minio/pkgs/miniotest"
"github.com/minio-io/minio/pkgs/utils"
. "gopkg.in/check.v1"
)
@ -104,9 +104,9 @@ func (s *GatewaySuite) TestBucketCreation(c *C) {
}
func (s *GatewaySuite) TestInMemoryBucketOperations(c *C) {
simpleFileStorageRootDir, err1 := miniotest.MakeTempTestDir()
simpleFileStorageRootDir, err1 := utils.MakeTempTestDir()
c.Assert(err1, IsNil)
simpleEncodedStorageRootDir, err2 := miniotest.MakeTempTestDir()
simpleEncodedStorageRootDir, err2 := utils.MakeTempTestDir()
c.Assert(err2, IsNil)
defer os.RemoveAll(simpleFileStorageRootDir)
defer os.RemoveAll(simpleEncodedStorageRootDir)

View File

@ -7,6 +7,7 @@ import (
"testing"
"github.com/minio-io/minio/pkgs/storage"
"github.com/minio-io/minio/pkgs/utils"
. "gopkg.in/check.v1"
)
@ -16,12 +17,8 @@ var _ = Suite(&AppendStorageSuite{})
func Test(t *testing.T) { TestingT(t) }
func makeTempTestDir() (string, error) {
return ioutil.TempDir("/tmp", "minio-test-")
}
func (s *AppendStorageSuite) TestAppendStoragePutAtRootPath(c *C) {
rootDir, err := makeTempTestDir()
rootDir, err := utils.MakeTempTestDir()
c.Assert(err, IsNil)
defer os.RemoveAll(rootDir)
@ -54,7 +51,7 @@ func (s *AppendStorageSuite) TestAppendStoragePutAtRootPath(c *C) {
}
func (s *AppendStorageSuite) TestAppendStoragePutDirPath(c *C) {
rootDir, err := makeTempTestDir()
rootDir, err := utils.MakeTempTestDir()
c.Assert(err, IsNil)
defer os.RemoveAll(rootDir)
@ -82,7 +79,7 @@ func (s *AppendStorageSuite) TestAppendStoragePutDirPath(c *C) {
}
func (s *AppendStorageSuite) TestSerialization(c *C) {
rootDir, err := makeTempTestDir()
rootDir, err := utils.MakeTempTestDir()
c.Assert(err, IsNil)
defer os.RemoveAll(rootDir)

View File

@ -8,6 +8,7 @@ import (
"testing"
"github.com/minio-io/minio/pkgs/storage"
"github.com/minio-io/minio/pkgs/utils"
. "gopkg.in/check.v1"
)
@ -17,12 +18,8 @@ var _ = Suite(&EncodedStorageSuite{})
func Test(t *testing.T) { TestingT(t) }
func makeTempTestDir() (string, error) {
return ioutil.TempDir("/tmp", "minio-test-")
}
func (s *EncodedStorageSuite) TestFileStoragePutAtRootPath(c *C) {
rootDir, err := makeTempTestDir()
rootDir, err := utils.MakeTempTestDir()
c.Assert(err, IsNil)
defer os.RemoveAll(rootDir)
@ -44,7 +41,7 @@ func (s *EncodedStorageSuite) TestFileStoragePutAtRootPath(c *C) {
}
func (s *EncodedStorageSuite) TestFileStoragePutDirPath(c *C) {
rootDir, err := makeTempTestDir()
rootDir, err := utils.MakeTempTestDir()
c.Assert(err, IsNil)
defer os.RemoveAll(rootDir)
@ -73,7 +70,7 @@ func (s *EncodedStorageSuite) TestFileStoragePutDirPath(c *C) {
}
func (s *EncodedStorageSuite) TestObjectWithChunking(c *C) {
rootDir, err := makeTempTestDir()
rootDir, err := utils.MakeTempTestDir()
c.Assert(err, IsNil)
defer os.RemoveAll(rootDir)

View File

@ -7,6 +7,7 @@ import (
"testing"
"github.com/minio-io/minio/pkgs/storage"
"github.com/minio-io/minio/pkgs/utils"
. "gopkg.in/check.v1"
)
@ -16,12 +17,8 @@ var _ = Suite(&fileSystemStorageSuite{})
func Test(t *testing.T) { TestingT(t) }
func makeTempTestDir() (string, error) {
return ioutil.TempDir("/tmp", "minio-test-")
}
func (s *fileSystemStorageSuite) TestfileStoragePutAtRootPath(c *C) {
rootDir, err := makeTempTestDir()
rootDir, err := utils.MakeTempTestDir()
c.Assert(err, IsNil)
defer os.RemoveAll(rootDir)

View File

@ -1,4 +1,4 @@
package miniotest
package utils
import "io/ioutil"