Skip to content

Conversation

christophershirk
Copy link

Individual unit tests were unsuccessfully removing './foo.db' (the error was ignored) due to resource leaks, which caused everything but the first unit test to fail on my vmware hgfs filesystem. Adding the relevant defer statements for db.Close() and rows.Close() removed the leaks so that os.Remove() actually works.

Minor fix: t.Errorf("foo:", err) rewritten as t.Error("foo:", err)

The original, on error, yields:

sqlite3_test.go:42: Failed to create table:%!(EXTRA *errors.errorString=unable to open database file)

Corrected statement output:

sqlite3_test.go:42: Failed to create table: unable to open database file

Minor fix: Fixed single erroneous error message for sql.Open()

Minor fix: Replaced t.Error("..."); return with t.Fatal("...")

cds added 4 commits September 11, 2012 08:35
…o:", err) .

Original:
--- FAIL: TestInsert (0.00 seconds)
	sqlite3_test.go:42: Failed to create table:%!(EXTRA *errors.errorString=unable to open database file)

With corrections:
--- FAIL: TestInsert (0.00 seconds)
	sqlite3_test.go:42: Failed to create table: unable to open database file
…s filesystems.

Individual tests were never successfully removing 'foo.db' (the error was ignored), which caused everything but the first test to fail on my vmhgfs filesystem.  Adding the relevant defer db.Close() and rows.Close() calls fixed the leaks, enabling os.Remove() to work.
@buildhive
Copy link

mattn » go-sqlite3 #13 FAILURE
Looks like there's a problem with this pull request
(what's this?)

mattn added a commit that referenced this pull request Sep 12, 2012
Fix sql.DB leaks in unit tests so that tests pass on vmware hgfs
@mattn mattn merged commit 8d4548d into mattn:master Sep 12, 2012
@mattn
Copy link
Owner

mattn commented Sep 12, 2012

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants