1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
//go:build integration
// +build integration
package s3
import (
"context"
"github.com/aws/aws-sdk-go-v2/service/internal/integrationtest"
"testing"
"time"
"github.com/aws/aws-sdk-go-v2/service/s3"
)
func TestInteg_XSIType(t *testing.T) {
key := integrationtest.UniqueID()
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
defer cancelFn()
cfg, err := integrationtest.LoadConfigWithDefaultRegion("us-west-2")
if err != nil {
t.Fatalf("failed to load config, %v", err)
}
client := s3.NewFromConfig(cfg)
_, err = client.PutObject(ctx, &s3.PutObjectInput{
Bucket: &setupMetadata.Buckets.Source.Name,
Key: &key,
})
if err != nil {
t.Fatal(err)
}
resp, err := client.GetObjectAcl(ctx, &s3.GetObjectAclInput{
Bucket: &setupMetadata.Buckets.Source.Name,
Key: &key,
})
if err != nil {
t.Fatal(err)
}
if len(resp.Grants) == 0 {
t.Fatalf("expect Grants to not be empty")
}
if len(resp.Grants[0].Grantee.Type) == 0 {
t.Errorf("expect grantee type to not be empty")
}
}
|