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"
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
|
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
|
@ -27,17 +26,11 @@ func TestCatchAll(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for sigStr := range listOfSignals {
|
for sigStr := range listOfSignals {
|
||||||
signal, ok := SignalMap[sigStr]
|
if signal, ok := SignalMap[sigStr]; ok {
|
||||||
if ok {
|
syscall.Kill(syscall.Getpid(), signal)
|
||||||
go func() {
|
|
||||||
time.Sleep(1 * time.Millisecond)
|
|
||||||
syscall.Kill(syscall.Getpid(), signal)
|
|
||||||
}()
|
|
||||||
|
|
||||||
s := <-sigs
|
s := <-sigs
|
||||||
assert.Check(t, is.Equal(s.String(), signal.String()))
|
assert.Check(t, is.Equal(s.String(), signal.String()))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,11 +38,7 @@ func TestStopCatch(t *testing.T) {
|
||||||
signal := SignalMap["HUP"]
|
signal := SignalMap["HUP"]
|
||||||
channel := make(chan os.Signal, 1)
|
channel := make(chan os.Signal, 1)
|
||||||
CatchAll(channel)
|
CatchAll(channel)
|
||||||
go func() {
|
syscall.Kill(syscall.Getpid(), signal)
|
||||||
|
|
||||||
time.Sleep(1 * time.Millisecond)
|
|
||||||
syscall.Kill(syscall.Getpid(), signal)
|
|
||||||
}()
|
|
||||||
signalString := <-channel
|
signalString := <-channel
|
||||||
assert.Check(t, is.Equal(signalString.String(), signal.String()))
|
assert.Check(t, is.Equal(signalString.String(), signal.String()))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue