Create a gist now

Instantly share code, notes, and snippets.

@clairew /example_test.go Secret
Last active Aug 9, 2018

Embed
What would you like to do?
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