chore(storage): enable more tests for grpc
Enables multi-transport tests for the following tests:
TestIntegration_ValidObjectNames
TestIntegration_ZeroSizedObject
TestIntegration_BucketIAM
TestIntegration_CancelWrite
@@ -2471,11 +2471,8 @@ func TestIntegration_ACL(t *testing.T) {
}
func TestIntegration_ValidObjectNames(t *testing.T) {
- ctx := context.Background()
- client := testConfig(ctx, t)
- defer client.Close()
-
- bkt := client.Bucket(bucketName)
+ multiTransportTest(context.Background(), t, func(t *testing.T, ctx context.Context, bucket, _ string, client *Client) {
+ bkt := client.Bucket(bucket)
validNames := []string{
"gopher",
@@ -2505,6 +2502,7 @@ func TestIntegration_ValidObjectNames(t *testing.T) {
defer bkt.Object(name).Delete(ctx)
t.Errorf("%q should have failed. Didn't", name)
}
+ })
}
func TestIntegration_WriterContentType(t *testing.T) {
@@ -2553,12 +2551,10 @@ func TestIntegration_WriterContentType(t *testing.T) {
func TestIntegration_ZeroSizedObject(t *testing.T) {
t.Parallel()
- ctx := context.Background()
- client := testConfig(ctx, t)
- defer client.Close()
+ multiTransportTest(context.Background(), t, func(t *testing.T, ctx context.Context, bucket, _ string, client *Client) {
h := testHelper{t}
- obj := client.Bucket(bucketName).Object("zero")
+ obj := client.Bucket(bucket).Object("zero")
// Check writing it works as expected.
w := obj.NewWriter(ctx)
@@ -2572,6 +2568,7 @@ func TestIntegration_ZeroSizedObject(t *testing.T) {
if len(body) != 0 {
t.Errorf("Body is %v, want empty []byte{}", body)
}
+ })
}
func TestIntegration_Encryption(t *testing.T) {
@@ -2880,11 +2877,9 @@ func TestIntegration_HashesOnUpload(t *testing.T) {
}
func TestIntegration_BucketIAM(t *testing.T) {
- ctx := context.Background()
- client := testConfig(ctx, t)
- defer client.Close()
+ multiTransportTest(context.Background(), t, func(t *testing.T, ctx context.Context, _, prefix string, client *Client) {
h := testHelper{t}
- bkt := client.Bucket(uidSpace.New())
+ bkt := client.Bucket(prefix + uidSpace.New())
h.mustCreate(bkt, testutil.ProjID(), nil)
defer h.mustDeleteBucket(bkt)
// This bucket is unique to this test run. So we don't have
@@ -2928,6 +2923,7 @@ func TestIntegration_BucketIAM(t *testing.T) {
if !testutil.Equal(got, perms) {
t.Errorf("got %v, want %v", got, perms)
}
+ })
}
func TestIntegration_RequesterPays(t *testing.T) {
@@ -3433,10 +3429,8 @@ func TestIntegration_ReadCRC(t *testing.T) {
func TestIntegration_CancelWrite(t *testing.T) {
// Verify that canceling the writer's context immediately stops uploading an object.
- ctx := context.Background()
- client := testConfig(ctx, t)
- defer client.Close()
- bkt := client.Bucket(bucketName)
+ multiTransportTest(context.Background(), t, func(t *testing.T, ctx context.Context, bucket, _ string, client *Client) {
+ bkt := client.Bucket(bucket)
cctx, cancel := context.WithCancel(ctx)
defer cancel()
@@ -3463,6 +3457,7 @@ func TestIntegration_CancelWrite(t *testing.T) {
if !errors.Is(err, context.Canceled) {
t.Fatalf("got %v, wanted context.Canceled", err)
}
+ })
}
func TestIntegration_UpdateCORS(t *testing.T) {
