2
0

Remove tests context cancel

Context cancellation is now fatal so no need to test recovery.
This commit is contained in:
Jack Christensen
2019-04-05 11:00:35 -05:00
parent 858d00788a
commit d2ad2ed5d8
4 changed files with 0 additions and 295 deletions
-55
View File
@@ -1258,37 +1258,6 @@ func TestQueryExContextErrorWhileReceivingRows(t *testing.T) {
ensureConnValid(t, conn)
}
func TestQueryExContextCancelationCancelsQuery(t *testing.T) {
t.Parallel()
conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE"))
defer closeConn(t, conn)
ctx, cancelFunc := context.WithCancel(context.Background())
go func() {
time.Sleep(500 * time.Millisecond)
cancelFunc()
}()
rows, err := conn.QueryEx(ctx, "select pg_sleep(5)", nil)
if err != nil {
t.Fatal(err)
}
if !conn.LastStmtSent() {
t.Error("Expected LastStmtSent to return true")
}
for rows.Next() {
t.Fatal("No rows should ever be ready -- context cancel apparently did not happen")
}
if rows.Err() != context.Canceled {
t.Fatalf("Expected context.Canceled error, got %v", rows.Err())
}
ensureConnValid(t, conn)
}
func TestQueryRowExContextSuccess(t *testing.T) {
t.Parallel()
@@ -1331,30 +1300,6 @@ func TestQueryRowExContextErrorWhileReceivingRow(t *testing.T) {
ensureConnValid(t, conn)
}
func TestQueryRowExContextCancelationCancelsQuery(t *testing.T) {
t.Parallel()
conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE"))
defer closeConn(t, conn)
ctx, cancelFunc := context.WithCancel(context.Background())
go func() {
time.Sleep(500 * time.Millisecond)
cancelFunc()
}()
var result []byte
err := conn.QueryRowEx(ctx, "select pg_sleep(5)", nil).Scan(&result)
if err != context.Canceled {
t.Fatalf("Expected context.Canceled error, got %v", err)
}
if !conn.LastStmtSent() {
t.Error("Expected LastStmtSent to return true")
}
ensureConnValid(t, conn)
}
func TestConnQueryRowExSingleRoundTrip(t *testing.T) {
t.Parallel()