cleanup object-lock/bucket tagging for gateways (#9548)

This PR is to ensure that we call the relevant object
layer APIs for necessary S3 API level functionalities
allowing gateway implementations to return proper
errors as NotImplemented{}

This allows for all our tests in mint to behave
appropriately and can be handled appropriately as
well.
This commit is contained in:
Harshavardhana
2020-05-08 13:44:44 -07:00
committed by GitHub
parent 6885c72f32
commit a1de9cec58
49 changed files with 681 additions and 375 deletions
+18 -18
View File
@@ -77,7 +77,7 @@ func (s *ObjectLayerAPISuite) TestMakeBucket(t *testing.T) {
// Tests validate bucket creation.
func testMakeBucket(obj ObjectLayer, instanceType string, t TestErrHandler) {
err := obj.MakeBucketWithLocation(context.Background(), "bucket-unknown", "")
err := obj.MakeBucketWithLocation(context.Background(), "bucket-unknown", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -91,7 +91,7 @@ func (s *ObjectLayerAPISuite) TestMultipartObjectCreation(t *testing.T) {
// Tests validate creation of part files during Multipart operation.
func testMultipartObjectCreation(obj ObjectLayer, instanceType string, t TestErrHandler) {
var opts ObjectOptions
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "")
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -135,7 +135,7 @@ func (s *ObjectLayerAPISuite) TestMultipartObjectAbort(t *testing.T) {
// Tests validate abortion of Multipart operation.
func testMultipartObjectAbort(obj ObjectLayer, instanceType string, t TestErrHandler) {
var opts ObjectOptions
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "")
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -181,7 +181,7 @@ func (s *ObjectLayerAPISuite) TestMultipleObjectCreation(t *testing.T) {
func testMultipleObjectCreation(obj ObjectLayer, instanceType string, t TestErrHandler) {
objects := make(map[string][]byte)
var opts ObjectOptions
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "")
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -236,7 +236,7 @@ func (s *ObjectLayerAPISuite) TestPaging(t *testing.T) {
// Tests validate creation of objects and the order of listing using various filters for ListObjects operation.
func testPaging(obj ObjectLayer, instanceType string, t TestErrHandler) {
obj.MakeBucketWithLocation(context.Background(), "bucket", "")
obj.MakeBucketWithLocation(context.Background(), "bucket", "", false)
result, err := obj.ListObjects(context.Background(), "bucket", "", "", "", 0)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
@@ -440,7 +440,7 @@ func (s *ObjectLayerAPISuite) TestObjectOverwriteWorks(t *testing.T) {
// Tests validate overwriting of an existing object.
func testObjectOverwriteWorks(obj ObjectLayer, instanceType string, t TestErrHandler) {
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "")
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -494,11 +494,11 @@ func (s *ObjectLayerAPISuite) TestBucketRecreateFails(t *testing.T) {
// Tests validate that recreation of the bucket fails.
func testBucketRecreateFails(obj ObjectLayer, instanceType string, t TestErrHandler) {
err := obj.MakeBucketWithLocation(context.Background(), "string", "")
err := obj.MakeBucketWithLocation(context.Background(), "string", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
err = obj.MakeBucketWithLocation(context.Background(), "string", "")
err = obj.MakeBucketWithLocation(context.Background(), "string", "", false)
if err == nil {
t.Fatalf("%s: Expected error but found nil.", instanceType)
}
@@ -519,7 +519,7 @@ func testPutObject(obj ObjectLayer, instanceType string, t TestErrHandler) {
length := int64(len(content))
readerEOF := newTestReaderEOF(content)
readerNoEOF := newTestReaderNoEOF(content)
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "")
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -559,7 +559,7 @@ func (s *ObjectLayerAPISuite) TestPutObjectInSubdir(t *testing.T) {
// Tests validate PutObject with subdirectory prefix.
func testPutObjectInSubdir(obj ObjectLayer, instanceType string, t TestErrHandler) {
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "")
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -601,7 +601,7 @@ func testListBuckets(obj ObjectLayer, instanceType string, t TestErrHandler) {
}
// add one and test exists.
err = obj.MakeBucketWithLocation(context.Background(), "bucket1", "")
err = obj.MakeBucketWithLocation(context.Background(), "bucket1", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -615,7 +615,7 @@ func testListBuckets(obj ObjectLayer, instanceType string, t TestErrHandler) {
}
// add two and test exists.
err = obj.MakeBucketWithLocation(context.Background(), "bucket2", "")
err = obj.MakeBucketWithLocation(context.Background(), "bucket2", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -629,7 +629,7 @@ func testListBuckets(obj ObjectLayer, instanceType string, t TestErrHandler) {
}
// add three and test exists + prefix.
err = obj.MakeBucketWithLocation(context.Background(), "bucket22", "")
err = obj.MakeBucketWithLocation(context.Background(), "bucket22", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -653,11 +653,11 @@ func testListBucketsOrder(obj ObjectLayer, instanceType string, t TestErrHandler
// if implementation contains a map, order of map keys will vary.
// this ensures they return in the same order each time.
// add one and test exists.
err := obj.MakeBucketWithLocation(context.Background(), "bucket1", "")
err := obj.MakeBucketWithLocation(context.Background(), "bucket1", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
err = obj.MakeBucketWithLocation(context.Background(), "bucket2", "")
err = obj.MakeBucketWithLocation(context.Background(), "bucket2", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -706,7 +706,7 @@ func (s *ObjectLayerAPISuite) TestNonExistantObjectInBucket(t *testing.T) {
// Tests validate that GetObject fails on a non-existent bucket as expected.
func testNonExistantObjectInBucket(obj ObjectLayer, instanceType string, t TestErrHandler) {
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "")
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -734,7 +734,7 @@ func (s *ObjectLayerAPISuite) TestGetDirectoryReturnsObjectNotFound(t *testing.T
// Tests validate that GetObject on an existing directory fails as expected.
func testGetDirectoryReturnsObjectNotFound(obj ObjectLayer, instanceType string, t TestErrHandler) {
bucketName := "bucket"
err := obj.MakeBucketWithLocation(context.Background(), bucketName, "")
err := obj.MakeBucketWithLocation(context.Background(), bucketName, "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}
@@ -776,7 +776,7 @@ func (s *ObjectLayerAPISuite) TestContentType(t *testing.T) {
// Test content-type.
func testContentType(obj ObjectLayer, instanceType string, t TestErrHandler) {
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "")
err := obj.MakeBucketWithLocation(context.Background(), "bucket", "", false)
if err != nil {
t.Fatalf("%s: <ERROR> %s", instanceType, err)
}