Skip to content

Commit

Permalink
fix(storage): Skip only specific transport tests. (#11016)
Browse files Browse the repository at this point in the history
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 <cjcotter@google.com>
  • Loading branch information
cjc25 and tritone authored Oct 23, 2024
1 parent ff06fc2 commit d40fbff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions storage/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d40fbff

Please sign in to comment.