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