Skip to content

Commit

Permalink
Add test for calling Ping in async mode
Browse files Browse the repository at this point in the history
Unfotunately it appears that calling t.Fatalf in defer doesn't stop the
test, but it does display the error.
  • Loading branch information
nyergler committed Oct 19, 2023
1 parent e92e2c9 commit e52e317
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions async_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ func TestAsyncMode(t *testing.T) {
})
}

func TestAsyncModePing(t *testing.T) {
ctx := WithAsyncMode(context.Background())

runDBTest(t, func(dbt *DBTest) {
defer func() {
if r := recover(); r != nil {
t.Fatalf("panic during ping: %v", r)
}
}()
err := dbt.conn.PingContext(ctx)
if err != nil {
t.Fatal(err)
}
})
}

func TestAsyncModeMultiStatement(t *testing.T) {
withMultiStmtCtx, _ := WithMultiStatement(context.Background(), 6)
ctx := WithAsyncMode(withMultiStmtCtx)
Expand Down

0 comments on commit e52e317

Please sign in to comment.