Merge pull request #522 from halseth/test-race-condition

waddrmgr test: fix test race condition
This commit is contained in:
Olaoluwa Osuntokun 2018-07-20 17:14:06 -07:00 committed by GitHub
commit eb5aba63a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -206,8 +206,6 @@ func emptyDB(t *testing.T) (tearDownFunc func(), db walletdb.DB) {
// setupManager creates a new address manager and returns a teardown function // setupManager creates a new address manager and returns a teardown function
// that should be invoked to ensure it is closed and removed upon completion. // that should be invoked to ensure it is closed and removed upon completion.
func setupManager(t *testing.T) (tearDownFunc func(), db walletdb.DB, mgr *waddrmgr.Manager) { func setupManager(t *testing.T) (tearDownFunc func(), db walletdb.DB, mgr *waddrmgr.Manager) {
t.Parallel()
// Create a new manager in a temp directory. // Create a new manager in a temp directory.
dirName, err := ioutil.TempDir("", "mgrtest") dirName, err := ioutil.TempDir("", "mgrtest")
if err != nil { if err != nil {

View file

@ -1859,6 +1859,8 @@ func TestManager(t *testing.T) {
// TestEncryptDecryptErrors ensures that errors which occur while encrypting and // TestEncryptDecryptErrors ensures that errors which occur while encrypting and
// decrypting data return the expected errors. // decrypting data return the expected errors.
func TestEncryptDecryptErrors(t *testing.T) { func TestEncryptDecryptErrors(t *testing.T) {
t.Parallel()
teardown, db, mgr := setupManager(t) teardown, db, mgr := setupManager(t)
defer teardown() defer teardown()
@ -1911,6 +1913,8 @@ func TestEncryptDecryptErrors(t *testing.T) {
// TestEncryptDecrypt ensures that encrypting and decrypting data with the // TestEncryptDecrypt ensures that encrypting and decrypting data with the
// the various crypto key types works as expected. // the various crypto key types works as expected.
func TestEncryptDecrypt(t *testing.T) { func TestEncryptDecrypt(t *testing.T) {
t.Parallel()
teardown, db, mgr := setupManager(t) teardown, db, mgr := setupManager(t)
defer teardown() defer teardown()