17339: fix tests.
authorWard Vandewege <ward@curii.com>
Fri, 3 Dec 2021 21:29:49 +0000 (16:29 -0500)
committerWard Vandewege <ward@curii.com>
Fri, 3 Dec 2021 21:29:49 +0000 (16:29 -0500)
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

services/keepstore/s3aws_volume.go

index 4064809d5dd3d983d23453b524fe3457c906036a..a7801ae262fbe73f30c94b0a0692c8dfff8e440a 100644 (file)
@@ -119,6 +119,11 @@ func (v *S3AWSVolume) translateError(err error) error {
                case "NoSuchKey":
                        return os.ErrNotExist
                }
+       } else {
+               switch err.(type) {
+               case *aws.RequestCanceledError:
+                       return context.Canceled
+               }
        }
        return err
 }
@@ -582,7 +587,7 @@ func (v *S3AWSVolume) writeObject(ctx context.Context, key string, r io.Reader)
 func (v *S3AWSVolume) Put(ctx context.Context, loc string, block []byte) error {
        // Do not use putWithPipe here; we want to pass an io.ReadSeeker to the S3
        // sdk to avoid memory allocation there. See #17339 for more information.
-       return v.WriteBlock(ctx, loc, bytes.NewReader(block))
+       return v.translateError(v.WriteBlock(ctx, loc, bytes.NewReader(block)))
 }
 
 // WriteBlock implements BlockWriter.