Skip to content

Commit

Permalink
Check if using t.Cleanup fixes unit test failures on win/mac
Browse files Browse the repository at this point in the history
  • Loading branch information
rhatgadkar-goog committed Oct 1, 2024
1 parent f96409c commit ff335ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func TestDialerWithMetrics(t *testing.T) {
if err != nil {
t.Fatalf("expected Dial to succeed, but got error: %v", err)
}
defer conn.Close()
t.Cleanup(func() { conn.Close() })
// dial a second time to ensure the counter is working
conn2, err := d.Dial(ctx, testInstanceURI)
if err != nil {
Expand All @@ -203,7 +203,7 @@ func TestDialerWithMetrics(t *testing.T) {
if err != nil {
t.Fatalf("conn.Write failed: %v", err)
}
defer conn2.Close()
t.Cleanup(func() { conn2.Close() })
// dial a bogus instance
_, err = d.Dial(ctx,
"projects/my-project/locations/my-region/clusters/"+
Expand Down

0 comments on commit ff335ac

Please sign in to comment.