|
|
@ -10,9 +10,9 @@ import ( |
|
|
|
. "gopkg.in/check.v1" |
|
|
|
. "gopkg.in/check.v1" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
type FileSystemStorageSuite struct{} |
|
|
|
type fileSystemStorageSuite struct{} |
|
|
|
|
|
|
|
|
|
|
|
var _ = Suite(&FileSystemStorageSuite{}) |
|
|
|
var _ = Suite(&fileSystemStorageSuite{}) |
|
|
|
|
|
|
|
|
|
|
|
func Test(t *testing.T) { TestingT(t) } |
|
|
|
func Test(t *testing.T) { TestingT(t) } |
|
|
|
|
|
|
|
|
|
|
@ -20,15 +20,13 @@ func makeTempTestDir() (string, error) { |
|
|
|
return ioutil.TempDir("/tmp", "minio-test-") |
|
|
|
return ioutil.TempDir("/tmp", "minio-test-") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (s *FileSystemStorageSuite) TestFileStoragePutAtRootPath(c *C) { |
|
|
|
func (s *fileSystemStorageSuite) TestfileStoragePutAtRootPath(c *C) { |
|
|
|
rootDir, err := makeTempTestDir() |
|
|
|
rootDir, err := makeTempTestDir() |
|
|
|
c.Assert(err, IsNil) |
|
|
|
c.Assert(err, IsNil) |
|
|
|
defer os.RemoveAll(rootDir) |
|
|
|
defer os.RemoveAll(rootDir) |
|
|
|
|
|
|
|
|
|
|
|
var objectStorage storage.ObjectStorage |
|
|
|
var objectStorage storage.ObjectStorage |
|
|
|
objectStorage = FileSystemStorage{ |
|
|
|
objectStorage, _ = NewStorage(rootDir) |
|
|
|
RootDir: rootDir, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
objectBuffer := bytes.NewBuffer([]byte("object1")) |
|
|
|
objectBuffer := bytes.NewBuffer([]byte("object1")) |
|
|
|
objectStorage.Put("path1", objectBuffer) |
|
|
|
objectStorage.Put("path1", objectBuffer) |
|
|
@ -44,15 +42,13 @@ func (s *FileSystemStorageSuite) TestFileStoragePutAtRootPath(c *C) { |
|
|
|
c.Assert(objectList[0].Path, Equals, "path1") |
|
|
|
c.Assert(objectList[0].Path, Equals, "path1") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (s *FileSystemStorageSuite) TestFileStoragePutDirPath(c *C) { |
|
|
|
func (s *fileSystemStorageSuite) TestfileStoragePutDirPath(c *C) { |
|
|
|
rootDir, err := makeTempTestDir() |
|
|
|
rootDir, err := makeTempTestDir() |
|
|
|
c.Assert(err, IsNil) |
|
|
|
c.Assert(err, IsNil) |
|
|
|
defer os.RemoveAll(rootDir) |
|
|
|
defer os.RemoveAll(rootDir) |
|
|
|
|
|
|
|
|
|
|
|
var objectStorage storage.ObjectStorage |
|
|
|
var objectStorage storage.ObjectStorage |
|
|
|
objectStorage = FileSystemStorage{ |
|
|
|
objectStorage, _ = NewStorage(rootDir) |
|
|
|
RootDir: rootDir, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
objectBuffer1 := bytes.NewBuffer([]byte("object1")) |
|
|
|
objectBuffer1 := bytes.NewBuffer([]byte("object1")) |
|
|
|
objectStorage.Put("path1/path2/path3", objectBuffer1) |
|
|
|
objectStorage.Put("path1/path2/path3", objectBuffer1) |
|
|
|