From 7726bcf0e20cee4f4e9da5a6d5307e052c2f0463 Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Mon, 14 Aug 2017 15:28:03 +0800 Subject: [PATCH] Some fixes for testMemoryNotification Signed-off-by: Qiang Huang --- libcontainer/notify_linux_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libcontainer/notify_linux_test.go b/libcontainer/notify_linux_test.go index 5e9f6a78a..1e15ae2c3 100644 --- a/libcontainer/notify_linux_test.go +++ b/libcontainer/notify_linux_test.go @@ -53,17 +53,13 @@ func testMemoryNotification(t *testing.T, evName string, notify notifyFunc, targ t.Fatalf("invalid control data %q: %s", data, err) } - // re-open the eventfd + // dup the eventfd efd, err := unix.Dup(eventFd) if err != nil { - t.Fatal("unable to reopen eventfd:", err) + t.Fatal("unable to dup eventfd:", err) } defer unix.Close(efd) - if err != nil { - t.Fatal("unable to dup event fd:", err) - } - buf := make([]byte, 8) binary.LittleEndian.PutUint64(buf, 1) @@ -93,6 +89,7 @@ func testMemoryNotification(t *testing.T, evName string, notify notifyFunc, targ t.Fatal("expected no notification to be triggered") } case <-time.After(100 * time.Millisecond): + t.Fatal("channel not closed after 100ms") } if _, _, err := unix.Syscall(unix.SYS_FCNTL, uintptr(evFd), unix.F_GETFD, 0); err != unix.EBADF {