You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by dd...@apache.org on 2008/03/20 10:12:29 UTC
svn commit: r639215 - in /hadoop/core/trunk: CHANGES.txt
src/contrib/hod/hodlib/Common/xmlrpc.py src/contrib/hod/testing/main.py
src/contrib/hod/testing/testXmlrpc.py
Author: ddas
Date: Thu Mar 20 02:12:28 2008
New Revision: 639215
URL: http://svn.apache.org/viewvc?rev=639215&view=rev
Log:
HADOOP-2783. Fixes a problem to do with import in hod/hodlib/Common/xmlrpc.py. Contributed by Vinod Kumar Vavilapalli.
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/contrib/hod/hodlib/Common/xmlrpc.py
hadoop/core/trunk/src/contrib/hod/testing/main.py
hadoop/core/trunk/src/contrib/hod/testing/testXmlrpc.py
Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=639215&r1=639214&r2=639215&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Mar 20 02:12:28 2008
@@ -118,7 +118,7 @@
requests or server slowdown. (Hairong Kuang via dhruba)
HADOOP-2848. [HOD]hod -o list and deallocate works even after deleting
- the cluster directory. (Vinod Kumar Vavilapalli via ddas)
+ the cluster directory. (Hemanth Yamijala via ddas)
OPTIMIZATIONS
@@ -300,6 +300,9 @@
HADOOP-3036. Fix findbugs warnings in UpgradeUtilities. (Konstantin
Shvachko via cdouglas)
+
+ HADOOP-2783. Fixes a problem to do with import in
+ hod/hodlib/Common/xmlrpc.py. (Vinod Kumar Vavilapalli via ddas)
Release 0.16.2 - Unreleased
Modified: hadoop/core/trunk/src/contrib/hod/hodlib/Common/xmlrpc.py
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/hodlib/Common/xmlrpc.py?rev=639215&r1=639214&r2=639215&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/hodlib/Common/xmlrpc.py (original)
+++ hadoop/core/trunk/src/contrib/hod/hodlib/Common/xmlrpc.py Thu Mar 20 02:12:28 2008
@@ -14,7 +14,7 @@
#See the License for the specific language governing permissions and
#limitations under the License.
import xmlrpclib, time, random, signal
-from hodlib.Common.util import hodInterrupt
+from hodlib.Common.util import hodInterrupt, HodInterruptException
class hodXRClient(xmlrpclib.ServerProxy):
def __init__(self, uri, transport=None, encoding=None, verbose=0,
Modified: hadoop/core/trunk/src/contrib/hod/testing/main.py
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/testing/main.py?rev=639215&r1=639214&r2=639215&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/testing/main.py (original)
+++ hadoop/core/trunk/src/contrib/hod/testing/main.py Thu Mar 20 02:12:28 2008
@@ -26,7 +26,6 @@
moduleList = []
allList = []
excludes = [
- 'Xmlrpc'
]
# Build a module list by scanning through all files in testingDir
Modified: hadoop/core/trunk/src/contrib/hod/testing/testXmlrpc.py
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hod/testing/testXmlrpc.py?rev=639215&r1=639214&r2=639215&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hod/testing/testXmlrpc.py (original)
+++ hadoop/core/trunk/src/contrib/hod/testing/testXmlrpc.py Thu Mar 20 02:12:28 2008
@@ -22,47 +22,55 @@
from hodlib.Common.xmlrpc import hodXRClient
from hodlib.Common.socketServers import hodXMLRPCServer
+from hodlib.GridServices.service import ServiceUtil
+from hodlib.Common.util import hodInterrupt, HodInterruptException
from testing.lib import BaseTestSuite
excludes = []
+global serverPort
+serverPort = None
+
class test_HodXRClient(unittest.TestCase):
def setUp(self):
pass
# All testMethods have to have their names start with 'test'
def testSuccess(self):
- client = hodXRClient('http://localhost:5555', retryRequests=False)
+ global serverPort
+ client = hodXRClient('http://localhost:' + str(serverPort), retryRequests=False)
self.assertEqual(client.testing(), True)
pass
def testFailure(self):
- client = hodXRClient('http://localhost:5555', retryRequests=False)
- # client.noMethod()
+ """HOD should raise Exception when unregistered rpc is called"""
+ global serverPort
+ client = hodXRClient('http://localhost:' + str(serverPort), retryRequests=False)
self.assertRaises(Exception, client.noMethod)
pass
def testTimeout(self):
"""HOD should raise Exception when rpc call times out"""
- client = hodXRClient('http://localhost:567823', retryRequests=False)
- # client.noMethod()
+ # Give client some random nonexistent url
+ serverPort = ServiceUtil.getUniqRandomPort(h='localhost',low=40000,high=50000)
+ client = hodXRClient('http://localhost:' + str(serverPort), retryRequests=False)
self.assertRaises(Exception, client.testing)
pass
def testInterrupt(self):
""" HOD should raise HodInterruptException when interrupted"""
- from hodlib.Common.util import hodInterrupt, HodInterruptException
-
- def interrupt():
- client = hodXRClient('http://localhost:59087')
- thread = threading.Thread(name='testinterrupt', target=client.testing)
- thread.start()
- time.sleep(1)
- hodInterrupt.setFlag()
- thread.join()
- self.assertRaises(HodInterruptException, interrupt)
+ def interrupt(testClass):
+ testClass.assertRaises(HodInterruptException, client.testing)
+
+ serverPort = ServiceUtil.getUniqRandomPort(h='localhost',low=40000,high=50000)
+ client = hodXRClient('http://localhost:' + str(serverPort))
+ myThread = threading.Thread(name='testinterrupt', target=interrupt,args=(self,))
+ # Set the global interrupt
+ hodInterrupt.setFlag()
+ myThread.start()
+ myThread.join()
pass
def tearDown(self):
@@ -76,7 +84,9 @@
def rpcCall():
return True
- self.server = hodXMLRPCServer('localhost', ['5555'])
+ global serverPort
+ serverPort = ServiceUtil.getUniqRandomPort(h='localhost',low=40000,high=50000)
+ self.server = hodXMLRPCServer('localhost', [serverPort])
self.server.register_function(rpcCall, 'testing')
self.thread = threading.Thread(name="server",
target=self.server._serve_forever)