Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(storage): add retry to ACL tests that rely on eventual consistency #8313

Merged
merged 4 commits into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions storage/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3985,11 +3985,38 @@ func TestIntegration_PredefinedACLs(t *testing.T) {
w.PredefinedACL = "authenticatedRead"
h.mustWrite(w, []byte("hello"))
defer h.mustDeleteObject(obj)
if acl, want := w.Attrs().ACL, userOwner; !containsACLRule(acl, want) {
t.Fatalf("Object.ACL: expected acl to contain: %+v, got acl: %+v", want, acl)
var acl []ACLRule
err := retry(ctx, func() error {
attrs, err := obj.Attrs(ctx)
if err != nil {
return fmt.Errorf("Object.Attrs: object metadata get failed: %v", err)
}
acl = attrs.ACL
return nil
}, func() error {
if want := userOwner; !containsACLRule(acl, want) {
return fmt.Errorf("Object.ACL: expected acl to contain: %+v, got acl: %+v", want, acl)
}
return nil
})
if err != nil {
t.Fatal(err)
}
if acl, want := w.Attrs().ACL, authenticatedRead; !containsACLRule(acl, want) {
t.Fatalf("Object.ACL: expected acl to contain: %+v, got acl: %+v", want, acl)
err = retry(ctx, func() error {
attrs, err := obj.Attrs(ctx)
if err != nil {
return fmt.Errorf("Object.Attrs: object metadata get failed: %v", err)
}
acl = attrs.ACL
return nil
}, func() error {
if want := authenticatedRead; !containsACLRule(acl, want) {
return fmt.Errorf("Object.ACL: expected acl to contain: %+v, got acl: %+v", want, acl)
}
return nil
})
if err != nil {
t.Fatal(err)
}

// Object update
Expand All @@ -4005,7 +4032,7 @@ func TestIntegration_PredefinedACLs(t *testing.T) {
dst := bkt.Object("dst")
copier := dst.CopierFrom(obj)
copier.PredefinedACL = "publicRead"
oattrs, err := copier.Run(ctx)
oattrs, err = copier.Run(ctx)
if err != nil {
t.Fatal(err)
}
Expand Down