[asterisk-commits] Remove hard coded tcp ports in SIPP tcpauthlimit tests (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 5 09:56:35 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/5576 )

Change subject: Remove hard coded tcp ports in SIPP tcpauthlimit tests
......................................................................


Remove hard coded tcp ports in SIPP tcpauthlimit tests

If a test attempts to use a local TCP port that was just used by
a previous test, chances are that that port will still be in
TIME_WAIT state and the test will fail.

Removed the hard coded local ports in the sipp_client_scanrio
and tcp_client_scenario tests.

Re-enabled the tcp_client_scenario test.

Change-Id: Ifa93373193b0933a99cad4fd4741190652656745
---
M tests/channels/SIP/tcpauthlimit/sipp_client_scenario/configs/ast1/sip.conf
M tests/channels/SIP/tcpauthlimit/sipp_client_scenario/sipp/uac.xml
M tests/channels/SIP/tcpauthlimit/sipp_client_scenario/test-config.yaml
M tests/channels/SIP/tcpauthlimit/tcp_client_scenario/tcp_scenario.py
M tests/channels/SIP/tcpauthlimit/tcp_client_scenario/test-config.yaml
5 files changed, 22 insertions(+), 33 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Jenkins2: Approved for Submit
  Joshua Colp: Looks good to me, approved



diff --git a/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/configs/ast1/sip.conf b/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/configs/ast1/sip.conf
index e7d1176..4faa548 100644
--- a/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/configs/ast1/sip.conf
+++ b/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/configs/ast1/sip.conf
@@ -13,31 +13,21 @@
 secret=RErm9C
 
 [minion_bob](minion-template)
-port=5062
 
 [minion_dave](minion-template)
-port=5063
 
 [minion_jerry](minion-template)
-port=5064
 
 [minion_jon](minion-template)
-port=5065
 
 [minion_jorge](minion-template)
-port=5066
 
 [minion_kevin](minion-template)
-port=5067
 
 [minion_mark](minion-template)
-port=5068
 
 [minion_phil](minion-template)
-port=5069
 
 [minion_stuart](minion-template)
-port=5070
 
 [minion_tim](minion-template)
-port=5071
diff --git a/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/sipp/uac.xml b/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/sipp/uac.xml
index ba0dcf0..5896452 100644
--- a/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/sipp/uac.xml
+++ b/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/sipp/uac.xml
@@ -33,7 +33,7 @@
     <recv response="401" auth="true" rtd="true"/>
 
     <!-- Wait a couple of seconds before proceeding -->
-    <pause milliseconds="2000"/>
+    <pause milliseconds="200"/>
 
     <!-- Send a new INVITE with authentication this time -->
     <send retrans="500">
diff --git a/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/test-config.yaml b/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/test-config.yaml
index 43da056..d66671b 100644
--- a/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/test-config.yaml
+++ b/tests/channels/SIP/tcpauthlimit/sipp_client_scenario/test-config.yaml
@@ -51,40 +51,40 @@
         -
             type: 'sipp-scenario'
             scenario-id: 'minion_bob'
-            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_bob', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '5062', '-t': 't1', '-inf':'inject_minion_bob.csv'}
+            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_bob', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '0', '-t': 't1', '-inf':'inject_minion_bob.csv'}
         -
             type: 'sipp-scenario'
             scenario-id: 'minion_dave'
-            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_dave', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '5063', '-t': 't1', '-inf':'inject_minion_dave.csv'}
+            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_dave', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '0', '-t': 't1', '-inf':'inject_minion_dave.csv'}
         -
             type: 'sipp-scenario'
             scenario-id: 'minion_jerry'
-            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_jerry', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '5064', '-t': 't1', '-inf':'inject_minion_jerry.csv'}
+            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_jerry', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '0', '-t': 't1', '-inf':'inject_minion_jerry.csv'}
         -
             type: 'sipp-scenario'
             scenario-id: 'minion_jon'
-            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_jon', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '5065', '-t': 't1', '-inf':'inject_minion_jon.csv'}
+            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_jon', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '0', '-t': 't1', '-inf':'inject_minion_jon.csv'}
         -
             type: 'sipp-scenario'
             scenario-id: 'minion_jorge'
-            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_jorge', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '5066', '-t': 't1', '-inf':'inject_minion_jorge.csv'}
+            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_jorge', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '0', '-t': 't1', '-inf':'inject_minion_jorge.csv'}
         -
             type: 'sipp-scenario'
             scenario-id: 'minion_kevin'
-            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_kevin', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '5067', '-t': 't1', '-inf':'inject_minion_kevin.csv'}
+            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_kevin', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '0', '-t': 't1', '-inf':'inject_minion_kevin.csv'}
         -
             type: 'sipp-scenario'
             scenario-id: 'minion_mark'
