Merge pull request #900 from nspcc-dev/fix/861

core,network: shutdown services in tests properly
This commit is contained in:
Roman Khimov 2020-04-22 18:00:28 +03:00 committed by GitHub
commit 473ab861c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -203,6 +203,7 @@ func TestCreateBasicChain(t *testing.T) {
var neoAmount = util.Fixed8FromInt64(99999000)
var neoRemainder = util.Fixed8FromInt64(100000000) - neoAmount
bc := newTestChain(t)
defer bc.Close()
// Move almost all NEO to one simple account.
txMoveNeo := transaction.NewContractTX()

View file

@ -59,7 +59,16 @@ func TestServerNotSendsVerack(t *testing.T) {
p2 = newLocalPeer(t, s)
)
s.id = 1
go s.run()
finished := make(chan struct{})
go func() {
s.run()
close(finished)
}()
defer func() {
// close via quit as server was started via `run()`, not `Start()`
close(s.quit)
<-finished
}()
na, _ := net.ResolveTCPAddr("tcp", "0.0.0.0:3000")
p.netaddr = *na