Modify test suite to use s3 test server.

Fix s3 backend to return error on attempting to write to already
existing key.
This commit is contained in:
Chris Howey committed 2015-06-14 08:28:50 -05:00
1 parent 4aa75994b0
commit 2350419f59
2 files changed
+35 -18

No files matched your search

+8 -1
View File
@@ -87,8 +87,15 @@ func (bb *s3Blob) Finalize(t backend.Type, name string) error {
bb.final = true
path := s3path(t, name)
// Check key does not already exist
key, err := bb.b.bucket.GetKey(path)
if err == nil && key.Key == path {
return errors.New("key already exists!")
}
bb.b.mput.Lock()
err := bb.b.bucket.Put(path, bb.buf.Bytes(), "binary/octet-stream", "private")
err = bb.b.bucket.Put(path, bb.buf.Bytes(), "binary/octet-stream", "private")
bb.b.mput.Unlock()
bb.buf.Reset()
return err