mirror of https://github.com/poanetwork/gecko.git
Merge pull request #60 from moreati/test-engine-shutdown
snow: Add tests for Transitive.Shutdown()
This commit is contained in:
commit
7045059b10
|
@ -24,6 +24,22 @@ var (
|
|||
errMissing = errors.New("missing")
|
||||
)
|
||||
|
||||
func TestEngineShutdown(t *testing.T) {
|
||||
config := DefaultConfig()
|
||||
vmShutdownCalled := false
|
||||
vm := &VMTest{}
|
||||
vm.ShutdownF = func() { vmShutdownCalled = true }
|
||||
config.VM = vm
|
||||
|
||||
transitive := &Transitive{}
|
||||
|
||||
transitive.Initialize(config)
|
||||
transitive.finishBootstrapping()
|
||||
transitive.Shutdown()
|
||||
if !vmShutdownCalled {
|
||||
t.Fatal("Shutting down the Transitive did not shutdown the VM")
|
||||
}
|
||||
}
|
||||
func TestEngineAdd(t *testing.T) {
|
||||
config := DefaultConfig()
|
||||
|
||||
|
|
|
@ -64,6 +64,17 @@ func setup(t *testing.T) (validators.Validator, validators.Set, *common.SenderTe
|
|||
return vdr, vals, sender, vm, te, gBlk
|
||||
}
|
||||
|
||||
func TestEngineShutdown(t *testing.T) {
|
||||
_, _, _, vm, transitive, _ := setup(t)
|
||||
vmShutdownCalled := false
|
||||
vm.ShutdownF = func() { vmShutdownCalled = true }
|
||||
vm.CantShutdown = false
|
||||
transitive.Shutdown()
|
||||
if !vmShutdownCalled {
|
||||
t.Fatal("Shutting down the Transitive did not shutdown the VM")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEngineAdd(t *testing.T) {
|
||||
vdr, _, sender, vm, te, _ := setup(t)
|
||||
|
||||
|
|
Loading…
Reference in New Issue