diff --git a/pkg/signal/signal_linux_test.go b/pkg/signal/signal_linux_test.go index decd454de3..5b30547273 100644 --- a/pkg/signal/signal_linux_test.go +++ b/pkg/signal/signal_linux_test.go @@ -7,9 +7,6 @@ import ( "syscall" "testing" "time" - - "gotest.tools/v3/assert" - is "gotest.tools/v3/assert/cmp" ) func TestCatchAll(t *testing.T) { @@ -28,9 +25,11 @@ func TestCatchAll(t *testing.T) { for sigStr := range listOfSignals { if signal, ok := SignalMap[sigStr]; ok { - syscall.Kill(syscall.Getpid(), signal) + _ = syscall.Kill(syscall.Getpid(), signal) s := <-sigs - assert.Check(t, is.Equal(s.String(), signal.String())) + if s.String() != signal.String() { + t.Errorf("expected: %q, got: %q", signal, s) + } } } } @@ -41,7 +40,9 @@ func TestCatchAllIgnoreSigUrg(t *testing.T) { defer StopCatch(sigs) err := syscall.Kill(syscall.Getpid(), syscall.SIGURG) - assert.NilError(t, err) + if err != nil { + t.Fatal(err) + } timer := time.NewTimer(1 * time.Second) defer timer.Stop() select { @@ -55,11 +56,15 @@ func TestStopCatch(t *testing.T) { signal := SignalMap["HUP"] channel := make(chan os.Signal, 1) CatchAll(channel) - syscall.Kill(syscall.Getpid(), signal) + _ = syscall.Kill(syscall.Getpid(), signal) signalString := <-channel - assert.Check(t, is.Equal(signalString.String(), signal.String())) + if signalString.String() != signal.String() { + t.Errorf("expected: %q, got: %q", signal, signalString) + } StopCatch(channel) _, ok := <-channel - assert.Check(t, is.Equal(ok, false)) + if ok { + t.Error("expected: !ok, got: ok") + } } diff --git a/pkg/signal/signal_test.go b/pkg/signal/signal_test.go index c275345b8b..c9fe394606 100644 --- a/pkg/signal/signal_test.go +++ b/pkg/signal/signal_test.go @@ -3,32 +3,43 @@ package signal // import "github.com/docker/docker/pkg/signal" import ( "syscall" "testing" - - "gotest.tools/v3/assert" - is "gotest.tools/v3/assert/cmp" ) func TestParseSignal(t *testing.T) { - _, checkAtoiError := ParseSignal("0") - assert.Check(t, is.Error(checkAtoiError, "Invalid signal: 0")) + _, err := ParseSignal("0") + expectedErr := "Invalid signal: 0" + if err == nil || err.Error() != expectedErr { + t.Errorf("expected %q, but got %v", expectedErr, err) + } - _, error := ParseSignal("SIG") - assert.Check(t, is.Error(error, "Invalid signal: SIG")) + _, err = ParseSignal("SIG") + expectedErr = "Invalid signal: SIG" + if err == nil || err.Error() != expectedErr { + t.Errorf("expected %q, but got %v", expectedErr, err) + } for sigStr := range SignalMap { - responseSignal, error := ParseSignal(sigStr) - assert.Check(t, error) + responseSignal, err := ParseSignal(sigStr) + if err != nil { + t.Error(err) + } signal := SignalMap[sigStr] - assert.Check(t, is.DeepEqual(signal, responseSignal)) + if responseSignal != signal { + t.Errorf("expected: %q, got: %q", signal, responseSignal) + } } } func TestValidSignalForPlatform(t *testing.T) { isValidSignal := ValidSignalForPlatform(syscall.Signal(0)) - assert.Check(t, is.Equal(false, isValidSignal)) + if isValidSignal { + t.Error("expected !isValidSignal") + } for _, sigN := range SignalMap { isValidSignal = ValidSignalForPlatform(sigN) - assert.Check(t, is.Equal(true, isValidSignal)) + if !isValidSignal { + t.Error("expected isValidSignal") + } } }