]> git.proxmox.com Git - mirror_ovs.git/blame - tests/reconnect.at
list: Remove lib/list.h completely.
[mirror_ovs.git] / tests / reconnect.at
CommitLineData
3ed497fc
BP
1AT_BANNER([reconnect library])
2
d1b680c6
BP
3m4_define([__RECONNECT_CHECK],
4 [AT_SETUP([$1])
99155935 5 $2
d1b680c6 6 AT_KEYWORDS([reconnect])
99155935
BP
7 AT_DATA([input], [$3])
8 AT_CHECK([$4], [0], [$5])
d1b680c6
BP
9 AT_CLEANUP])
10
11m4_define([RECONNECT_CHECK],
99155935
BP
12 [__RECONNECT_CHECK(
13 [$1 - C],
14 [],
15 [$2],
eadd1644 16 [ovstest test-reconnect < input],
99155935
BP
17 [$3])
18 __RECONNECT_CHECK(
9a4d919a 19 [$1 - Python2],
99155935
BP
20 [AT_SKIP_IF([test $HAVE_PYTHON = no])],
21 [$2],
22 [$PYTHON $srcdir/test-reconnect.py < input],
9a4d919a
RB
23 [$3])
24 __RECONNECT_CHECK(
25 [$1 - Python3],
26 [AT_SKIP_IF([test $HAVE_PYTHON3 = no])],
27 [$2],
28 [$PYTHON3 $srcdir/test-reconnect.py < input],
99155935 29 [$3])])
d1b680c6 30
3ed497fc 31######################################################################
d1b680c6
BP
32RECONNECT_CHECK([nothing happens if not enabled],
33 [run
3ed497fc 34timeout
d1b680c6 35],
3ed497fc
BP
36 [### t=1000 ###
37run
38timeout
39 no timeout
40])
3ed497fc
BP
41
42######################################################################
d1b680c6
BP
43RECONNECT_CHECK([quick connect, idle disconnect],
44 [enable
3ed497fc
BP
45
46# Connection succeeds.
47run
48connected
49
50# Send inactivity probe.
51timeout
52run
53
54# Idle timeout kills connection.
55timeout
56run
57disconnected
d1b680c6 58],
3ed497fc
BP
59 [### t=1000 ###
60enable
61 in BACKOFF for 0 ms (0 ms backoff)
62
63# Connection succeeds.
64run
65 should connect
66connected
67 in ACTIVE for 0 ms (0 ms backoff)
a6f639f8 68 created 1000, last activity 1000, last connected 1000
3ed497fc 69 1 successful connections out of 1 attempts, seqno 1
5eda645e
AE
70 connected
71 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
72
73# Send inactivity probe.
74timeout
75 advance 5000 ms
76
77### t=6000 ###
78 in ACTIVE for 5000 ms (0 ms backoff)
3ed497fc
BP
79run
80 should send probe
81 in IDLE for 0 ms (0 ms backoff)
82
83# Idle timeout kills connection.
84timeout
85 advance 5000 ms
86
87### t=11000 ###
88 in IDLE for 5000 ms (0 ms backoff)
3ed497fc
BP
89run
90 should disconnect
91disconnected
92 in BACKOFF for 0 ms (1000 ms backoff)
93 1 successful connections out of 1 attempts, seqno 2
5eda645e 94 disconnected
eba18f00 95 disconnected at 11000 ms (0 ms ago)
3ed497fc 96])
3ed497fc
BP
97
98######################################################################
d1b680c6
BP
99RECONNECT_CHECK([slow connect, idle disconnect],
100 [enable
3ed497fc
BP
101
102# Start connecting.
103run
104connecting
105
106# Connect after 500 ms.
107advance 500
108run
109connected
110
111# Send inactivity probe.
112timeout
113run
114
115# Idle timeout kills connection.
116timeout
117run
118disconnected
d1b680c6 119],
3ed497fc
BP
120 [### t=1000 ###
121enable
122 in BACKOFF for 0 ms (0 ms backoff)
123
124# Start connecting.
125run
126 should connect
127connecting
c36cf65e 128 in CONNECTING for 0 ms (0 ms backoff)
3ed497fc
BP
129
130# Connect after 500 ms.
131advance 500
132
133### t=1500 ###
c36cf65e 134 in CONNECTING for 500 ms (0 ms backoff)
3ed497fc 135run
3ed497fc
BP
136connected
137 in ACTIVE for 0 ms (0 ms backoff)
a6f639f8 138 created 1000, last activity 1000, last connected 1500
3ed497fc 139 1 successful connections out of 1 attempts, seqno 1
5eda645e
AE
140 connected
141 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
142
143# Send inactivity probe.
144timeout
145 advance 5000 ms
146
147### t=6500 ###
148 in ACTIVE for 5000 ms (0 ms backoff)
3ed497fc
BP
149run
150 should send probe
151 in IDLE for 0 ms (0 ms backoff)
152
153# Idle timeout kills connection.
154timeout
155 advance 5000 ms
156
157### t=11500 ###
158 in IDLE for 5000 ms (0 ms backoff)
3ed497fc
BP
159run
160 should disconnect
161disconnected
162 in BACKOFF for 0 ms (1000 ms backoff)
163 1 successful connections out of 1 attempts, seqno 2
5eda645e 164 disconnected
eba18f00 165 disconnected at 11500 ms (0 ms ago)
3ed497fc 166])
3ed497fc
BP
167
168######################################################################
d1b680c6
BP
169RECONNECT_CHECK([connect backs off],
170 [enable
3ed497fc
BP
171
172# First connection attempt fails after 1000 ms.
173run
174connecting
175run
176timeout
177run
178connect-failed
179
180# Back off for 1000 ms.
181timeout
182run
183
184# Second connection attempt fails after 1000 ms.
185connecting
186timeout
187run
188connect-failed
189
190# Back off for 2000 ms.
191timeout
192run
193
194# Third connection attempt fails after 2000 ms.
195connecting
196timeout
197run
198connect-failed
199
200# Back off for 4000 ms.
201timeout
202run
203
204# Third connection attempt fails after 4000 ms.
205connecting
206timeout
207run
208connect-failed
209
210# Back off for 8000 ms.
211timeout
212run
213
214# Third connection attempt fails after 8000 ms.
215connecting
216timeout
217run
218connect-failed
219
220# Back off for 8000 ms.
221timeout
222run
223
224# Fourth connection attempt fails after 8000 ms.
225connecting
226timeout
227run
228connect-failed
d1b680c6 229],
3ed497fc
BP
230 [### t=1000 ###
231enable
232 in BACKOFF for 0 ms (0 ms backoff)
233
234# First connection attempt fails after 1000 ms.
235run
236 should connect
237connecting
c36cf65e 238 in CONNECTING for 0 ms (0 ms backoff)
3ed497fc 239run
3ed497fc
BP
240timeout
241 advance 1000 ms
242
243### t=2000 ###
c36cf65e 244 in CONNECTING for 1000 ms (0 ms backoff)
3ed497fc
BP
245run
246 should disconnect
247connect-failed
248 in BACKOFF for 0 ms (1000 ms backoff)
249 0 successful connections out of 1 attempts, seqno 0
250
251# Back off for 1000 ms.
252timeout
253 advance 1000 ms
254
255### t=3000 ###
256 in BACKOFF for 1000 ms (1000 ms backoff)
257run
258 should connect
259
260# Second connection attempt fails after 1000 ms.
261connecting
c36cf65e 262 in CONNECTING for 0 ms (1000 ms backoff)
3ed497fc
BP
263timeout
264 advance 1000 ms
265
266### t=4000 ###
c36cf65e 267 in CONNECTING for 1000 ms (1000 ms backoff)
3ed497fc
BP
268run
269 should disconnect
270connect-failed
271 in BACKOFF for 0 ms (2000 ms backoff)
272 0 successful connections out of 2 attempts, seqno 0
273
274# Back off for 2000 ms.
275timeout
276 advance 2000 ms
277
278### t=6000 ###
279 in BACKOFF for 2000 ms (2000 ms backoff)
280run
281 should connect
282
283# Third connection attempt fails after 2000 ms.
284connecting
c36cf65e 285 in CONNECTING for 0 ms (2000 ms backoff)
3ed497fc
BP
286timeout
287 advance 2000 ms
288
289### t=8000 ###
c36cf65e 290 in CONNECTING for 2000 ms (2000 ms backoff)
3ed497fc
BP
291run
292 should disconnect
293connect-failed
294 in BACKOFF for 0 ms (4000 ms backoff)
295 0 successful connections out of 3 attempts, seqno 0
296
297# Back off for 4000 ms.
298timeout
299 advance 4000 ms
300
301### t=12000 ###
302 in BACKOFF for 4000 ms (4000 ms backoff)
303run
304 should connect
305
306# Third connection attempt fails after 4000 ms.
307connecting
c36cf65e 308 in CONNECTING for 0 ms (4000 ms backoff)
3ed497fc
BP
309timeout
310 advance 4000 ms
311
312### t=16000 ###
c36cf65e 313 in CONNECTING for 4000 ms (4000 ms backoff)
3ed497fc
BP
314run
315 should disconnect
316connect-failed
317 in BACKOFF for 0 ms (8000 ms backoff)
318 0 successful connections out of 4 attempts, seqno 0
319
320# Back off for 8000 ms.
321timeout
322 advance 8000 ms
323
324### t=24000 ###
325 in BACKOFF for 8000 ms (8000 ms backoff)
326run
327 should connect
328
329# Third connection attempt fails after 8000 ms.
330connecting
c36cf65e 331 in CONNECTING for 0 ms (8000 ms backoff)
3ed497fc
BP
332timeout
333 advance 8000 ms
334
335### t=32000 ###
c36cf65e 336 in CONNECTING for 8000 ms (8000 ms backoff)
3ed497fc
BP
337run
338 should disconnect
339connect-failed
340 in BACKOFF for 0 ms (8000 ms backoff)
341 0 successful connections out of 5 attempts, seqno 0
342
343# Back off for 8000 ms.
344timeout
345 advance 8000 ms
346
347### t=40000 ###
348 in BACKOFF for 8000 ms (8000 ms backoff)
349run
350 should connect
351
352# Fourth connection attempt fails after 8000 ms.
353connecting
c36cf65e 354 in CONNECTING for 0 ms (8000 ms backoff)
3ed497fc
BP
355timeout
356 advance 8000 ms
357
358### t=48000 ###
c36cf65e 359 in CONNECTING for 8000 ms (8000 ms backoff)
3ed497fc
BP
360run
361 should disconnect
362connect-failed
363 in BACKOFF for 0 ms (8000 ms backoff)
364 0 successful connections out of 6 attempts, seqno 0
365])
3ed497fc
BP
366
367######################################################################
d1b680c6
BP
368RECONNECT_CHECK([connections with no data preserve backoff],
369 [enable
3ed497fc
BP
370
371# First connect, then idle timeout kills connection.
372run
373connected
374timeout
375run
376timeout
377run
378disconnected
379
380# Back off for 1000 ms.
381timeout
382run
383
384# Second connect, then idle timeout kills connection.
385run
386connected
387timeout
388run
389timeout
390run
391disconnected
392
393# Back off for 2000 ms.
394timeout
395run
396
397# Third connect, then idle timeout kills connection.
398run
399connected
400timeout
401run
402timeout
403run
404disconnected
405
406# Back off for 4000 ms.
407timeout
408], [### t=1000 ###
409enable
410 in BACKOFF for 0 ms (0 ms backoff)
411
412# First connect, then idle timeout kills connection.
413run
414 should connect
415connected
416 in ACTIVE for 0 ms (0 ms backoff)
a6f639f8 417 created 1000, last activity 1000, last connected 1000
3ed497fc 418 1 successful connections out of 1 attempts, seqno 1
5eda645e
AE
419 connected
420 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
421timeout
422 advance 5000 ms
423
424### t=6000 ###
425 in ACTIVE for 5000 ms (0 ms backoff)
3ed497fc
BP
426run
427 should send probe
428 in IDLE for 0 ms (0 ms backoff)
429timeout
430 advance 5000 ms
431
432### t=11000 ###
433 in IDLE for 5000 ms (0 ms backoff)
3ed497fc
BP
434run
435 should disconnect
436disconnected
437 in BACKOFF for 0 ms (1000 ms backoff)
438 1 successful connections out of 1 attempts, seqno 2
5eda645e 439 disconnected
eba18f00 440 disconnected at 11000 ms (0 ms ago)
3ed497fc
BP
441
442# Back off for 1000 ms.
443timeout
444 advance 1000 ms
445
446### t=12000 ###
447 in BACKOFF for 1000 ms (1000 ms backoff)
5eda645e 448 last connected 11000 ms ago, connected 10000 ms total
3ed497fc
BP
449run
450 should connect
451
452# Second connect, then idle timeout kills connection.
453run
454 should connect
455connected
456 in ACTIVE for 0 ms (1000 ms backoff)
a6f639f8 457 created 1000, last activity 1000, last connected 12000
3ed497fc 458 2 successful connections out of 2 attempts, seqno 3
5eda645e
AE
459 connected
460 last connected 0 ms ago, connected 10000 ms total
3ed497fc
BP
461timeout
462 advance 5000 ms
463
464### t=17000 ###
465 in ACTIVE for 5000 ms (1000 ms backoff)
3ed497fc
BP
466run
467 should send probe
468 in IDLE for 0 ms (1000 ms backoff)
469timeout
470 advance 5000 ms
471
472### t=22000 ###
473 in IDLE for 5000 ms (1000 ms backoff)
3ed497fc
BP
474run
475 should disconnect
476disconnected
477 in BACKOFF for 0 ms (2000 ms backoff)
478 2 successful connections out of 2 attempts, seqno 4
5eda645e 479 disconnected
eba18f00 480 disconnected at 22000 ms (0 ms ago)
3ed497fc
BP
481
482# Back off for 2000 ms.
483timeout
484 advance 2000 ms
485
486### t=24000 ###
487 in BACKOFF for 2000 ms (2000 ms backoff)
5eda645e 488 last connected 12000 ms ago, connected 20000 ms total
3ed497fc
BP
489run
490 should connect
491
492# Third connect, then idle timeout kills connection.
493run
494 should connect
495connected
496 in ACTIVE for 0 ms (2000 ms backoff)
a6f639f8 497 created 1000, last activity 1000, last connected 24000
3ed497fc 498 3 successful connections out of 3 attempts, seqno 5
5eda645e
AE
499 connected
500 last connected 0 ms ago, connected 20000 ms total
3ed497fc
BP
501timeout
502 advance 5000 ms
503
504### t=29000 ###
505 in ACTIVE for 5000 ms (2000 ms backoff)
3ed497fc
BP
506run
507 should send probe
508 in IDLE for 0 ms (2000 ms backoff)
509timeout
510 advance 5000 ms
511
512### t=34000 ###
513 in IDLE for 5000 ms (2000 ms backoff)
3ed497fc
BP
514run
515 should disconnect
516disconnected
517 in BACKOFF for 0 ms (4000 ms backoff)
518 3 successful connections out of 3 attempts, seqno 6
5eda645e 519 disconnected
eba18f00 520 disconnected at 34000 ms (0 ms ago)
3ed497fc
BP
521
522# Back off for 4000 ms.
523timeout
524 advance 4000 ms
525
526### t=38000 ###
527 in BACKOFF for 4000 ms (4000 ms backoff)
5eda645e 528 last connected 14000 ms ago, connected 30000 ms total
3ed497fc 529])
3ed497fc
BP
530
531######################################################################
d1b680c6
BP
532RECONNECT_CHECK([brief connection preserves backoff],
533 [enable
3ed497fc
BP
534
535# First connection attempt fails after 1000 ms.
536run
537connecting
538run
539timeout
540run
541connect-failed
542
543# Back off for 1000 ms.
544timeout
545run
546
547# Second connection attempt fails after 1000 ms.
548connecting
549timeout
550run
551connect-failed
552
553# Back off for 2000 ms.
554timeout
555run
556
557# Third connection attempt succeeds after 500 ms.
558connecting
559advance 500
560run
561connected
562
563# Connection drops after another 250 ms.
564advance 250
565disconnected
566run
567
568# Back off for 4000 ms.
569timeout
570run
d1b680c6 571], [### t=1000 ###
3ed497fc
BP
572enable
573 in BACKOFF for 0 ms (0 ms backoff)
574
575# First connection attempt fails after 1000 ms.
576run
577 should connect
578connecting
c36cf65e 579 in CONNECTING for 0 ms (0 ms backoff)
3ed497fc 580run
3ed497fc
BP
581timeout
582 advance 1000 ms
583
584### t=2000 ###
c36cf65e 585 in CONNECTING for 1000 ms (0 ms backoff)
3ed497fc
BP
586run
587 should disconnect
588connect-failed
589 in BACKOFF for 0 ms (1000 ms backoff)
590 0 successful connections out of 1 attempts, seqno 0
591
592# Back off for 1000 ms.
593timeout
594 advance 1000 ms
595
596### t=3000 ###
597 in BACKOFF for 1000 ms (1000 ms backoff)
598run
599 should connect
600
601# Second connection attempt fails after 1000 ms.
602connecting
c36cf65e 603 in CONNECTING for 0 ms (1000 ms backoff)
3ed497fc
BP
604timeout
605 advance 1000 ms
606
607### t=4000 ###
c36cf65e 608 in CONNECTING for 1000 ms (1000 ms backoff)
3ed497fc
BP
609run
610 should disconnect
611connect-failed
612 in BACKOFF for 0 ms (2000 ms backoff)
613 0 successful connections out of 2 attempts, seqno 0
614
615# Back off for 2000 ms.
616timeout
617 advance 2000 ms
618
619### t=6000 ###
620 in BACKOFF for 2000 ms (2000 ms backoff)
621run
622 should connect
623
624# Third connection attempt succeeds after 500 ms.
625connecting
c36cf65e 626 in CONNECTING for 0 ms (2000 ms backoff)
3ed497fc
BP
627advance 500
628
629### t=6500 ###
c36cf65e 630 in CONNECTING for 500 ms (2000 ms backoff)
3ed497fc 631run
3ed497fc
BP
632connected
633 in ACTIVE for 0 ms (2000 ms backoff)
a6f639f8 634 created 1000, last activity 1000, last connected 6500
3ed497fc 635 1 successful connections out of 3 attempts, seqno 1
5eda645e
AE
636 connected
637 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
638
639# Connection drops after another 250 ms.
640advance 250
641
642### t=6750 ###
643 in ACTIVE for 250 ms (2000 ms backoff)
3ed497fc
BP
644disconnected
645 in BACKOFF for 0 ms (4000 ms backoff)
646 1 successful connections out of 3 attempts, seqno 2
5eda645e 647 disconnected
eba18f00 648 disconnected at 6750 ms (0 ms ago)
3ed497fc
BP
649run
650
651# Back off for 4000 ms.
652timeout
653 advance 4000 ms
654
655### t=10750 ###
656 in BACKOFF for 4000 ms (4000 ms backoff)
5eda645e 657 last connected 4250 ms ago, connected 250 ms total
3ed497fc
BP
658run
659 should connect
660])
3ed497fc
BP
661
662######################################################################
d1b680c6
BP
663RECONNECT_CHECK([brief connection with data preserves backoff],
664 [enable
3ed497fc
BP
665
666# First connection attempt fails after 1000 ms.
667run
668connecting
669run
670timeout
671run
672connect-failed
673
674# Back off for 1000 ms.
675timeout
676run
677
678# Second connection attempt fails after 1000 ms.
679connecting
680timeout
681run
682connect-failed
683
684# Back off for 2000 ms.
685timeout
686run
687
688# Third connection attempt succeeds after 500 ms.
689connecting
690advance 500
691run
692connected
693
694# Connection receives 3 chunks of data spaced 250 ms apart.
695advance 250
696run
a6f639f8 697activity
3ed497fc
BP
698advance 250
699run
a6f639f8 700activity
3ed497fc
BP
701advance 250
702run
a6f639f8 703activity
3ed497fc
BP
704
705# Connection drops.
706disconnected
707run
708
709# Back off for 4000 ms.
710timeout
711run
d1b680c6 712],
3ed497fc
BP
713 [### t=1000 ###
714enable
715 in BACKOFF for 0 ms (0 ms backoff)
716
717# First connection attempt fails after 1000 ms.
718run
719 should connect
720connecting
c36cf65e 721 in CONNECTING for 0 ms (0 ms backoff)
3ed497fc 722run
3ed497fc
BP
723timeout
724 advance 1000 ms
725
726### t=2000 ###
c36cf65e 727 in CONNECTING for 1000 ms (0 ms backoff)
3ed497fc
BP
728run
729 should disconnect
730connect-failed
731 in BACKOFF for 0 ms (1000 ms backoff)
732 0 successful connections out of 1 attempts, seqno 0
733
734# Back off for 1000 ms.
735timeout
736 advance 1000 ms
737
738### t=3000 ###
739 in BACKOFF for 1000 ms (1000 ms backoff)
740run
741 should connect
742
743# Second connection attempt fails after 1000 ms.
744connecting
c36cf65e 745 in CONNECTING for 0 ms (1000 ms backoff)
3ed497fc
BP
746timeout
747 advance 1000 ms
748
749### t=4000 ###
c36cf65e 750 in CONNECTING for 1000 ms (1000 ms backoff)
3ed497fc
BP
751run
752 should disconnect
753connect-failed
754 in BACKOFF for 0 ms (2000 ms backoff)
755 0 successful connections out of 2 attempts, seqno 0
756
757# Back off for 2000 ms.
758timeout
759 advance 2000 ms
760
761### t=6000 ###
762 in BACKOFF for 2000 ms (2000 ms backoff)
763run
764 should connect
765
766# Third connection attempt succeeds after 500 ms.
767connecting
c36cf65e 768 in CONNECTING for 0 ms (2000 ms backoff)
3ed497fc
BP
769advance 500
770
771### t=6500 ###
c36cf65e 772 in CONNECTING for 500 ms (2000 ms backoff)
3ed497fc 773run
3ed497fc
BP
774connected
775 in ACTIVE for 0 ms (2000 ms backoff)
a6f639f8 776 created 1000, last activity 1000, last connected 6500
3ed497fc 777 1 successful connections out of 3 attempts, seqno 1
5eda645e
AE
778 connected
779 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
780
781# Connection receives 3 chunks of data spaced 250 ms apart.
782advance 250
783
784### t=6750 ###
785 in ACTIVE for 250 ms (2000 ms backoff)
3ed497fc 786run
a6f639f8
BP
787activity
788 created 1000, last activity 6750, last connected 6500
3ed497fc
BP
789advance 250
790
791### t=7000 ###
792 in ACTIVE for 500 ms (2000 ms backoff)
3ed497fc 793run
a6f639f8
BP
794activity
795 created 1000, last activity 7000, last connected 6500
3ed497fc
BP
796advance 250
797
798### t=7250 ###
799 in ACTIVE for 750 ms (2000 ms backoff)
3ed497fc 800run
a6f639f8
BP
801activity
802 created 1000, last activity 7250, last connected 6500
3ed497fc
BP
803
804# Connection drops.
805disconnected
806 in BACKOFF for 0 ms (4000 ms backoff)
807 1 successful connections out of 3 attempts, seqno 2
5eda645e 808 disconnected
eba18f00 809 disconnected at 7250 ms (0 ms ago)
3ed497fc
BP
810run
811
812# Back off for 4000 ms.
813timeout
814 advance 4000 ms
815
816### t=11250 ###
817 in BACKOFF for 4000 ms (4000 ms backoff)
5eda645e 818 last connected 4750 ms ago, connected 750 ms total
3ed497fc
BP
819run
820 should connect
821])
3ed497fc
BP
822
823######################################################################
d1b680c6
BP
824RECONNECT_CHECK([long connection resets backoff],
825 [enable
3ed497fc
BP
826
827# First connection attempt fails after 1000 ms.
828run
829connecting
830run
831timeout
832run
833connect-failed
834
835# Back off for 1000 ms.
836timeout
837run
838
839# Second connection attempt fails after 1000 ms.
840connecting
841timeout
842run
843connect-failed
844
845# Back off for 2000 ms.
846timeout
847run
848
849# Third connection attempt succeeds after 500 ms.
850connecting
851advance 500
852run
853connected
854
855# Connection receives 3 chunks of data spaced 2000 ms apart.
856advance 2000
857run
a6f639f8 858activity
3ed497fc
BP
859advance 2000
860run
a6f639f8 861activity
3ed497fc
BP
862advance 2000
863run
a6f639f8 864activity
3ed497fc
BP
865
866# Connection drops.
867disconnected
868run
869
870# Back off for 1000 ms.
871timeout
872run
d1b680c6 873],
3ed497fc
BP
874 [### t=1000 ###
875enable
876 in BACKOFF for 0 ms (0 ms backoff)
877
878# First connection attempt fails after 1000 ms.
879run
880 should connect
881connecting
c36cf65e 882 in CONNECTING for 0 ms (0 ms backoff)
3ed497fc 883run
3ed497fc
BP
884timeout
885 advance 1000 ms
886
887### t=2000 ###
c36cf65e 888 in CONNECTING for 1000 ms (0 ms backoff)
3ed497fc
BP
889run
890 should disconnect
891connect-failed
892 in BACKOFF for 0 ms (1000 ms backoff)
893 0 successful connections out of 1 attempts, seqno 0
894
895# Back off for 1000 ms.
896timeout
897 advance 1000 ms
898
899### t=3000 ###
900 in BACKOFF for 1000 ms (1000 ms backoff)
901run
902 should connect
903
904# Second connection attempt fails after 1000 ms.
905connecting
c36cf65e 906 in CONNECTING for 0 ms (1000 ms backoff)
3ed497fc
BP
907timeout
908 advance 1000 ms
909
910### t=4000 ###
c36cf65e 911 in CONNECTING for 1000 ms (1000 ms backoff)
3ed497fc
BP
912run
913 should disconnect
914connect-failed
915 in BACKOFF for 0 ms (2000 ms backoff)
916 0 successful connections out of 2 attempts, seqno 0
917
918# Back off for 2000 ms.
919timeout
920 advance 2000 ms
921
922### t=6000 ###
923 in BACKOFF for 2000 ms (2000 ms backoff)
924run
925 should connect
926
927# Third connection attempt succeeds after 500 ms.
928connecting
c36cf65e 929 in CONNECTING for 0 ms (2000 ms backoff)
3ed497fc
BP
930advance 500
931
932### t=6500 ###
c36cf65e 933 in CONNECTING for 500 ms (2000 ms backoff)
3ed497fc 934run
3ed497fc
BP
935connected
936 in ACTIVE for 0 ms (2000 ms backoff)
a6f639f8 937 created 1000, last activity 1000, last connected 6500
3ed497fc 938 1 successful connections out of 3 attempts, seqno 1
5eda645e
AE
939 connected
940 last connected 0 ms ago, connected 0 ms total
3ed497fc
BP
941
942# Connection receives 3 chunks of data spaced 2000 ms apart.
943advance 2000
944
945### t=8500 ###
946 in ACTIVE for 2000 ms (2000 ms backoff)
3ed497fc 947run
a6f639f8
BP
948activity
949 created 1000, last activity 8500, last connected 6500
3ed497fc
BP
950advance 2000
951
952### t=10500 ###
953 in ACTIVE for 4000 ms (2000 ms backoff)
3ed497fc 954run
a6f639f8
BP
955activity
956 created 1000, last activity 10500, last connected 6500
3ed497fc
BP
957advance 2000
958
959### t=12500 ###
960 in ACTIVE for 6000 ms (2000 ms backoff)
3ed497fc 961run
a6f639f8
BP
962activity
963 created 1000, last activity 12500, last connected 6500
3ed497fc
BP
964
965# Connection drops.
966disconnected
967 in BACKOFF for 0 ms (1000 ms backoff)
968 1 successful connections out of 3 attempts, seqno 2
5eda645e 969 disconnected
eba18f00 970 disconnected at 12500 ms (0 ms ago)
3ed497fc
BP
971run
972
973# Back off for 1000 ms.
974timeout
975 advance 1000 ms
976
977### t=13500 ###
978 in BACKOFF for 1000 ms (1000 ms backoff)
5eda645e 979 last connected 7000 ms ago, connected 6000 ms total
3ed497fc
BP
980run
981 should connect
982])
3ed497fc
BP
983
984######################################################################
d1b680c6
BP
985RECONNECT_CHECK([connection attempt fails quickly],
986 [enable
3ed497fc
BP
987
988# Connection fails quickly.
989run
990connect-failed ECONNREFUSED
991
992# Back off for 1000 ms.
993run
994timeout
995
996# Connection fails quickly again.
997run
998connect-failed ECONNREFUSED
999
1000# Back off for 2000 ms.
1001run
1002timeout
d1b680c6
BP
1003],
1004 [### t=1000 ###
3ed497fc
BP
1005enable
1006 in BACKOFF for 0 ms (0 ms backoff)
1007
1008# Connection fails quickly.
1009run
1010 should connect
1011connect-failed ECONNREFUSED
1012 in BACKOFF for 0 ms (1000 ms backoff)
1013 0 successful connections out of 1 attempts, seqno 0
1014
1015# Back off for 1000 ms.
1016run
1017timeout
1018 advance 1000 ms
1019
1020### t=2000 ###
1021 in BACKOFF for 1000 ms (1000 ms backoff)
1022
1023# Connection fails quickly again.
1024run
1025 should connect
1026connect-failed ECONNREFUSED
1027 in BACKOFF for 0 ms (2000 ms backoff)
1028 0 successful connections out of 2 attempts, seqno 0
1029
1030# Back off for 2000 ms.
1031run
1032timeout
1033 advance 2000 ms
1034
1035### t=4000 ###
1036 in BACKOFF for 2000 ms (2000 ms backoff)
1037])
3ed497fc 1038
a85c0bbc 1039######################################################################
d1b680c6
BP
1040RECONNECT_CHECK([max-tries of 1 honored],
1041 [set-max-tries 1
a85c0bbc
BP
1042enable
1043
1044# Connection succeeds.
1045run
1046connected
1047
1048# Send inactivity probe.
1049timeout
1050run
1051
1052# Idle timeout kills connection.
1053timeout
1054run
1055disconnected
d1b680c6 1056],
a85c0bbc
BP
1057 [### t=1000 ###
1058set-max-tries 1
1059 1 tries left
1060enable
1061 in BACKOFF for 0 ms (0 ms backoff)
1062 0 tries left
1063
1064# Connection succeeds.
1065run
1066 should connect
1067connected
1068 in ACTIVE for 0 ms (0 ms backoff)
a6f639f8 1069 created 1000, last activity 1000, last connected 1000
a85c0bbc 1070 1 successful connections out of 1 attempts, seqno 1
5eda645e
AE
1071 connected
1072 last connected 0 ms ago, connected 0 ms total
a85c0bbc
BP
1073
1074# Send inactivity probe.
1075timeout
1076 advance 5000 ms
1077
1078### t=6000 ###
1079 in ACTIVE for 5000 ms (0 ms backoff)
a85c0bbc
BP
1080run
1081 should send probe
1082 in IDLE for 0 ms (0 ms backoff)
1083
1084# Idle timeout kills connection.
1085timeout
1086 advance 5000 ms
1087
1088### t=11000 ###
1089 in IDLE for 5000 ms (0 ms backoff)
a85c0bbc
BP
1090run
1091 should disconnect
1092disconnected
1093 in VOID for 0 ms (1000 ms backoff)
1094 1 successful connections out of 1 attempts, seqno 2
5eda645e 1095 disconnected
eba18f00 1096 disconnected at 11000 ms (0 ms ago)
a85c0bbc 1097])
a85c0bbc
BP
1098
1099######################################################################
d1b680c6
BP
1100RECONNECT_CHECK([max-tries of 0 honored],
1101 [set-max-tries 0
a85c0bbc
BP
1102enable
1103run
1104timeout
d1b680c6 1105],
a85c0bbc
BP
1106 [### t=1000 ###
1107set-max-tries 0
1108 0 tries left
1109enable
1110run
1111timeout
1112 no timeout
1113])
19df7f51
BP
1114
1115######################################################################
d1b680c6
BP
1116RECONNECT_CHECK([passive mode],
1117 [passive
19df7f51
BP
1118enable
1119
1120# Start listening.
1121timeout
1122run
1123listening
1124
1125# Listening never times out.
1126timeout
1127run
1128
1129# Listening failed (accept() returned funny error?). Back off and try again.
1130listen-error 0
1131timeout
1132run
1133listening
1134
1135# Connection accepted.
1136connected
a6f639f8 1137activity
19df7f51 1138advance 1000
a6f639f8 1139activity
19df7f51
BP
1140
1141# Connection times out.
1142timeout
1143run
1144timeout
1145run
1146disconnected
1147
1148# Start listening again.
1149timeout
1150run
1151listening
d1b680c6 1152],
19df7f51
BP
1153 [### t=1000 ###
1154passive
1155enable
1156 in BACKOFF for 0 ms (0 ms backoff)
1157
1158# Start listening.
1159timeout
1160 advance 0 ms
1161run
1162 should connect
1163listening
1164 in LISTENING for 0 ms (0 ms backoff)
1165
1166# Listening never times out.
1167timeout
1168 no timeout
1169run
1170
1171# Listening failed (accept() returned funny error?). Back off and try again.
1172listen-error 0
1173 in BACKOFF for 0 ms (1000 ms backoff)
1174timeout
1175 advance 1000 ms
1176
1177### t=2000 ###
1178 in BACKOFF for 1000 ms (1000 ms backoff)
1179run
1180 should connect
1181listening
1182 in LISTENING for 0 ms (1000 ms backoff)
1183
1184# Connection accepted.
1185connected
1186 in ACTIVE for 0 ms (1000 ms backoff)
a6f639f8 1187 created 1000, last activity 1000, last connected 2000
19df7f51 1188 1 successful connections out of 1 attempts, seqno 1
5eda645e
AE
1189 connected
1190 last connected 0 ms ago, connected 0 ms total
a6f639f8
BP
1191activity
1192 created 1000, last activity 2000, last connected 2000
19df7f51
BP
1193advance 1000
1194
1195### t=3000 ###
1196 in ACTIVE for 1000 ms (1000 ms backoff)
a6f639f8
BP
1197activity
1198 created 1000, last activity 3000, last connected 2000
19df7f51
BP
1199
1200# Connection times out.
1201timeout
1202 advance 5000 ms
1203
1204### t=8000 ###
1205 in ACTIVE for 6000 ms (1000 ms backoff)
19df7f51
BP
1206run
1207 should send probe
1208 in IDLE for 0 ms (1000 ms backoff)
1209timeout
1210 advance 5000 ms
1211
1212### t=13000 ###
1213 in IDLE for 5000 ms (1000 ms backoff)
19df7f51
BP
1214run
1215 should disconnect
1216disconnected
1217 in BACKOFF for 0 ms (0 ms backoff)
1218 1 successful connections out of 1 attempts, seqno 2
5eda645e 1219 disconnected
eba18f00 1220 disconnected at 13000 ms (0 ms ago)
19df7f51
BP
1221
1222# Start listening again.
1223timeout
1224 advance 0 ms
1225run
1226 should connect
1227listening
1228 in LISTENING for 0 ms (0 ms backoff)
1229])