[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 May 25 13:59:02 CDT 2011


branch "review" has been updated
       via  9dbc7968010003b66033221f70ce5d1898ba7641 (commit)
      from  1ac13d833296b692119989a23c896e14d498f582 (commit)

Summary of changes:
 lib/python/util.py                                 |    8 +++++
 plugins/failover.py                                |   32 ++++++++++++++++++--
 remote.py                                          |    3 ++
 .../testcase.yaml                                  |    2 +-
 tests/failover/tests.yaml                          |    4 +-
 tests/tests.yaml                                   |    3 +-
 6 files changed, 45 insertions(+), 7 deletions(-)


- Log -----------------------------------------------------------------
commit 9dbc7968010003b66033221f70ce5d1898ba7641
Author: Darren Sessions <dsessions at digium.com>
Date:   Wed May 25 13:58:59 2011 -0500

    working on the failover plugin. added a rpc helper function to the non-remote base class in utils. modified the tests.yaml file in failover to support the new yaml parser tweaks. some more remote script tweaks.

diff --git a/lib/python/util.py b/lib/python/util.py
index 1580b00..2a7a170 100644
--- a/lib/python/util.py
+++ b/lib/python/util.py
@@ -28,6 +28,14 @@ class TestSuiteBaseClass:
             return {'success':False,'msg':'No command specified.'}
         return self.main(testData, testPath)
 
+    def rpc(self, host):
+        rpc = xmlrpclib.Server('http://%s:8000' % host)
+        try:
+            rpc.reset()
+        except:
+            return {'success':False,'msg':'Connection to %s was refused.' % host}
+        return {'success':True,'rpc':rpc}
+        
 class TestSuiteRemoteBaseClass:
     def run(self, testData, testPath):
         if not 'cmd' in testData:
diff --git a/plugins/failover.py b/plugins/failover.py
index 871b36f..7081d64 100644
--- a/plugins/failover.py
+++ b/plugins/failover.py
@@ -11,11 +11,38 @@
 
 import util
 
-class testsuite(util.TestSuiteRemoteBaseClass):
-    def main(self, testData, testPath, rpc):
+class testsuite(util.TestSuiteBaseClass):
+    def main(self, testData, testPath):
         corosyncExec = ['corosync','-f']
         pacemakerExec = ['pacemaker']
 
+        activeNode = {}
+        standbyNode = {}
+
+        if not 'testsuite_remote_active' in testData['cmd']:
+            return {'success':False,'msg':'No testsuite-remote specified for the active failover configuration.'}
+
+        if not 'testsuite_remote_standby' in testData['cmd']:
+            return {'success':False,'msg':'No testsuite-remote specified for the standby failover configuration.'}
+
+        results = self.rpc(testData['cmd']['testsuite_remote_active'])
+        if not results['success'] == True:
+            return results
+        else:
+            activeNode['rpc'] = results['rpc']
+            (activeNode['ipv4'], activeNode['ipv6'])  = activeNode['rpc'].whatAreMyIps()
+
+        results = self.rpc(testData['cmd']['testsuite_remote_standby'])
+        if not results['success'] == True:
+            return results
+        else:
+            standbyNode['rpc'] = results['rpc']
+            (standbyNode['ipv4'], standbyNode['ipv6'])  = standbyNode['rpc'].whatAreMyIps()
+
+        print 'sweet'
+
+        return {'success':True}
+
         ''' start and stop individual components. shutdown is implemented in the main testsuite code ''' 
         for cmd in testData['cmd']:
             if cmd == 'start':
@@ -34,7 +61,6 @@ class testsuite(util.TestSuiteRemoteBaseClass):
                 print 'stop'
             else:
                 return {'success':False,'msg':'The %s command is invalid.' % cmd}
-
         return {'success':True}
 
     def _corosyncConfig(self, ipV, nodeID, hostIP):
diff --git a/remote.py b/remote.py
index d1c109e..b6482fe 100755
--- a/remote.py
+++ b/remote.py
@@ -224,6 +224,9 @@ class RemoteManagement(object):
         results = rpc.remoteSideRecvFile(fn, xmlrpclib.Binary(r.read()), installPath)
         r.close()
         return results
+   
+    def whatAreMyIps(self):
+        return (ipv4addr, ipv6addr)
 
     def reset(self):
         os.chdir('%s/tmp' % cwd)
diff --git a/tests/failover/SysTest_Functional_Basic_Call_Setup_w_Failover/testcase.yaml b/tests/failover/SysTest_Functional_Basic_Call_Setup_w_Failover/testcase.yaml
index 36b46de..0d3ce2b 100644
--- a/tests/failover/SysTest_Functional_Basic_Call_Setup_w_Failover/testcase.yaml
+++ b/tests/failover/SysTest_Functional_Basic_Call_Setup_w_Failover/testcase.yaml
@@ -8,8 +8,8 @@ tests :
         expected_failure : False 
         timeline :
             - failover :
-                testsuite_remote : testsuite-remote-1.digium.internal
                 cmd :
+                    testsuite_remote_active : testsuite-remote-1.digium.internal
                     testsuite_remote_standby : testsuite-remote-2.digium.internal
                     start :
                         - corosync :
diff --git a/tests/failover/tests.yaml b/tests/failover/tests.yaml
index 81dd7d1..7c9a36c 100644
--- a/tests/failover/tests.yaml
+++ b/tests/failover/tests.yaml
@@ -1,2 +1,2 @@
-tests :
-    - testcase : SysTest_Functional_Basic_Call_Setup_w_Failover
+testcase :
+    - SysTest_Functional_Basic_Call_Setup_w_Failover
diff --git a/tests/tests.yaml b/tests/tests.yaml
index 4d4d45e..32f0b4e 100644
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -1,3 +1,4 @@
 tests :
-    - build
+#    - build
+    - failover
 #    - sip

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


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list