core,rpc: close Blockchain in tests

If blockchain is not closed, logging in defer can occur
after test has finished, which will lead to a panic with
"Log in goroutine after Test* has completed".
This commit is contained in:
Evgenii Stratonikov 2020-01-10 11:47:55 +03:00
parent dc65684708
commit 9dc5571327
3 changed files with 97 additions and 52 deletions

View file

@ -14,7 +14,9 @@ import (
func testNonInterop(t *testing.T, value interface{}, f func(*interopContext, *vm.VM) error) {
v := vm.New()
v.Estack().PushVal(value)
context := newTestChain(t).newInteropContext(trigger.Application, storage.NewMemoryStore(), nil, nil)
chain := newTestChain(t)
defer chain.Close()
context := chain.newInteropContext(trigger.Application, storage.NewMemoryStore(), nil, nil)
require.Error(t, f(context, v))
}