[svn-commits] russell: testsuite/asterisk/trunk r185 - /asterisk/trunk/tests/ami-login/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Apr 2 14:38:39 CDT 2010


Author: russell
Date: Fri Apr  2 14:38:35 2010
New Revision: 185

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=185
Log:
Remove ping, add a timeout in case something goes wrong

Modified:
    asterisk/trunk/tests/ami-login/run-test

Modified: asterisk/trunk/tests/ami-login/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/ami-login/run-test?view=diff&rev=185&r1=184&r2=185
==============================================================================
--- asterisk/trunk/tests/ami-login/run-test (original)
+++ asterisk/trunk/tests/ami-login/run-test Fri Apr  2 14:38:35 2010
@@ -33,12 +33,19 @@
         self.asterisk.install_config("tests/ami-login/configs/manager.conf")
         self.asterisk.install_config("tests/ami-login/configs/logger.conf")
 
+    def stop_reactor(self):
+        self.stop_asterisk()
+        print "Stopping Reactor ..."
+        if reactor.running:
+            reactor.stop()
+
     def start_asterisk(self):
         self.log_last_step("Starting Asterisk")
         self.asterisk.start()
+        self.asterisk.cli_exec("core set verbose 10")
+        self.asterisk.cli_exec("core set debug 3")
 
     def stop_asterisk(self):
-        self.log_last_step("Stopping Asterisk")
         self.asterisk.stop()
 
     def log_last_step(self, step):
@@ -47,25 +54,23 @@
 
     def on_error(self, ami):
         print "ERROR, Last Step: {0}".format(self.last_step)
-        reactor.stop()
         self.stop_asterisk()
 
     def on_logoff(self, ami):
         self.log_last_step("Logoff Successful")
         self.passed = True
-        reactor.stop()
-
-    def on_pong(self, ami):
-        self.log_last_step("Got Pong")
-        self.ami.logoff().addCallbacks(self.on_logoff, self.on_error)
 
     def on_connect(self, ami):
         self.log_last_step("Connected to the AMI")
         self.ami = ami
-        self.ami.ping().addCallbacks(self.on_pong, self.on_error)
+        self.ami.logoff().addCallbacks(self.on_logoff, self.on_error)
+        self.log_last_step("Logging off")
 
     def run(self):
         self.start_asterisk()
+
+        # A timeout in case things hang and fail
+        reactor.callLater(20, self.stop_reactor)
 
         self.log_last_step("Logging in to the AMI")
         self.ami_factory = manager.AMIFactory("user", "mysecret")




More information about the svn-commits mailing list