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

fix(storage): fix CreateBucket logic for gRPC #8165

Merged
merged 1 commit into from Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions storage/grpc_client.go
Expand Up @@ -154,7 +154,6 @@ func (c *grpcStorageClient) GetServiceAccount(ctx context.Context, project strin
func (c *grpcStorageClient) CreateBucket(ctx context.Context, project, bucket string, attrs *BucketAttrs, opts ...storageOption) (*BucketAttrs, error) {
s := callSettings(c.settings, opts...)
b := attrs.toProtoBucket()
b.Name = bucket
b.Project = toProjectResource(project)
// If there is lifecycle information but no location, explicitly set
// the location. This is a GCS quirk/bug.
Expand All @@ -165,7 +164,7 @@ func (c *grpcStorageClient) CreateBucket(ctx context.Context, project, bucket st
req := &storagepb.CreateBucketRequest{
Parent: fmt.Sprintf("projects/%s", globalProjectAlias),
Bucket: b,
BucketId: b.GetName(),
BucketId: bucket,
}
if attrs != nil {
req.PredefinedAcl = attrs.PredefinedACL
Expand Down
12 changes: 5 additions & 7 deletions storage/integration_test.go
Expand Up @@ -80,7 +80,6 @@ var (
record = flag.Bool("record", false, "record RPCs")

uidSpace *uid.Space
uidSpaceGRPC *uid.Space
uidSpaceObjects *uid.Space
bucketName string
grpcBucketName string
Expand Down Expand Up @@ -209,11 +208,10 @@ func initIntegrationTest() func() error {
}

func initUIDsAndRand(t time.Time) {
uidSpace = uid.NewSpace(testPrefix, &uid.Options{Time: t, Short: true})
bucketName = uidSpace.New()
uidSpace = uid.NewSpace("", &uid.Options{Time: t, Short: true})
bucketName = testPrefix + uidSpace.New()
uidSpaceObjects = uid.NewSpace("obj", &uid.Options{Time: t})
uidSpaceGRPC = uid.NewSpace(grpcTestPrefix, &uid.Options{Time: t, Short: true})
grpcBucketName = uidSpaceGRPC.New()
grpcBucketName = grpcTestPrefix + uidSpace.New()
// Use our own random source, to avoid other parts of the program taking
// random numbers from the global source and putting record and replay
// out of sync.
Expand Down Expand Up @@ -281,10 +279,10 @@ func multiTransportTest(ctx context.Context, t *testing.T,
}

bucket := bucketName
var prefix string
prefix := testPrefix
if transport == "grpc" {
bucket = grpcBucketName
prefix = grpcTestPrefix + "-"
prefix = grpcTestPrefix
}

test(t, ctx, bucket, prefix, client)
Expand Down