Merge pull request #2194 from alexandear/refactor/pgconn-tests

Simplify pgconn tests by using T.TempDir
pull/2196/head
Jack Christensen 2024-12-17 17:45:16 -06:00 committed by GitHub
commit ad87d47089
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 7 deletions

View File

@ -2103,8 +2103,9 @@ func TestConnCopyFromGzipReader(t *testing.T) {
)`).ReadAll() )`).ReadAll()
require.NoError(t, err) require.NoError(t, err)
f, err := os.CreateTemp("", "*") f, err := os.CreateTemp(t.TempDir(), "*")
require.NoError(t, err) require.NoError(t, err)
defer f.Close()
gw := gzip.NewWriter(f) gw := gzip.NewWriter(f)
@ -2137,12 +2138,6 @@ func TestConnCopyFromGzipReader(t *testing.T) {
err = gr.Close() err = gr.Close()
require.NoError(t, err) require.NoError(t, err)
err = f.Close()
require.NoError(t, err)
err = os.Remove(f.Name())
require.NoError(t, err)
result := pgConn.ExecParams(ctx, "select * from foo", nil, nil, nil, nil).Read() result := pgConn.ExecParams(ctx, "select * from foo", nil, nil, nil, nil).Read()
require.NoError(t, result.Err) require.NoError(t, result.Err)