-            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_mark', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '5068', '-t': 't1', '-inf':'inject_minion_mark.csv'}
+            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_mark', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '0', '-t': 't1', '-inf':'inject_minion_mark.csv'}
         -
             type: 'sipp-scenario'
             scenario-id: 'minion_phil'
-            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_phil', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '5069', '-t': 't1', '-inf':'inject_minion_phil.csv'}
+            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_phil', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '0', '-t': 't1', '-inf':'inject_minion_phil.csv'}
         -
             type: 'sipp-scenario'
             scenario-id: 'minion_stuart'
-            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_stuart', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '5070', '-t': 't1', '-inf':'inject_minion_stuart.csv'}
+            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_stuart', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '0', '-t': 't1', '-inf':'inject_minion_stuart.csv'}
         -
             type: 'sipp-scenario'
             scenario-id: 'minion_tim'
-            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_tim', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '5071', '-t': 't1', '-inf':'inject_minion_tim.csv'}
+            key-args: {'scenario': 'uac.xml', '-i': '127.0.0.1', '-au': 'minion_tim', '-ap': 'RErm9C', '-s': 'echo', '-d': '10000', '-p': '0', '-t': 't1', '-inf':'inject_minion_tim.csv'}
diff --git a/tests/channels/SIP/tcpauthlimit/tcp_client_scenario/tcp_scenario.py b/tests/channels/SIP/tcpauthlimit/tcp_client_scenario/tcp_scenario.py
index a0a471d..a2269c1 100644
--- a/tests/channels/SIP/tcpauthlimit/tcp_client_scenario/tcp_scenario.py
+++ b/tests/channels/SIP/tcpauthlimit/tcp_client_scenario/tcp_scenario.py
@@ -18,9 +18,9 @@
 
 
 class TCPClient(Protocol):
-    def __init__(self, module, port):
+    def __init__(self, module):
         self.module = module
-        self.port = port
+        self.port = 0
 
     def connectionLost(self, reason):
         LOGGER.info("Lost connection for source port {0}".format(self.port))
@@ -28,18 +28,18 @@
         self.module.connections_lost += 1
 
     def connectionMade(self):
+        self.port = self.transport.getHost().port
         LOGGER.info("Connection made for source port {0}".format(self.port))
         self.module.connections_made += 1
 
 
 class TCPClientFactory(ClientFactory):
-    def __init__(self, module, port):
+    def __init__(self, module):
         self.module = module
-        self.port = port
+        self.port = 0
 
     def buildProtocol(self, addr):
-        LOGGER.info("Building protocol for source port {0}".format(self.port))
-        return TCPClient(self.module, self.port)
+        return TCPClient(self.module)
 
 
 class TCPClientModule(object):
@@ -50,11 +50,11 @@
         test_object.register_ami_observer(self.ami_connect)
 
     def ami_connect(self, ami):
-        reactor.connectTCP("127.0.0.1", 5060, TCPClientFactory(self, 5062),
-                           bindAddress=("127.0.0.1", 5062))
-        reactor.connectTCP("127.0.0.1", 5060, TCPClientFactory(self, 5063),
-                           bindAddress=("127.0.0.1", 5063))
-        reactor.callLater(10, self.evaluate_connections)
+        reactor.connectTCP("127.0.0.1", 5060, TCPClientFactory(self),
+                           bindAddress=("127.0.0.1", 0))
+        reactor.connectTCP("127.0.0.1", 5060, TCPClientFactory(self),
+                           bindAddress=("127.0.0.1", 0))
+        reactor.callLater(5, self.evaluate_connections)
 
     def evaluate_connections(self):
         LOGGER.info("Made {0} connections".format(self.connections_made))
diff --git a/tests/channels/SIP/tcpauthlimit/tcp_client_scenario/test-config.yaml b/tests/channels/SIP/tcpauthlimit/tcp_client_scenario/test-config.yaml
index cb4eaa3..ac1abca 100644
--- a/tests/channels/SIP/tcpauthlimit/tcp_client_scenario/test-config.yaml
+++ b/tests/channels/SIP/tcpauthlimit/tcp_client_scenario/test-config.yaml
@@ -1,5 +1,4 @@
 testinfo:
-    skip: 'Skip while failures are debugged'
     summary: Test the tcpauthlimit sip config option.
     description: |
        This test sets the tcpauthlimit in sip.conf to 1. It then attempts to

-- 
To view, visit https://gerrit.asterisk.org/5576
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifa93373193b0933a99cad4fd4741190652656745
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list