Skip to content

Commit

Permalink
Fix some bad rows.Err() handlings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bfontaine authored and jackc committed Oct 15, 2022
1 parent f2e7c81 commit 7a9e70d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ func TestListenNotifyWhileBusyIsSafe(t *testing.T) {
}

if rows.Err() != nil {
t.Errorf("conn.Query failed: %v", err)
t.Errorf("conn.Query failed: %v", rows.Err())
return
}

Expand Down
2 changes: 1 addition & 1 deletion helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func ensureConnValid(t testing.TB, conn *pgx.Conn) {
}

if rows.Err() != nil {
t.Fatalf("conn.Query failed: %v", err)
t.Fatalf("conn.Query failed: %v", rows.Err())
}

if rowCount != 10 {
Expand Down
8 changes: 4 additions & 4 deletions query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestConnQueryScan(t *testing.T) {
}

if rows.Err() != nil {
t.Fatalf("conn.Query failed: %v", err)
t.Fatalf("conn.Query failed: %v", rows.Err())
}

assert.Equal(t, "SELECT 10", rows.CommandTag().String())
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestConnQueryScanWithManyColumns(t *testing.T) {
}

if rows.Err() != nil {
t.Fatalf("conn.Query failed: %v", err)
t.Fatalf("conn.Query failed: %v", rows.Err())
}

if rowCount != 5 {
Expand Down Expand Up @@ -162,7 +162,7 @@ func TestConnQueryValues(t *testing.T) {
}

if rows.Err() != nil {
t.Fatalf("conn.Query failed: %v", err)
t.Fatalf("conn.Query failed: %v", rows.Err())
}

if rowCount != 10 {
Expand Down Expand Up @@ -1988,7 +1988,7 @@ insert into products (name, price) values

// The first error encountered by the original Query call, rows.Next or rows.Scan will be returned here.
if rows.Err() != nil {
fmt.Printf("rows error: %v", err)
fmt.Printf("rows error: %v", rows.Err())
return
}

Expand Down

0 comments on commit 7a9e70d

Please sign in to comment.