Enable filesystem for API tests, this patch also implements ListMultipartUploads()

This commit is contained in:
Harshavardhana
2015-06-01 20:17:01 -07:00
parent bf36fcb6f7
commit 097f70a3c5
4 changed files with 210 additions and 74 deletions

View File

@@ -35,6 +35,7 @@ import (
"github.com/minio/minio/pkg/featureflags"
"github.com/minio/minio/pkg/storage/drivers"
"github.com/minio/minio/pkg/storage/drivers/donut"
"github.com/minio/minio/pkg/storage/drivers/fs"
"github.com/minio/minio/pkg/storage/drivers/memory"
"github.com/minio/minio/pkg/storage/drivers/mocks"
"github.com/stretchr/testify/mock"
@@ -74,6 +75,14 @@ var _ = Suite(&MySuite{
},
})
var _ = Suite(&MySuite{
initDriver: func() (drivers.Driver, string) {
root, _ := ioutil.TempDir(os.TempDir(), "minio-fs-api")
_, _, driver := filesystem.Start(root)
return driver, root
},
})
func (s *MySuite) SetUpSuite(c *C) {
driver, root := s.initDriver()
if root != "" {
@@ -1440,9 +1449,7 @@ func (s *MySuite) TestObjectMultipartAbort(c *C) {
default:
// Donut doesn't have multipart support yet
{
if reflect.TypeOf(driver).String() == "*memory.memoryDriver" {
} else {
if reflect.TypeOf(driver).String() == "*donut.donutDriver" {
return
}
}
@@ -1517,7 +1524,7 @@ func (s *MySuite) TestObjectMultipartAbort(c *C) {
c.Assert(response3.StatusCode, Equals, http.StatusNoContent)
}
func (s *MySuite) TestBuckeMultipartList(c *C) {
func (s *MySuite) TestBucketMultipartList(c *C) {
switch driver := s.Driver.(type) {
case *mocks.Driver:
{
@@ -1526,9 +1533,7 @@ func (s *MySuite) TestBuckeMultipartList(c *C) {
default:
// Donut doesn't have multipart support yet
{
if reflect.TypeOf(driver).String() == "*memory.memoryDriver" {
} else {
if reflect.TypeOf(driver).String() == "*donut.donutDriver" {
return
}
}
@@ -1601,6 +1606,12 @@ func (s *MySuite) TestBuckeMultipartList(c *C) {
response3, err := client.Do(request)
c.Assert(err, IsNil)
c.Assert(response3.StatusCode, Equals, http.StatusOK)
decoder = xml.NewDecoder(response3.Body)
newResponse3 := &ListMultipartUploadsResponse{}
err = decoder.Decode(newResponse3)
c.Assert(err, IsNil)
c.Assert(newResponse3.Bucket, Equals, "foo")
}
func (s *MySuite) TestObjectMultipartList(c *C) {
@@ -1612,9 +1623,7 @@ func (s *MySuite) TestObjectMultipartList(c *C) {
default:
// Donut doesn't have multipart support yet
{
if reflect.TypeOf(driver).String() == "*memory.memoryDriver" {
} else {
if reflect.TypeOf(driver).String() == "*donut.donutDriver" {
return
}
}
@@ -1699,9 +1708,7 @@ func (s *MySuite) TestObjectMultipart(c *C) {
default:
// Donut doesn't have multipart support yet
{
if reflect.TypeOf(driver).String() == "*memory.memoryDriver" {
} else {
if reflect.TypeOf(driver).String() == "*donut.donutDriver" {
return
}
}