[asterisk-scf-commits] asterisk-scf/integration/testsuite.git branch "review" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Jun 8 09:35:03 CDT 2011


branch "review" has been updated
       via  911cb686ad90aa162b5c82bf7d1f06a24add7985 (commit)
       via  bdcc637a0fd46377af1756cd7335499e8c11733f (commit)
       via  6e1fa591c0a0b6ddcd3b0b10cb8b38b6b226a3d7 (commit)
      from  01ed224b6be145438928408584089d5442350da1 (commit)

Summary of changes:
 plugins/asteriskscf_configurator.py                |    2 +-
 plugins/asteriskscf_icebox.py                      |   13 ++--
 plugins/build.py                                   |   28 +++---
 plugins/sipp.py                                    |   14 ++--
 plugins/testsuite_remotes.py                       |   37 +++++++--
 remote.py                                          |   86 +++++++++++---------
 .../testcase.yaml                                  |    2 +
 7 files changed, 110 insertions(+), 72 deletions(-)


- Log -----------------------------------------------------------------
commit 911cb686ad90aa162b5c82bf7d1f06a24add7985
Author: Darren Sessions <dsessions at digium.com>
Date:   Wed Jun 8 09:34:52 2011 -0500

    modified the build test case so that if it fails, the test-suite will error out instead of continuing on trying to run the tests without the relevant build files required to run the tests in the first place.

diff --git a/tests/build/Build_and_Distribute_Asterisk_SCF_to_TestSuite_Remotes/testcase.yaml b/tests/build/Build_and_Distribute_Asterisk_SCF_to_TestSuite_Remotes/testcase.yaml
index 94e579d..b8b8347 100644
--- a/tests/build/Build_and_Distribute_Asterisk_SCF_to_TestSuite_Remotes/testcase.yaml
+++ b/tests/build/Build_and_Distribute_Asterisk_SCF_to_TestSuite_Remotes/testcase.yaml
@@ -1,4 +1,6 @@
 name : Build_and_Distribute_Asterisk_SCF_to_Remotes
+options :
+    stop_tests_on_failure : True
 tests :
     - ice_cpp :
         timeline :

commit bdcc637a0fd46377af1756cd7335499e8c11733f
Author: Darren Sessions <dsessions at digium.com>
Date:   Wed Jun 8 09:33:38 2011 -0500

    Log stdout and stderr to a log file with a directory structure in the tmp/artifacts directory that corresponds to the test category, case, subtest structure. this will allow for all test logs on all machines to be tarred up and sent to the test server where they can be untarred and all end up in the same directory.

