mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #40496 from thaJeztah/locally_scope_variable
TestCatchAll, TestStopCatch: remove unneeded goroutine
This commit is contained in:
commit
ff9fa7b43a
1 changed files with 3 additions and 14 deletions
|
@ -6,7 +6,6 @@ import (
|
|||
"os"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
|
@ -27,17 +26,11 @@ func TestCatchAll(t *testing.T) {
|
|||
}
|
||||
|
||||
for sigStr := range listOfSignals {
|
||||
signal, ok := SignalMap[sigStr]
|
||||
if ok {
|
||||
go func() {
|
||||
time.Sleep(1 * time.Millisecond)
|
||||
syscall.Kill(syscall.Getpid(), signal)
|
||||
}()
|
||||
|
||||
if signal, ok := SignalMap[sigStr]; ok {
|
||||
syscall.Kill(syscall.Getpid(), signal)
|
||||
s := <-sigs
|
||||
assert.Check(t, is.Equal(s.String(), signal.String()))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,11 +38,7 @@ func TestStopCatch(t *testing.T) {
|
|||
signal := SignalMap["HUP"]
|
||||
channel := make(chan os.Signal, 1)
|
||||
CatchAll(channel)
|
||||
go func() {
|
||||
|
||||
time.Sleep(1 * time.Millisecond)
|
||||
syscall.Kill(syscall.Getpid(), signal)
|
||||
}()
|
||||
syscall.Kill(syscall.Getpid(), signal)
|
||||
signalString := <-channel
|
||||
assert.Check(t, is.Equal(signalString.String(), signal.String()))
|
||||
|
||||
|
|
Loading…
Reference in a new issue