Merge pull request #60 from moreati/test-engine-shutdown

snow: Add tests for Transitive.Shutdown()
This commit is contained in:
Stephen Buttolph 2020-04-09 22:26:05 -04:00 committed by GitHub
commit 7045059b10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -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()

View File

@ -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)