1 AT_BANNER([reconnect library])
3 ######################################################################
4 AT_SETUP([nothing happens if not enabled])
5 AT_KEYWORDS([reconnect])
9 OVS_CHECK_LCOV([test-reconnect < input], [0],
17 ######################################################################
18 AT_SETUP([quick connect, idle disconnect])
19 AT_KEYWORDS([reconnect])
20 AT_DATA([input], [enable
22 # Connection succeeds.
26 # Send inactivity probe.
30 # Idle timeout kills connection.
35 OVS_CHECK_LCOV([test-reconnect < input], [0],
38 in BACKOFF for 0 ms (0 ms backoff)
40 # Connection succeeds.
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
48 # Send inactivity probe.
53 in ACTIVE for 5000 ms (0 ms backoff)
54 connected (5000 ms), total 5000 ms connected
57 in IDLE for 0 ms (0 ms backoff)
59 # Idle timeout kills connection.
64 in IDLE for 5000 ms (0 ms backoff)
65 connected (10000 ms), total 10000 ms connected
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
75 ######################################################################
76 AT_SETUP([slow connect, idle disconnect])
77 AT_KEYWORDS([reconnect])
78 AT_DATA([input], [enable
84 # Connect after 500 ms.
89 # Send inactivity probe.
93 # Idle timeout kills connection.
98 OVS_CHECK_LCOV([test-reconnect < input], [0],
101 in BACKOFF for 0 ms (0 ms backoff)
107 in CONNECTING for 0 ms (0 ms backoff)
109 # Connect after 500 ms.
113 in CONNECTING for 500 ms (0 ms backoff)
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
122 # Send inactivity probe.
127 in ACTIVE for 5000 ms (0 ms backoff)
128 connected (5000 ms), total 5000 ms connected
131 in IDLE for 0 ms (0 ms backoff)
133 # Idle timeout kills connection.
138 in IDLE for 5000 ms (0 ms backoff)
139 connected (10000 ms), total 10000 ms connected
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
149 ######################################################################
150 AT_SETUP([connect backs off])
151 AT_KEYWORDS([reconnect])
152 AT_DATA([input], [enable
154 # First connection attempt fails after 1000 ms.
162 # Back off for 1000 ms.
166 # Second connection attempt fails after 1000 ms.
172 # Back off for 2000 ms.
176 # Third connection attempt fails after 2000 ms.
182 # Back off for 4000 ms.
186 # Third connection attempt fails after 4000 ms.
192 # Back off for 8000 ms.
196 # Third connection attempt fails after 8000 ms.
202 # Back off for 8000 ms.
206 # Fourth connection attempt fails after 8000 ms.
212 OVS_CHECK_LCOV([test-reconnect < input], [0],
215 in BACKOFF for 0 ms (0 ms backoff)
217 # First connection attempt fails after 1000 ms.
221 in CONNECTING for 0 ms (0 ms backoff)
228 in CONNECTING for 1000 ms (0 ms backoff)
232 in BACKOFF for 0 ms (1000 ms backoff)
233 0 successful connections out of 1 attempts, seqno 0
235 # Back off for 1000 ms.
240 in BACKOFF for 1000 ms (1000 ms backoff)
244 # Second connection attempt fails after 1000 ms.
246 in CONNECTING for 0 ms (1000 ms backoff)
251 in CONNECTING for 1000 ms (1000 ms backoff)
255 in BACKOFF for 0 ms (2000 ms backoff)
256 0 successful connections out of 2 attempts, seqno 0
258 # Back off for 2000 ms.
263 in BACKOFF for 2000 ms (2000 ms backoff)
267 # Third connection attempt fails after 2000 ms.
269 in CONNECTING for 0 ms (2000 ms backoff)
274 in CONNECTING for 2000 ms (2000 ms backoff)
278 in BACKOFF for 0 ms (4000 ms backoff)
279 0 successful connections out of 3 attempts, seqno 0
281 # Back off for 4000 ms.
286 in BACKOFF for 4000 ms (4000 ms backoff)
290 # Third connection attempt fails after 4000 ms.
292 in CONNECTING for 0 ms (4000 ms backoff)
297 in CONNECTING for 4000 ms (4000 ms backoff)
301 in BACKOFF for 0 ms (8000 ms backoff)
302 0 successful connections out of 4 attempts, seqno 0
304 # Back off for 8000 ms.
309 in BACKOFF for 8000 ms (8000 ms backoff)
313 # Third connection attempt fails after 8000 ms.
315 in CONNECTING for 0 ms (8000 ms backoff)
320 in CONNECTING for 8000 ms (8000 ms backoff)
324 in BACKOFF for 0 ms (8000 ms backoff)
325 0 successful connections out of 5 attempts, seqno 0
327 # Back off for 8000 ms.
332 in BACKOFF for 8000 ms (8000 ms backoff)
336 # Fourth connection attempt fails after 8000 ms.
338 in CONNECTING for 0 ms (8000 ms backoff)
343 in CONNECTING for 8000 ms (8000 ms backoff)
347 in BACKOFF for 0 ms (8000 ms backoff)
348 0 successful connections out of 6 attempts, seqno 0
352 ######################################################################
353 AT_SETUP([connections with no data preserve backoff])
354 AT_KEYWORDS([reconnect])
355 AT_DATA([input], [enable
357 # First connect, then idle timeout kills connection.
366 # Back off for 1000 ms.
370 # Second connect, then idle timeout kills connection.
379 # Back off for 2000 ms.
383 # Third connect, then idle timeout kills connection.
392 # Back off for 4000 ms.
396 in BACKOFF for 0 ms (0 ms backoff)
398 # First connect, then idle timeout kills connection.
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
409 in ACTIVE for 5000 ms (0 ms backoff)
410 connected (5000 ms), total 5000 ms connected
413 in IDLE for 0 ms (0 ms backoff)
418 in IDLE for 5000 ms (0 ms backoff)
419 connected (10000 ms), total 10000 ms connected
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
427 # Back off for 1000 ms.
432 in BACKOFF for 1000 ms (1000 ms backoff)
436 # Second connect, then idle timeout kills connection.
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
448 in ACTIVE for 5000 ms (1000 ms backoff)
449 connected (5000 ms), total 15000 ms connected
452 in IDLE for 0 ms (1000 ms backoff)
457 in IDLE for 5000 ms (1000 ms backoff)
458 connected (10000 ms), total 20000 ms connected
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
466 # Back off for 2000 ms.
471 in BACKOFF for 2000 ms (2000 ms backoff)
475 # Third connect, then idle timeout kills connection.
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
487 in ACTIVE for 5000 ms (2000 ms backoff)
488 connected (5000 ms), total 25000 ms connected
491 in IDLE for 0 ms (2000 ms backoff)
496 in IDLE for 5000 ms (2000 ms backoff)
497 connected (10000 ms), total 30000 ms connected
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
505 # Back off for 4000 ms.
510 in BACKOFF for 4000 ms (4000 ms backoff)
515 ######################################################################
516 AT_SETUP([brief connection preserves backoff])
517 AT_KEYWORDS([reconnect])
518 AT_DATA([input], [enable
520 # First connection attempt fails after 1000 ms.
528 # Back off for 1000 ms.
532 # Second connection attempt fails after 1000 ms.
538 # Back off for 2000 ms.
542 # Third connection attempt succeeds after 500 ms.
548 # Connection drops after another 250 ms.
553 # Back off for 4000 ms.
557 OVS_CHECK_LCOV([test-reconnect < input], [0],
560 in BACKOFF for 0 ms (0 ms backoff)
562 # First connection attempt fails after 1000 ms.
566 in CONNECTING for 0 ms (0 ms backoff)
573 in CONNECTING for 1000 ms (0 ms backoff)
577 in BACKOFF for 0 ms (1000 ms backoff)
578 0 successful connections out of 1 attempts, seqno 0
580 # Back off for 1000 ms.
585 in BACKOFF for 1000 ms (1000 ms backoff)
589 # Second connection attempt fails after 1000 ms.
591 in CONNECTING for 0 ms (1000 ms backoff)
596 in CONNECTING for 1000 ms (1000 ms backoff)
600 in BACKOFF for 0 ms (2000 ms backoff)
601 0 successful connections out of 2 attempts, seqno 0
603 # Back off for 2000 ms.
608 in BACKOFF for 2000 ms (2000 ms backoff)
612 # Third connection attempt succeeds after 500 ms.
614 in CONNECTING for 0 ms (2000 ms backoff)
618 in CONNECTING for 500 ms (2000 ms backoff)
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
627 # Connection drops after another 250 ms.
631 in ACTIVE for 250 ms (2000 ms backoff)
632 connected (250 ms), total 250 ms connected
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
639 # Back off for 4000 ms.
644 in BACKOFF for 4000 ms (4000 ms backoff)
650 ######################################################################
651 AT_SETUP([brief connection with data preserves backoff])
652 AT_KEYWORDS([reconnect])
653 AT_DATA([input], [enable
655 # First connection attempt fails after 1000 ms.
663 # Back off for 1000 ms.
667 # Second connection attempt fails after 1000 ms.
673 # Back off for 2000 ms.
677 # Third connection attempt succeeds after 500 ms.
683 # Connection receives 3 chunks of data spaced 250 ms apart.
698 # Back off for 4000 ms.
702 OVS_CHECK_LCOV([test-reconnect < input], [0],
705 in BACKOFF for 0 ms (0 ms backoff)
707 # First connection attempt fails after 1000 ms.
711 in CONNECTING for 0 ms (0 ms backoff)
718 in CONNECTING for 1000 ms (0 ms backoff)
722 in BACKOFF for 0 ms (1000 ms backoff)
723 0 successful connections out of 1 attempts, seqno 0
725 # Back off for 1000 ms.
730 in BACKOFF for 1000 ms (1000 ms backoff)
734 # Second connection attempt fails after 1000 ms.
736 in CONNECTING for 0 ms (1000 ms backoff)
741 in CONNECTING for 1000 ms (1000 ms backoff)
745 in BACKOFF for 0 ms (2000 ms backoff)
746 0 successful connections out of 2 attempts, seqno 0
748 # Back off for 2000 ms.
753 in BACKOFF for 2000 ms (2000 ms backoff)
757 # Third connection attempt succeeds after 500 ms.
759 in CONNECTING for 0 ms (2000 ms backoff)
763 in CONNECTING for 500 ms (2000 ms backoff)
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
772 # Connection receives 3 chunks of data spaced 250 ms apart.
776 in ACTIVE for 250 ms (2000 ms backoff)
777 connected (250 ms), total 250 ms connected
780 created 1000, last received 6750, last connected 6500
784 in ACTIVE for 500 ms (2000 ms backoff)
785 connected (500 ms), total 500 ms connected
788 created 1000, last received 7000, last connected 6500
792 in ACTIVE for 750 ms (2000 ms backoff)
793 connected (750 ms), total 750 ms connected
796 created 1000, last received 7250, last connected 6500
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
805 # Back off for 4000 ms.
810 in BACKOFF for 4000 ms (4000 ms backoff)
816 ######################################################################
817 AT_SETUP([long connection resets backoff])
818 AT_KEYWORDS([reconnect])
819 AT_DATA([input], [enable
821 # First connection attempt fails after 1000 ms.
829 # Back off for 1000 ms.
833 # Second connection attempt fails after 1000 ms.
839 # Back off for 2000 ms.
843 # Third connection attempt succeeds after 500 ms.
849 # Connection receives 3 chunks of data spaced 2000 ms apart.
864 # Back off for 1000 ms.
868 OVS_CHECK_LCOV([test-reconnect < input], [0],
871 in BACKOFF for 0 ms (0 ms backoff)
873 # First connection attempt fails after 1000 ms.
877 in CONNECTING for 0 ms (0 ms backoff)
884 in CONNECTING for 1000 ms (0 ms backoff)
888 in BACKOFF for 0 ms (1000 ms backoff)
889 0 successful connections out of 1 attempts, seqno 0
891 # Back off for 1000 ms.
896 in BACKOFF for 1000 ms (1000 ms backoff)
900 # Second connection attempt fails after 1000 ms.
902 in CONNECTING for 0 ms (1000 ms backoff)
907 in CONNECTING for 1000 ms (1000 ms backoff)
911 in BACKOFF for 0 ms (2000 ms backoff)
912 0 successful connections out of 2 attempts, seqno 0
914 # Back off for 2000 ms.
919 in BACKOFF for 2000 ms (2000 ms backoff)
923 # Third connection attempt succeeds after 500 ms.
925 in CONNECTING for 0 ms (2000 ms backoff)
929 in CONNECTING for 500 ms (2000 ms backoff)
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
938 # Connection receives 3 chunks of data spaced 2000 ms apart.
942 in ACTIVE for 2000 ms (2000 ms backoff)
943 connected (2000 ms), total 2000 ms connected
946 created 1000, last received 8500, last connected 6500
950 in ACTIVE for 4000 ms (2000 ms backoff)
951 connected (4000 ms), total 4000 ms connected
954 created 1000, last received 10500, last connected 6500
958 in ACTIVE for 6000 ms (2000 ms backoff)
959 connected (6000 ms), total 6000 ms connected
962 created 1000, last received 12500, last connected 6500
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
971 # Back off for 1000 ms.
976 in BACKOFF for 1000 ms (1000 ms backoff)
982 ######################################################################
983 AT_SETUP([connection attempt fails quickly])
984 AT_KEYWORDS([reconnect])
985 AT_DATA([input], [enable
987 # Connection fails quickly.
989 connect-failed ECONNREFUSED
991 # Back off for 1000 ms.
995 # Connection fails quickly again.
997 connect-failed ECONNREFUSED
999 # Back off for 2000 ms.
1003 OVS_CHECK_LCOV([test-reconnect < input], [0],
1006 in BACKOFF for 0 ms (0 ms backoff)
1008 # Connection fails quickly.
1011 connect-failed ECONNREFUSED
1012 in BACKOFF for 0 ms (1000 ms backoff)
1013 0 successful connections out of 1 attempts, seqno 0
1015 # Back off for 1000 ms.
1021 in BACKOFF for 1000 ms (1000 ms backoff)
1023 # Connection fails quickly again.
1026 connect-failed ECONNREFUSED
1027 in BACKOFF for 0 ms (2000 ms backoff)
1028 0 successful connections out of 2 attempts, seqno 0
1030 # Back off for 2000 ms.
1036 in BACKOFF for 2000 ms (2000 ms backoff)