mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 09:40:24 +08:00
0fdd8f54eb
* ci: add test for win * ci: update check names * ci: use go build instead of go test to verify win test * fix: windows test failure * chore: disable logs in tests
32 lines
517 B
Go
32 lines
517 B
Go
//go:build linux || darwin
|
|
// +build linux darwin
|
|
|
|
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)
|
|
}
|