diff options
| author | jEzEk <[email protected]> | 2018-10-06 18:33:28 +0200 |
|---|---|---|
| committer | jEzEk <[email protected]> | 2018-10-25 18:33:32 +0200 |
| commit | f3d222beec9aa5a17746c4d1e151246f2e1112d0 (patch) | |
| tree | 875fb1b788a6a479e026918167968d80f53ca513 /xgb_test.go | |
| parent | 240ff301eda1821b047e9e691e54302cf99918d2 (diff) | |
test not timed out on blocking close fix
Diffstat (limited to 'xgb_test.go')
| -rw-r--r-- | xgb_test.go | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/xgb_test.go b/xgb_test.go index e6c9dea..7badfc4 100644 --- a/xgb_test.go +++ b/xgb_test.go @@ -154,20 +154,20 @@ func (l leaks) checkTesting(t *testing.T) { if _, ok := l.goroutines[id]; ok { continue } - t.Error(gr.name) + t.Log(gr.name, "\n", string(gr.stack)) } } func TestConnOpenClose(t *testing.T) { - t.Logf("creating new dummy blocking server") + //t.Logf("creating new dummy blocking server") s := newServer() defer func() { if err := s.Close(); err != nil { t.Errorf("server closing error: %v", err) } }() - t.Logf("new server created: %v", s) + //t.Logf("new server created: %v", s) defer leaksMonitor().checkTesting(t) @@ -175,17 +175,18 @@ func TestConnOpenClose(t *testing.T) { if err != nil { t.Fatalf("connect error: %v", err) } - t.Logf("connection to server created: %v", c) + //t.Logf("connection to server created: %v", c) - closeErr := make(chan error, 1) + closeErr := make(chan struct{}) + go func() { + //t.Logf("closing connection to server") + c.Close() + close(closeErr) + }() closeTimeout := time.Second select { - case closeErr <- func() error { - t.Logf("closing connection to server") - c.Close() - t.Logf("connection to server closed") - return nil - }(): + case <-closeErr: + //t.Logf("connection to server closed") case <-time.After(closeTimeout): t.Errorf("*Conn.Close() not responded for %v", closeTimeout) } |
