From d40fbff9c1984aeed0224a4ac93eb95c5af17126 Mon Sep 17 00:00:00 2001 From: Chris Carlon Date: Wed, 23 Oct 2024 14:07:12 -0400 Subject: [PATCH] fix(storage): Skip only specific transport tests. (#11016) Some client tests only work with certain transports, so we try to skip them. However by calling `t.Skip()` before the per-transport `t.Run()`, we skipped every remaining sub-test once we hit that condition. This changes the code to skip only the relevant transport, by skipping the testing.T for the sub-test. Co-authored-by: Chris Cotter --- storage/client_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/client_test.go b/storage/client_test.go index 0aa2f19791fa..0ec2044cdc24 100644 --- a/storage/client_test.go +++ b/storage/client_test.go @@ -1584,10 +1584,10 @@ func transportClientTest(ctx context.Context, t *testing.T, test func(*testing.T checkEmulatorEnvironment(t) for transport, client := range emulatorClients { - if reason := ctx.Value(skipTransportTestKey(transport)); reason != nil { - t.Skip("transport", fmt.Sprintf("%q", transport), "explicitly skipped:", reason) - } t.Run(transport, func(t *testing.T) { + if reason := ctx.Value(skipTransportTestKey(transport)); reason != nil { + t.Skip("transport", fmt.Sprintf("%q", transport), "explicitly skipped:", reason) + } project := fmt.Sprintf("%s-project", transport) bucket := fmt.Sprintf("%s-bucket-%d", transport, time.Now().Nanosecond()) test(t, ctx, project, bucket, client)