tests: Fix hasExtendedHeader tests with env variable.

master
Harshavardhana 8 years ago
parent bb8a425d49
commit 3d1bb8f439
  1. 15
      fs-v1-metadata_test.go
  2. 3
      fs-v1-multipart.go

@ -16,7 +16,10 @@
package main
import "testing"
import (
"os"
"testing"
)
// Tests scenarios which can occur for hasExtendedHeader function.
func TestHasExtendedHeader(t *testing.T) {
@ -30,26 +33,26 @@ func TestHasExtendedHeader(t *testing.T) {
metadata: map[string]string{
"X-Amz-Meta-1": "value",
},
has: true,
has: true || os.Getenv("MINIO_ENABLE_FSMETA") == "1",
},
// Verifies if X-Minio-Meta is present.
{
metadata: map[string]string{
"X-Minio-Meta-1": "value",
},
has: true,
has: true || os.Getenv("MINIO_ENABLE_FSMETA") == "1",
},
// Verifies if extended header is not present.
{
metadata: map[string]string{
"md5Sum": "value",
},
has: false,
has: false || os.Getenv("MINIO_ENABLE_FSMETA") == "1",
},
// Verifieis if extended header is not present, but with an empty input.
// Verifies if extended header is not present, but with an empty input.
{
metadata: nil,
has: false,
has: false || os.Getenv("MINIO_ENABLE_FSMETA") == "1",
},
}

@ -587,6 +587,9 @@ func (fs fsObjects) CompleteMultipartUpload(bucket string, object string, upload
// Save additional metadata only if extended headers such as "X-Amz-Meta-" are set.
if hasExtendedHeader(fsMeta.Meta) {
if len(fsMeta.Meta) == 0 {
fsMeta.Meta = make(map[string]string)
}
fsMeta.Meta["md5Sum"] = s3MD5
// Write the metadata to a temp file and rename it to the actual location.

Loading…
Cancel
Save