TestCloseTimeout checks that calling Close times out and proceeds, if sending the close message does not succeed.
(t *testing.T)
| 234 | // TestCloseTimeout checks that calling Close times out and proceeds, if sending |
| 235 | // the close message does not succeed. |
| 236 | func TestCloseTimeout(t *testing.T) { |
| 237 | oldCloseTimeout := CloseTimeout |
| 238 | CloseTimeout = 100 * time.Millisecond |
| 239 | defer func() { |
| 240 | CloseTimeout = oldCloseTimeout |
| 241 | }() |
| 242 | |
| 243 | m := newTestModel() |
| 244 | |
| 245 | rw := testutil.NewBlockingRW() |
| 246 | c := getRawConnection(NewConnection(c0ID, rw, rw, testutil.NoopCloser{}, m, new(mockedConnectionInfo), CompressionAlways, testKeyGen)) |
| 247 | c.Start() |
| 248 | defer closeAndWait(c, rw) |
| 249 | |
| 250 | done := make(chan struct{}) |
| 251 | go func() { |
| 252 | c.Close(errManual) |
| 253 | close(done) |
| 254 | }() |
| 255 | |
| 256 | select { |
| 257 | case <-done: |
| 258 | case <-time.After(5 * CloseTimeout): |
| 259 | t.Fatal("timed out before Close returned") |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | func TestUnmarshalFDPUv16v17(t *testing.T) { |
| 264 | var fdpu bep.FileDownloadProgressUpdate |
nothing calls this directly
no test coverage detected