Skip to content

Commit f3b28a5

Browse files
committed
handle s3 bucket eventual consistency in mount test
1 parent 8cc9d17 commit f3b28a5

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

internal/backend_gcs3.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ func NewGCS3(bucket string, flags *FlagStorage, config *S3Config) (*GCS3, error)
5252
return s, nil
5353
}
5454

55+
func (s *GCS3) Delegate() interface{} {
56+
return s
57+
}
58+
5559
func (s *GCS3) DeleteBlobs(param *DeleteBlobsInput) (*DeleteBlobsOutput, error) {
5660
// GCS does not have multi-delete
5761
var wg sync.WaitGroup

internal/goofys_test.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,17 +3123,21 @@ func (s *GoofysTest) newBackend(t *C, bucket string, createBucket bool) (cloud S
31233123
switch s.cloud.Delegate().(type) {
31243124
case *S3Backend:
31253125
config, _ := s.fs.flags.Backend.(*S3Config)
3126-
cloud, err = NewS3(bucket, s.fs.flags, config)
3126+
s3, err := NewS3(bucket, s.fs.flags, config)
31273127
t.Assert(err, IsNil)
31283128

3129-
if s3, ok := cloud.(*S3Backend); ok {
3130-
s3.aws = hasEnv("AWS")
3129+
s3.aws = hasEnv("AWS")
31313130

3132-
if !hasEnv("MINIO") {
3133-
s3.Handlers.Sign.Clear()
3134-
s3.Handlers.Sign.PushBack(SignV2)
3135-
s3.Handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler)
3136-
}
3131+
if !hasEnv("MINIO") {
3132+
s3.Handlers.Sign.Clear()
3133+
s3.Handlers.Sign.PushBack(SignV2)
3134+
s3.Handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler)
3135+
}
3136+
3137+
if s3.aws {
3138+
cloud = &S3BucketEventualConsistency{s3}
3139+
} else {
3140+
cloud = s3
31373141
}
31383142
case *GCS3:
31393143
config, _ := s.fs.flags.Backend.(*S3Config)

0 commit comments

Comments
 (0)