diff --git a/remote.py b/remote.py
index 771e943..6ca1736 100755
--- a/remote.py
+++ b/remote.py
@@ -13,6 +13,7 @@
 '''
 
 import os
+import sys
 import time
 import shutil
 import platform
@@ -30,12 +31,6 @@ ipv6addr = None
 processList = {}
 
 class RemoteManagement(object):
-    def __init__(self):
-        if not os.path.exists('%s/tmp' % cwd):
-            os.makedirs('%s/tmp' % cwd)
-        if not os.path.exists('%s/tmp/artifacts' % cwd):
-            os.makedirs('%s/tmp/artifacts' % cwd)
-
     def listProcesses(self):
         list = {}
         for plugin in processList:
@@ -49,7 +44,7 @@ class RemoteManagement(object):
     def run(self, globalVars, plugin, label, execCmd, wait=False):
         if plugin in processList:
             if label in processList[plugin]:
-                return {'success':False,'msg':'%s executed by the %s plugin is already running.' % (label, plugin)}
+                return {'success':False,'msg':'[run] %s executed by the %s plugin is already running.' % (label, plugin)}
 
         for arg in execCmd:
             try:
@@ -58,20 +53,25 @@ class RemoteManagement(object):
                 pass
 
         if not os.path.exists('%s/tmp/artifacts/%s' % (cwd, globalVars['testInfo']['testPath'])):
-            os.makedirs('%s/tmp/artifacts/%s' % (cwd, globalVars['testInfo']['testCategory']))
-            os.makedirs('%s/tmp/artifacts/%s/%s' % (cwd, globalVars['testInfo']['testCategory'], globalVars['testInfo']['testCase']))
-            os.makedirs('%s/tmp/artifacts/%s/%s/%s' % (cwd, globalVars['testInfo']['testCategory'], globalVars['testInfo']['testCase'], globalVars['testInfo']['testName']))
-            if not os.path.exists('%s/tmp/artifacts/%s' % (cwd, globalVars['testInfo']['testPath'])):
-                return {'success':False,'msg':'Unable to create artifact test path on remotes. %s' % globalVars['testInfo']['testPath']}
+            dirs = [
+                '!!TMP!!/artifacts/%s' % globalVars['testInfo']['testCategory'], 
+                '!!TMP!!/artifacts/%s/%s' % (globalVars['testInfo']['testCategory'], globalVars['testInfo']['testCase']),
+                '!!TMP!!/artifacts/%s/%s/%s' % (globalVars['testInfo']['testCategory'], globalVars['testInfo']['testCase'], globalVars['testInfo']['testName'])]
+            for dir in dirs:
+                results = self.makeDir(dir) 
+                if results['success'] == False:
+                    return results
 
-        time.sleep(1)
+        if not os.path.exists('%s/tmp/artifacts/%s' % (cwd, globalVars['testInfo']['testPath'])):
+            return {'success':False,'msg':'[run] Unable to create artifact test path on remotes. %s' % globalVars['testInfo']['testPath']}
 
+        time.sleep(1)
         execCmd[0] = self._which(execCmd[0])
 
         try:
-            logArtifactFile = open('%s/tmp/artifacts/%s_%s.log' % (cwd, _artifactNameCheck(plugin), _artifactNameCheck(label)), 'w')
+            logArtifactFile = open('%s/tmp/artifacts/%s/%s_%s.log' % (cwd, globalVars['testInfo']['testPath'], self._artifactNameCheck(plugin), self._artifactNameCheck(label)), 'w')
         except:
-            return {'success':False,'msg':"Unable to open '%s/tmp/artifacts/%s_%s.log' for writing." % (cwd, plugin, label)}
+            return {'success':False,'msg':"[run] Unable to open '%s/tmp/artifacts/%s/%s_%s.log' for writing. %s" % (cwd, globalVars['testInfo']['testPath'], plugin, label, sys.exc_info()[1])}
 
         if os.path.exists(execCmd[0]) and os.access(execCmd[0], os.X_OK):
             p = subprocess.Popen(
@@ -87,9 +87,9 @@ class RemoteManagement(object):
                 p.wait()
             os.chdir('%s' % cwd)
             if p.returncode:
-                return {'success':False,"msg":"Could not execute '%s'." % ' '.join(execCmd)}
+                return {'success':False,"msg":"[run] Could not execute '%s'." % ' '.join(execCmd)}
         else:
-            return {'success':False,"msg":"FAILED TO EXECUTE '%s', it must exist and be executable" % ' '.join(execCmd)}
+            return {'success':False,"msg":"[run] FAILED TO EXECUTE '%s', it must exist and be executable" % ' '.join(execCmd)}
 
         if wait == False:
             if not plugin in processList:
@@ -101,22 +101,22 @@ class RemoteManagement(object):
 
     def stop(self, data):
         if not 'plugin' in data and not 'label' in data:
-            return {'success':False,'msg':'A plugin name and label must be provided to stop a process.'}
+            return {'success':False,'msg':'[stop] A plugin name and label must be provided to stop a process.'}
         if not 'subprocess' in processList[data['plugin']][data['label']]:
-            return {'success':False,'msg':'Process information does not exist for "%s" in the "%s" process list.' % (data['label'], data['plugin'])}
+            return {'success':False,'msg':'[stop] Process information does not exist for "%s" in the "%s" process list.' % (data['label'], data['plugin'])}
         p = processList[data['plugin']][data['label']]['subprocess']
         try:
             os.kill(p.pid, 9)
         except:
-            return {'success':False,"msg":"Unable to kill pid # %d" % pid}
+            return {'success':False,"msg":"[stop] Unable to kill pid # %d" % pid}
         return {'success':True}
 
     def shutdown(self, plugin):
         msg = []
         if not plugin:
-            return {'success':False,'msg':'A plugin name to shutdown must be provided.'}
+            return {'success':False,'msg':'[shutdown] A plugin name to shutdown must be provided.'}
         if not plugin in processList:
-            return {'success':False,'msg':'The "%s" plugin is not running.' % plugin}
+            return {'success':False,'msg':'[shutdown] The "%s" plugin is not running.' % plugin}
         for label in processList[plugin]:
             try:
                 os.kill(processList[plugin][label]['subprocess'].pid, 9)
@@ -125,7 +125,7 @@ class RemoteManagement(object):
             processList[plugin][label]['logArtifactFile'].close()
         del processList[plugin]
         if len(msg) > 0:
-            return {'success':False,'msg':' '.join(msg)}
+            return {'success':False,'msg':'[shutdown] %s' % ' '.join(msg)}
         return {'success':True}
 
     def setEnvVar(self, name, val):
@@ -135,10 +135,10 @@ class RemoteManagement(object):
             elif plat == 'Linux':
                 varName = "LD_LIBRARY_PATH"
         else:
-            return {'success':False,'msg':'Unknown variable type. Remember, generic variable names are used for portability (i.e. libpath).'}
+            return {'success':False,'msg':'[setEnvVar] Unknown variable type. Remember, generic variable names are used for portability (i.e. libpath).'}
         val = val.replace('!!TMP!!', '%s/tmp' % cwd)
         if not os.path.exists(val):
-            return {'success':False,'msg':'env var path does not exist'}
+            return {'success':False,'msg':'[setEnvVar] env var path does not exist'}
         if varName in os.environ:
             for path in os.environ[varName].split(":"):
                 if path == val:
@@ -152,15 +152,24 @@ class RemoteManagement(object):
     def changeDir(self, dir):
         dir = self._filePathCheck(dir)
         if not os.path.exists('%s/tmp/%s' % (cwd, dir)):
-            return {'success':False,'msg':'changeDir: The %s path does not exist.' % dir}
+            return {'success':False,'msg':'[changeDir] The %s path does not exist.' % dir}
         os.chdir('%s/tmp/%s' % (cwd, dir))
         return {'success':True,'cwd':os.getcwd()}
 
+    def makeDir(self, dir):
+        dir = dir.replace('!!TMP!!', 'tmp')
+        if not os.path.exists('%s/%s' % (cwd, dir)):
+            try:
+                os.makedirs('%s/%s' % (cwd, dir))
+            except:
+                return {'success':False,'msg':'[makeDir] Unable to create directory %s. %s' % (dir, sys.exc_info()[0])}
+        return {'success':True}
+
     def removeDir(self, dir):
         dir = self._filePathCheck(dir)
         dir = dir.replace('/', '/invalid')
         if not os.path.exists('%s/tmp/%s' % (cwd, dir)):
-            return {'success':False,'msg':'removeDir: The %s path does not exist.' % dir}
+            return {'success':True, 'msg':'[removeDir] The %s path does not exist.' % dir}
         shutil.rmtree('%s/tmp/%s' % (cwd, dir))
         return {'success':True}
 
@@ -168,15 +177,15 @@ class RemoteManagement(object):
         fp = self._filePathCheck(fp)
         dp = self._filePathCheck(dp)
         if not os.path.exists('%s/tmp/build/%s' % (cwd, fp)):
-            return {'success':False,'msg':'moveFile: The %s source path does not exist.' % fp} 
+            return {'success':False,'msg':'[moveFile] The %s source path does not exist.' % fp} 
         if not os.path.exists('%s/tmp/build/%s' % (cwd, dp)):
-            return {'success':False,'msg':'moveFile: The %s destination path does not exist.' % dp}
+            return {'success':False,'msg':'[moveFile] The %s destination path does not exist.' % dp}
         try:
             returncode = subprocess.call('mv %s/tmp/build/%s %s/tmp/build/%s' % (cwd, fp, cwd, dp))
             if returncode != 0:
-                return {'success':False,'msg':'The move command failed. (return code %d)' % returncode}
+                return {'success':False,'msg':'[moveFile] The move command failed. (return code %d)' % returncode}
         except OSError, e:
-            return {'success':False,'msg':'Execution failed: %s' % e}
+            return {'success':False,'msg':'[moveFile] Execution failed: %s' % e}
         return {'success':True}
 
     def removeFile(self, fn):
@@ -189,7 +198,7 @@ class RemoteManagement(object):
     def archiveDir(self, globalVars, dn):
         dn = self._filePathCheck(dn)
         if not os.path.exists("%s" % dn):
-            return {'success':False,'msg':'archiveDir: The %s path does not exist.' % dn}
+            return {'success':False,'msg':'[archiveDir] The %s path does not exist.' % dn}
         os.chdir('%s/tmp' % cwd)
         results = self.run(globalVars, 'remote', 'archiveDir', [self._which('tar'), '-cvf', 'tmp.tar', '%s' % dn], True)
         if results['success'] == False:
@@ -205,9 +214,9 @@ class RemoteManagement(object):
         try:
             f = open('%s' % fn, 'rb')
         except IOError:
-            return {'success':False,'msg':'Failed to open %s.' % fn}
+            return {'success':False,'msg':'[rFile] Failed to open %s.' % fn}
         except:
-            return {'success':False,'msg':'Unexpected error: %s' % sys.exc_info()[0]}
+            return {'success':False,'msg':'[rFile] Unexpected error: %s' % sys.exc_info()[0]}
         data = xmlrpclib.Binary(f.read())
         f.close()
         return {'success':True, 'data':data}
@@ -219,9 +228,9 @@ class RemoteManagement(object):
         try:
             f = open('%s' % fn, 'w')
         except IOError:
-            return {'success':False,'msg':'Failed to open test results output file: %s/tmp/%s' % (cwd, fn)}
+            return {'success':False,'msg':'[wFile] Failed to open test results output file: %s/tmp/%s' % (cwd, fn)}
         except:
-            return {'success':False,'msg':'Unexpected error: %s' % sys.exc_info()[0]}
+            return {'success':False,'msg':'[wFile] Unexpected error: %s' % sys.exc_info()[0]}
         f.write(fd)
         f.close()
         return {'success':True}
@@ -241,7 +250,7 @@ class RemoteManagement(object):
         try:
             rpc.reset()
         except:
-            return {'success':False,'msg':'%s is unable to transfer files to %s. Connection refused.' % (server, remote)}
+            return {'success':False,'msg':'[serverSideSendFile] %s is unable to transfer files to %s. Connection refused.' % (server, remote)}
         try:
             rpc.removeFile(fn)
         except:
@@ -259,8 +268,11 @@ class RemoteManagement(object):
         return 1
 
     def _artifactNameCheck(self, name):
+        print name
         name = name.replace(' ', '_')
         name = name.replace('.', '_')
+        name = name.replace('/', '_')
+        print name
         return name
 
     def _filePathCheck(self, fp):

commit 6e1fa591c0a0b6ddcd3b0b10cb8b38b6b226a3d7
Author: Darren Sessions <dsessions at digium.com>
Date:   Wed Jun 8 09:31:21 2011 -0500

    Updated the plugins to support the new RPC code that was refactored to put the calls into a try except block.

diff --git a/plugins/asteriskscf_configurator.py b/plugins/asteriskscf_configurator.py
index 03f332b..9845c73 100644
--- a/plugins/asteriskscf_configurator.py
+++ b/plugins/asteriskscf_configurator.py
@@ -221,7 +221,7 @@ class SectionVisitors():
         try:
             self.hosts[config[host]][config['ipv4oripv6']]
         except:
-            self.hosts[config[host]] = plugin().rpc(config[host])
+            self.hosts[config[host]] = plugin().RPC().connect(config[host])
         if self.hosts[config[host]]['success'] == False:
             return self.hosts[config[host]]
         try:
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index f384200..ecf64e1 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -12,21 +12,20 @@
 import TestSuite
 
 class plugin(TestSuite.RemoteBaseClass):
-    def main(self, testData, testPath, globalVars, rpc):
-        print testData
+    def main(self, testData, testPath, globalVars, remote):
         iceBoxCmd = ['/opt/Ice-3.4.1/bin/icebox', '--Ice.Config=!!TMP!!/']
 
         ''' start and stop individual components. shutdown is implemented in the main testsuite code ''' 
         for cmd in testData['cmd']:
             if cmd == 'start':
                 for component in testData['cmd']['start']:
-                    results = rpc.writeFile('%s.conf' % component, '\n'.join(self._componentConfig(component)))
+                    results = remote['rpc']('writeFile', '%s.conf' % component, '\n'.join(self._componentConfig(component)))
                     if results['success'] == False:
                         return results
-                    results = rpc.setEnvVar('libpath', '!!TMP!!/gitall/build/lib')
+                    results = remote['rpc']('setEnvVar', 'libpath', '!!TMP!!/gitall/build/lib')
                     if results['success'] == False:
                         return results
-                    results = rpc.run(globalVars, 'asteriskscf_icebox', component, [iceBoxCmd[0], "%s%s.conf" % (iceBoxCmd[1], component)])
+                    results = remote['rpc']('run', globalVars, 'asteriskscf_icebox', component, [iceBoxCmd[0], "%s%s.conf" % (iceBoxCmd[1], component)])
                     if results['success'] == False:
                         return results
             elif cmd == 'stop':
@@ -109,10 +108,12 @@ class plugin(TestSuite.RemoteBaseClass):
                 'IceBox.Service.BasicRoutingService=BasicRoutingService:create',
                 'IceBox.InheritProperties=1', 
                 'BasicRoutingService.Endpoints=tcp -p 10050',
-                'BasicRoutingService.ComponentService.Endpoints=tcp -p 10051',
+                'BasicRoutingService.Backplane.Endpoints=tcp -p 10051',
                 'BasicRoutingService.ThreadPool.Size=4',
                 'BasicRoutingService.ThreadPool.SizeMax=10',
                 'BasicRoutingService.ThreadPool.SizeWarn=9',
+                'BasicRoutingService.Standby=no',
+                'BasicRoutingService.Standalone=yes',
                 'LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4422',
                 'LocatorService.Proxy=LocatorService:tcp -p 4411',
                 'TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000',
diff --git a/plugins/build.py b/plugins/build.py
index 7b1a963..4c5ea3c 100644
--- a/plugins/build.py
+++ b/plugins/build.py
@@ -12,7 +12,7 @@
 import TestSuite
 
 class plugin(TestSuite.RemoteBaseClass):
-    def main(self, testData, testPath, globalVars, rpc):
+    def main(self, testData, testPath, globalVars, remote):
         if not 'repo' in testData['cmd']:
             return {'success':False,'msg':'No repo specified.'}
 
@@ -36,13 +36,13 @@ class plugin(TestSuite.RemoteBaseClass):
             repoInfo['repoRefreshCmd'] = 'update'
 
         if update == True:
-            results = rpc.changeDir(repoInfo['repoName'])
+            results = remote['rpc']('changeDir', repoInfo['repoName'])
             if results['success'] == False:
-                results = self._scratchBuild(rpc, repoInfo['repoName'], repoInfo['repoType'], repoInfo['repoGetCmd'], testData['cmd']['repo'])
+                results = self._scratchBuild(remote['rpc'], globalVars, repoInfo['repoName'], repoInfo['repoType'], repoInfo['repoGetCmd'], testData['cmd']['repo'])
                 if results['success'] == False:
                     return results
         else:
-            results = rpc.removeDir(repoInfo['repoName'])
+            results = remote['rpc']('removeDir', repoInfo['repoName'])
             if results['success'] == False:
                 return results
             results = self._scratchBuild(rpc, repoInfo['repoName'], repoInfo['repoType'], repoInfo['repoGetCmd'], testData['cmd']['repo'])
@@ -52,11 +52,11 @@ class plugin(TestSuite.RemoteBaseClass):
         if 'make_cmd' in testData['cmd']:
             for cmds in testData['cmd']['make_cmd']:
                 if 'cd' in testData['cmd']:
-                    results = rpc.changeDir(testData['cmd']['cd'])
+                    results = remote['rpc']('changeDir', testData['cmd']['cd'])
                     if results['success'] == False:
                         return results
 
-                results = rpc.run(globalVars, 'build', cmds, cmds.split(' '), True)
+                results = remote['rpc']('run', globalVars, 'build', cmds, cmds.split(' '), True)
                 if results['success'] == False:
                     return results
             
@@ -65,29 +65,29 @@ class plugin(TestSuite.RemoteBaseClass):
                 return {'success':False,'msg':'The restribute element requires the remotes and send_dir options.'}
             else:
                 try:
-                    rpc.removeFile('tmp.tar.gz')
+                    remote['rpc']('removeFile', 'tmp.tar.gz')
                 except:
                     pass
 
-                results = rpc.archiveDir(globalVars, testData['cmd']['redistribute']['send_dir'])
+                results = remote['rpc']('archiveDir', globalVars, testData['cmd']['redistribute']['send_dir'])
                 if results['success'] == False:
                     return results
                
-                for remote in testData['cmd']['redistribute']['remotes']:
-                    if remote == globalVars['hostname']:
-                        results = rpc.readFile('tmp.tar.gz')
+                for remoteHost in testData['cmd']['redistribute']['remotes']:
+                    if remoteHost == globalVars['hostname']:
+                        results = remote['rpc']('readFile', 'tmp.tar.gz')
                         if results['success'] == False:
                             return results
                         results = self.installFromRemote(globalVars['cwd'], 'tmp.tar.gz', results['data'], testData['cmd']['redistribute']['install_dir'])
                         if results['success'] == False:
                             return results
                     else:
-                        results = rpc.serverSideSendFile(globalVars, testData['testsuite_remote_host'], remote, 'tmp.tar.gz', testData['cmd']['redistribute']['install_dir'])
+                        results = remote['rpc']('serverSideSendFile', globalVars, testData['testsuite_remote_host'], remoteHost, 'tmp.tar.gz', testData['cmd']['redistribute']['install_dir'])
                         if results['success'] == False:
                             return results
         
         return {'success':True,'shutdownExempt':True}
 
-    def _scratchBuild(self, rpc, name, type, getCmd, repo):
-        results = rpc.run(globalVars, 'build', name, [type, getCmd, repo], True)
+    def _scratchBuild(self, rpc, globalVars, name, type, getCmd, repo):
+        results = rpc('run', globalVars, 'build', name, [type, getCmd, repo], True)
         return results
diff --git a/plugins/sipp.py b/plugins/sipp.py
index f9e9d33..535981c 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -12,7 +12,7 @@
 import TestSuite
 
 class plugin(TestSuite.RemoteBaseClass):
-    def main(self, testData, testPath, globalVars, rpc):
+    def main(self, testData, testPath, globalVars, remote):
         self.hosts = {}
 
         config = {}
@@ -34,26 +34,26 @@ class plugin(TestSuite.RemoteBaseClass):
                 if mode == 'uac':
                     waitForPidToFinish = True
                 #print ' '.join(self._componentConfig(mode, config[mode], testPath, rpc, testData['testsuite_remote_host']))
-                results = rpc.run(globalVars, 'sipp', mode, self._componentConfig(mode, config[mode], testPath, rpc, testData['testsuite_remote_host']), waitForPidToFinish)
+                results = remote['rpc']('run', globalVars, 'sipp', mode, self._componentConfig(mode, config[mode], testPath, remote, testData['testsuite_remote_host']), waitForPidToFinish)
                 if results['success'] == False:
                     return results
 
         return {'success':True}
 
-    def _loadScenarioFile(self, fp, fn, rpc):
+    def _loadScenarioFile(self, fp, fn, remote):
         fd = self.file().read(fp + '/' + fn)
-        return rpc.writeFile(fn, fd)
+        return remote['rpc']('writeFile', fn, fd)
     
     def _execBuilder(self, list, string):
         for execBlock in string.rsplit(' '):
             list.append(execBlock)
         return list
 
-    def _componentConfig(self, mode, config, testPath, rpc, testsuite_remote_host):
+    def _componentConfig(self, mode, config, testPath, remote, testsuite_remote_host):
         execCmd = ['sipp']
 
         if 'scenario_file' in config:
-            results = self._loadScenarioFile(testPath, config['scenario_file'], rpc)
+            results = self._loadScenarioFile(testPath, config['scenario_file'], remote)
             if results['success'] == False:
                return results
             execCmd = self._execBuilder(execCmd, '-sf !!TMP!!/%s' % config['scenario_file'])
@@ -107,7 +107,7 @@ class plugin(TestSuite.RemoteBaseClass):
         try:
             self.hosts[host][config['ipv4oripv6']]
         except:
-            self.hosts[host] = plugin().rpc(host)
+            self.hosts[host] = self.RPC().connect(host)
         if self.hosts[host]['success'] == False:
             return self.hosts[host]
         return {'success':True, 'ip':self.hosts[host][config['ipv4oripv6']]}
diff --git a/plugins/testsuite_remotes.py b/plugins/testsuite_remotes.py
index 5c25709..0d0acfc 100644
--- a/plugins/testsuite_remotes.py
+++ b/plugins/testsuite_remotes.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 '''
 
