Fix flaky test TestNotifyOnOOM

Fixes: #1228

It can be reproduced by applying this patch:
```diff
@@ -45,6 +46,7 @@ func registerMemoryEvent(cgDir string, evName string, arg string) (<-chan struct
        go func() {
                defer func() {
                        close(ch)
+                       <-time.After(1 * time.Second)
                        eventfd.Close()
                        evFile.Close()
                }()
```

We can close channel after fds were closed.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang 2017-08-14 15:18:59 +08:00
parent 3f2f8b84a7
commit 40a1fb0e2f
1 changed files with 1 additions and 1 deletions

View File

@ -44,9 +44,9 @@ func registerMemoryEvent(cgDir string, evName string, arg string) (<-chan struct
ch := make(chan struct{}) ch := make(chan struct{})
go func() { go func() {
defer func() { defer func() {
close(ch)
eventfd.Close() eventfd.Close()
evFile.Close() evFile.Close()
close(ch)
}() }()
buf := make([]byte, 8) buf := make([]byte, 8)
for { for {