add more tests for proc (#439)

master
Kevin Wan 4 years ago committed by GitHub
parent b88ba14597
commit d04b54243d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,28 @@
package proc
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestShutdown(t *testing.T) {
SetTimeToForceQuit(time.Hour)
assert.Equal(t, time.Hour, delayTimeBeforeForceQuit)
var val int
called := AddWrapUpListener(func() {
val++
})
wrapUpListeners.notifyListeners()
called()
assert.Equal(t, 1, val)
called = AddShutdownListener(func() {
val += 2
})
shutdownListeners.notifyListeners()
called()
assert.Equal(t, 3, val)
}

@ -0,0 +1,8 @@
package proc
import "testing"
func TestNopStopper(t *testing.T) {
// no panic
noopStopper.Stop()
}
Loading…
Cancel
Save