[asterisk-commits] pabelanger: testsuite/asterisk/trunk r2070 - in /asterisk/trunk: configs/ lib...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 6 15:36:02 CDT 2011


Author: pabelanger
Date: Tue Sep  6 15:35:53 2011
New Revision: 2070

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2070
Log:
Enable manager by default for the testsuite

Tests no longer need to create a manager.general.conf.inc file to enable or set
the bindaddr value.  This is now handled by the testsuite.

Review: https://reviewboard.asterisk.org/r/1405/

Removed:
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/apps/directory_attendant_exit/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/apps/directory_context_operator_exit/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/apps/directory_operator_exit/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/apps/directory_operator_exit/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_nominal/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/apps/voicemail/leave_voicemail_nominal/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/callparking/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/callparking/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/cdr/console_dial_sip_answer/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/channels/SIP/noload_res_srtp_attempt_srtp/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/channels/SIP/sip_tls_call/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/channels/SIP/sip_tls_call/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/directed_pickup/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fastagi/channel-status/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fastagi/connect/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fastagi/control-stream-file/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fastagi/database/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fastagi/stream-file/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_mix2/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_mix2/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_mix3/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_mix3/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_mix4/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_mix4/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_native_t38/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_native_t38/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_no_t38/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_no_t38/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_timeout1/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_timeout1/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_timeout2/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_timeout2/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_timeout3/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_timeout3/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_timeout4/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_timeout4/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_timeout5/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/fax/gateway_timeout5/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/func_srv/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/manager/login/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/pbx/merge_contexts/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/pbx/merge_contexts/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/pbx/pbx_lua_background/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/pbx/pbx_lua_background/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/pbx/pbx_lua_goto/configs/ast2/manager.general.conf.inc
    asterisk/trunk/tests/regressions/M18882/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/udptl/configs/ast1/manager.general.conf.inc
    asterisk/trunk/tests/udptl/configs/ast2/manager.general.conf.inc
Modified:
    asterisk/trunk/configs/manager.conf
    asterisk/trunk/lib/python/asterisk/TestCase.py
    asterisk/trunk/lib/python/asterisk/asterisk.py

Modified: asterisk/trunk/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/configs/manager.conf?view=diff&rev=2070&r1=2069&r2=2070
==============================================================================
--- asterisk/trunk/configs/manager.conf (original)
+++ asterisk/trunk/configs/manager.conf Tue Sep  6 15:35:53 2011
@@ -1,5 +1,5 @@
 [general]
-enabled = no
+enabled = yes
 port = 5038
 bindaddr = 127.0.0.1
 

Modified: asterisk/trunk/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/TestCase.py?view=diff&rev=2070&r1=2069&r2=2070
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestCase.py Tue Sep  6 15:35:53 2011
@@ -53,7 +53,8 @@
         """
         for c in range(count):
             logger.info("Creating Asterisk instance %d" % (c + 1))
-            self.ast.append(Asterisk(base=self.base))
+            host = "127.0.0.%d" % (c + 1)
+            self.ast.append(Asterisk(base=self.base, host=host))
             # Copy shared config files
             self.ast[c].install_configs("%s/configs" %
                     (self.test_name))

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=2070&r1=2069&r2=2070
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Tue Sep  6 15:35:53 2011
@@ -107,6 +107,8 @@
 
         self.install_configs(os.getcwd() + "/configs")
 
+        self.__setup_configs()
+
     def start(self):
         """Start this instance of Asterisk.
 
@@ -249,6 +251,26 @@
             logger.warn("'%s' and '%s' are the same file" % (cfg_path, target_path))
         except IOError:
             logger.warn("The destination is not writable '%s'" % target_path)
+
+    def overwrite_file(self, path, filename, values):
+        target_filename = os.path.join(self.astetcdir, filename)
+
+        if not os.path.exists(target_filename):
+            logger.error("File '%s' does not exists" % filename)
+            return
+        try:
+            f = open(target_filename, "w")
+        except IOError:
+            logger.error("Failed to open %s" % target_filename)
+            return
+        except:
+            logger.error("Unexpected error: %s" % sys.exc_info()[0])
+            return
+
+        for (var, val) in values:
+            f.write('%s = %s\n' % (var, val))
+
+        f.close()
 
     def cli_originate(self, argstr, blocking=True):
         """Starts a call from the CLI and links it to an application or
@@ -333,6 +355,20 @@
         except OSError:
             pass
         return output
+
+    def __setup_configs(self):
+        self.__setup_manager_conf()
+
+    def __setup_manager_conf(self):
+        values = []
+
+        if self.host == '127.0.0.1':
+            return
+
+        values.append(['bindaddr', self.host])
+
+        self.overwrite_file(self.directories['astetcdir'],
+            "manager.general.conf.inc", values)
 
     def __gen_ast_conf(self, ast_conf, dir_cat, ast_conf_options):
         for (var, val) in dir_cat.options:




More information about the asterisk-commits mailing list