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