gorealis v2 refactor (#5)

* Changing default timeout for start maintenance.

* Upgrading dependencies to gorealis v2 and thrift  0.12.0

* Refactored to update to gorealis v2.
This commit is contained in:
Renan DelValle 2018-12-27 11:31:51 -08:00 committed by GitHub
parent ad4dd9606e
commit 6ab5c9334d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1335 changed files with 137431 additions and 61530 deletions

View file

@ -17,7 +17,6 @@
# under the License.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
TRIAL ?= trial
stubs: ../ThriftTest.thrift ../SmallTest.thrift

View file

@ -19,14 +19,17 @@
# under the License.
#
import sys
import os
import glob
import os
import sys
import time
basepath = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(basepath, 'gen-py.twisted'))
sys.path.insert(0, glob.glob(os.path.join(basepath, '../../lib/py/build/lib.*'))[0])
from thrift.Thrift import TApplicationException
from ThriftTest import ThriftTest
from ThriftTest.ttypes import Xception, Xtruct
from thrift.transport import TTwisted
@ -36,12 +39,11 @@ from twisted.trial import unittest
from twisted.internet import defer, reactor
from twisted.internet.protocol import ClientCreator
from zope.interface import implements
from zope.interface import implementer
@implementer(ThriftTest.Iface)
class TestHandler:
implements(ThriftTest.Iface)
def __init__(self):
self.onewaysQueue = defer.DeferredQueue()
@ -85,6 +87,7 @@ class TestHandler:
def fireOneway(t):
self.onewaysQueue.put((t, time.time(), seconds))
reactor.callLater(seconds, fireOneway, time.time())
raise Exception('')
def testNest(self, thing):
return thing
@ -172,7 +175,6 @@ class ThriftTestCase(unittest.TestCase):
@defer.inlineCallbacks
def testException(self):
yield self.client.testException('Safe')
try:
yield self.client.testException('Xception')
self.fail("should have gotten exception")
@ -182,12 +184,15 @@ class ThriftTestCase(unittest.TestCase):
try:
yield self.client.testException("throw_undeclared")
self.fail("should have thrown exception")
except Exception: # type is undefined
self.fail("should have gotten exception")
except TApplicationException:
pass
yield self.client.testException('Safe')
@defer.inlineCallbacks
def testOneway(self):
yield self.client.testOneway(1)
start, end, seconds = yield self.handler.onewaysQueue.get()
self.assertAlmostEquals(seconds, (end - start), places=1)
self.assertEquals((yield self.client.testI32(-1)), -1)