Skip to content

Instantly share code, notes, and snippets.

@clairew
Last active August 9, 2018 22:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save clairew/1a7dfe2a6684e462effec5e2d42f4623 to your computer and use it in GitHub Desktop.
Test Tear Down Helper Function Example
//TestDBTearDown closes test db connection
func TestDBTearDown(db *sql.DB) error {
log.Info("Closing connection to test database")
err := db.Close()
if err != nil {
log.WithFields(log.Fields{
"err": err,
}).Warn("Closing db connection resulted in error")
return err
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment