fix: uint testing case for signal feature of package gproc occasionally failed (#3529)

This commit is contained in:
John Guo 2024-04-23 21:30:33 +08:00 committed by GitHub
parent 1013df1627
commit adc94fd97a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,11 +7,12 @@
package gproc package gproc
import ( import (
"github.com/gogf/gf/v2/test/gtest"
"os" "os"
"syscall" "syscall"
"testing" "testing"
"time" "time"
"github.com/gogf/gf/v2/test/gtest"
) )
func Test_Signal(t *testing.T) { func Test_Signal(t *testing.T) {
@ -79,6 +80,9 @@ func Test_Signal(t *testing.T) {
}) })
sendSignal(syscall.SIGTERM) sendSignal(syscall.SIGTERM)
// wait the listen done
time.Sleep(time.Second)
select { select {
case s := <-sigRec: case s := <-sigRec:
t.AssertEQ(s, syscall.SIGTERM) t.AssertEQ(s, syscall.SIGTERM)