[asterisk-commits] mjordan: testsuite/asterisk/trunk r3305 - /asterisk/trunk/lib/python/asterisk/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 9 15:26:08 CDT 2012
Author: mjordan
Date: Mon Jul 9 15:26:04 2012
New Revision: 3305
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3305
Log:
Tweak Asterisk start cycle to be more tolerant of config installation
On some machines, installing the configs - which consists of copying a
number of Asterisk configuration files and making a large number of
symbolic links - can take the OS longer to complete then what the method
execution time infers. As such, Asterisk can sometimes be started before
the test specific Asterisk configuration file has been created, which
can lead to Asterisk using the default configuration information. This
causes a problem for the test, which - for all CLI commands and other
interactions - will use the one installed in /tmp/asterisk-testsuite/.
We now defer starting Asterisk for a second, to give time for the config
installation to complete.
Modified:
asterisk/trunk/lib/python/asterisk/asterisk.py
Modified: asterisk/trunk/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/asterisk.py?view=diff&rev=3305&r1=3304&r2=3305
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Mon Jul 9 15:26:04 2012
@@ -237,6 +237,19 @@
config files, if they have not already been installed
"""
+ def __start_asterisk_callback():
+ self.processProtocol = AsteriskProtocol(self.host, self.__stop_deferred)
+ self.process = reactor.spawnProcess(self.processProtocol,
+ self.cmd[0],
+ self.cmd)
+ # Begin the wait fully booted cycle
+ self.__start_asterisk_time = time.time()
+ reactor.callLater(0, __execute_wait_fully_booted)
+
+ def __execute_wait_fully_booted():
+ cli_deferred = self.cli_exec("core waitfullybooted")
+ cli_deferred.addCallbacks(__wait_fully_booted_callback, __wait_fully_booted_error)
+
def __wait_fully_booted_callback(cli_command):
""" Callback for CLI command waitfullybooted """
self.__start_deferred.callback("Successfully started Asterisk %s" % self.host)
@@ -248,13 +261,12 @@
self.__start_deferred.errback("Command core waitfullybooted failed")
else:
logger.debug("Asterisk core waitfullybooted failed, attempting again...")
- cli_deferred = self.cli_exec("core waitfullybooted")
- cli_deferred.addCallbacks(__wait_fully_booted_callback, __wait_fully_booted_error)
+ reactor.callLater(0, __execute_wait_fully_booted)
self.install_configs(os.getcwd() + "/configs")
self.__setup_configs()
- cmd = [
+ self.cmd = [
self.ast_binary,
"-f", "-g", "-q", "-m", "-n",
"-C", "%s" % os.path.join(self.astetcdir, "asterisk.conf")
@@ -266,13 +278,14 @@
# exits
self.__start_deferred = defer.Deferred()
self.__stop_deferred = defer.Deferred()
- self.processProtocol = AsteriskProtocol(self.host, self.__stop_deferred)
- self.process = reactor.spawnProcess(self.processProtocol, cmd[0], cmd)
-
- # Begin the wait fully booted cycle
- self.__start_asterisk_time = time.time()
- cli_deferred = self.cli_exec("core waitfullybooted")
- cli_deferred.addCallbacks(__wait_fully_booted_callback, __wait_fully_booted_error)
+
+ # Asterisk will attempt to use built in configuration information if
+ # it can't find the configuration files that are being installed - which
+ # can happen due to the files being created due to a copy operation.
+ # If that happens, the test will fail - wait a second to give
+ # Asterisk time to come up fully
+ reactor.callLater(1, __start_asterisk_callback)
+
return self.__start_deferred
def stop(self):
More information about the asterisk-commits
mailing list