- Test-Suite Remote Agent Startup and Shutdown Plugin
+ Test-Suite Remote Agent Startup and Shutdown Procedures Plugin
 
  Copyright (C) 2011, Digium, Inc.
 
@@ -14,11 +14,34 @@ import TestSuite
 
 class plugin(TestSuite.BaseClass):
     def main(self, testData, testPath, globalVars):
+        rpc = {}
+        ''' start and stop individual components. shutdown is implemented in the main testsuite code ''' 
         for cmd in testData['cmd']:
-            rpc = self.RPC().connect(cmd)
-            if rpc['success'] == False:
-                return rpc
-        return {'success':True}   
+            if cmd == 'startup':
+                ''' Quick check to make sure we can connect to the remotes before we do anything else. '''
+                for remote in testData['cmd']['startup']:
+                    rpc[remote] = self.RPC().connect(remote)
+                    if rpc[remote]['success'] == False:
+                        return rpc[remote]
+
+                ''' Some housekeeping procedures for the remotes before we begin testing. '''
+                for remote in testData['cmd']['startup']:
+                    ''' Make sure the tmp dir exists '''
+                    results = rpc[remote]['rpc']('makeDir', 'tmp')
+                    if results['success'] == False:
+                        return results
+                    ''' Remove the artifacts directory if it exists. '''
+                    results = rpc[remote]['rpc']('removeDir', 'artifacts')
+                    if results['success'] == False:
+                        return results
+                    ''' Create a fresh artifact directory. '''
+                    results = rpc[remote]['rpc']('makeDir', '!!TMP!!/artifacts')
+                    if results['success'] == False:
+                        return results
 
-            
- 
+            elif cmd == 'shutdown':
+                print 'shutdown'
+            else:
+                return {'success':False,'msg':'The %s command is invalid.' % cmd}
+
+        return {'success':True}   

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list