gcash / bchwallet

A secure bitcoin cash wallet daemon written in Go (golang)
ISC License
43 stars 29 forks source link

Tests failing on travis #25

Closed cpacia closed 4 years ago

cpacia commented 5 years ago

There are a couple tests that seem to sometimes fail and sometimes pass on travis. The error is always Failed to create Manager: failed to master public key: unable to decrypt. Since travis runs the tests for different versions of Go it's almost a guarantee that one of them will fail and need to be restarted.

I can't get this to replicate on my home machine. Tests pass 100% of the time for me. So I'm finding it difficult to debug.

cpacia commented 5 years ago

Some more info: There is a variable called:

secretKeyGen = defaultNewSecretKey

which is normally set to the default key generator function. However one of the tests replaces it with a new function that intentionally fails in order to test the failure case. However, every time travis fails it's because this other function fired and caused the failure.

So it sounds like race condition with this variable being set incorrectly. However, the variable is protected by a mutex. So I don't see how it could be set incorrectly.

zquestz commented 5 years ago

Go runs these in parallel and the mutex doesn't help because the global var in the package has been replaced. I can look into a better way to do this.

zquestz commented 4 years ago

This was resolved.