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