Mercurial > vim
comparison src/testdir/test_channel.vim @ 8168:454a30a7590e v7.4.1377
commit https://github.com/vim/vim/commit/08298fa1d3e32c2af476582792fc4f70cd57a59a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 21 13:01:53 2016 +0100
patch 7.4.1377
Problem: Test_connect_waittime() is flaky.
Solution: Ignore the "Connection reset by peer" error.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 21 Feb 2016 13:15:04 +0100 |
parents | 973686665238 |
children | a0ffb1f3dedc |
comparison
equal
deleted
inserted
replaced
8167:9ca3885edfed | 8168:454a30a7590e |
---|---|
302 else | 302 else |
303 let elapsed = reltime(start) | 303 let elapsed = reltime(start) |
304 call assert_true(reltimefloat(elapsed) < 1.0) | 304 call assert_true(reltimefloat(elapsed) < 1.0) |
305 endif | 305 endif |
306 | 306 |
307 " We intend to use a socket that doesn't exist and wait for half a second | |
308 " before giving up. If the socket does exist it can fail in various ways. | |
309 " Check for "Connection reset by peer" to avoid flakyness. | |
307 let start = reltime() | 310 let start = reltime() |
308 let handle = ch_open('localhost:9867', {'waittime': 500}) | 311 try |
309 if ch_status(handle) != "fail" | 312 let handle = ch_open('localhost:9867', {'waittime': 500}) |
310 " Oops, port does exists. | 313 if ch_status(handle) != "fail" |
311 call ch_close(handle) | 314 " Oops, port does exists. |
312 else | 315 call ch_close(handle) |
313 " Failed connection should wait about 500 msec. | 316 else |
314 let elapsed = reltime(start) | 317 " Failed connection should wait about 500 msec. |
315 call assert_true(reltimefloat(elapsed) < 1.0) | 318 let elapsed = reltime(start) |
316 endif | 319 call assert_true(reltimefloat(elapsed) > 0.3) |
320 call assert_true(reltimefloat(elapsed) < 1.0) | |
321 endif | |
322 catch | |
323 if v:exception !~ 'Connection reset by peer' | |
324 call assert_false(1, "Caught exception: " . v:exception) | |
325 endif | |
326 endtry | |
317 endfunc | 327 endfunc |
318 | 328 |
319 func Test_raw_pipe() | 329 func Test_raw_pipe() |
320 if !has('job') | 330 if !has('job') |
321 return | 331 return |