Skip to content

Commit 08298fa

Browse files
committed
patch 7.4.1377
Problem: Test_connect_waittime() is flaky. Solution: Ignore the "Connection reset by peer" error.
1 parent decb14d commit 08298fa

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

src/testdir/test_channel.vim

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,16 +304,26 @@ func Test_connect_waittime()
304304
call assert_true(reltimefloat(elapsed) < 1.0)
305305
endif
306306

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.
307310
let start = reltime()
308-
let handle = ch_open('localhost:9867', {'waittime': 500})
309-
if ch_status(handle) != "fail"
310-
" Oops, port does exists.
311-
call ch_close(handle)
312-
else
313-
" Failed connection should wait about 500 msec.
314-
let elapsed = reltime(start)
315-
call assert_true(reltimefloat(elapsed) < 1.0)
316-
endif
311+
try
312+
let handle = ch_open('localhost:9867', {'waittime': 500})
313+
if ch_status(handle) != "fail"
314+
" Oops, port does exists.
315+
call ch_close(handle)
316+
else
317+
" Failed connection should wait about 500 msec.
318+
let elapsed = reltime(start)
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
317327
endfunc
318328

319329
func Test_raw_pipe()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,8 @@ static char *(features[]) =
747747

748748
static int included_patches[] =
749749
{ /* Add new patch number below this line */
750+
/**/
751+
1377,
750752
/**/
751753
1376,
752754
/**/

0 commit comments

Comments
 (0)