Provide new pkgs/utils for generic functions

master
Harshavardhana 10 years ago
parent fb1537248b
commit 20d46a1977
  1. 6
      pkgs/gateway/gateway_test.go
  2. 11
      pkgs/storage/appendstorage/append_storage_test.go
  3. 11
      pkgs/storage/encodedstorage/encoded_storage_test.go
  4. 7
      pkgs/storage/fsstorage/fs_storage_test.go
  5. 2
      pkgs/utils/helpers.go

@ -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)

@ -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)

@ -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)

@ -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)

@ -1,4 +1,4 @@
package miniotest
package utils
import "io/ioutil"
Loading…
Cancel
Save