Add self test to verify that Q2 limit is in effect
@@ -22,6 +22,7 @@ from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
+import io
import os
import sys
import time
@@ -678,6 +679,21 @@ class TcpAdaptor(TestCase):
print(result)
sys.stdout.flush()
assert result is None, "TCP_TEST Stop %s FAIL: %s" % (name, result)
+
+ # search the router log file to verify Q2 was hit
+ time.sleep(0.005) # wait for log file to be written
+ block_ct = 0
+ unblock_ct = 0
+ with io.open(self.INTA.logfile_path) as f:
+ for line in f:
+ if 'client link blocked on Q2 limit' in line:
+ block_ct += 1
+ if 'client link unblocked from Q2 limit' in line:
+ unblock_ct += 1
+ self.assertTrue(block_ct > 0)
+ self.assertEqual(block_ct, unblock_ct)
+
+
self.logger.log("TCP_TEST Stop %s SUCCESS" % name)
@SkipIfNeeded(DISABLE_SELECTOR_TESTS, DISABLE_SELECTOR_REASON)
