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:
parent
4aa75994b0
commit
2350419f59
2 changed files with 35 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue