Use tx instead of underlying conn in test

Improves clarity
pull/1631/head
Jack Christensen 2023-06-03 07:59:28 -05:00
parent 608f39f426
commit d9560c78b8
1 changed files with 5 additions and 2 deletions

View File

@ -375,11 +375,11 @@ func TestConnCopyFromEnum(t *testing.T) {
{nil, nil, nil, nil, nil, nil},
}
copyCount, err := conn.CopyFrom(ctx, pgx.Identifier{"foo"}, []string{"a", "b", "c", "d", "e", "f"}, pgx.CopyFromRows(inputRows))
copyCount, err := tx.CopyFrom(ctx, pgx.Identifier{"foo"}, []string{"a", "b", "c", "d", "e", "f"}, pgx.CopyFromRows(inputRows))
require.NoError(t, err)
require.EqualValues(t, len(inputRows), copyCount)
rows, err := conn.Query(ctx, "select * from foo")
rows, err := tx.Query(ctx, "select * from foo")
require.NoError(t, err)
var outputRows [][]any
@ -395,6 +395,9 @@ func TestConnCopyFromEnum(t *testing.T) {
t.Errorf("Input rows and output rows do not equal: %v -> %v", inputRows, outputRows)
}
err = tx.Rollback(ctx)
require.NoError(t, err)
ensureConnValid(t, conn)
}