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