Merge "Remove if-statements for checking dse or dse2"

This commit is contained in:
Jenkins 2016-12-12 04:30:13 +00:00 committed by Gerrit Code Review
commit 486b9c22cb
2 changed files with 14 additions and 8 deletions

View File

@ -1470,13 +1470,8 @@ class ExecutionDriver(object):
self.executable_methods = {}
self.LEADER_TIMEOUT = 5
self._leader_node_id = None
# TODO(dse2): remove the if-conditional when DSE1 support ended
# The conditional is temporarily present to support DSE1 services
# that don't have heartbeat_callbacks.
if hasattr(self, 'heartbeat_callbacks'):
# defined in DataService class
self.heartbeat_callbacks[
'check_leader'] = self._check_leader_heartbeat
self.heartbeat_callbacks['check_leader'] = self._check_leader_heartbeat
def _check_leader_heartbeat(self):
"""Vacate leader if heartbeat lost"""

View File

@ -1899,10 +1899,21 @@ class TestPushedDriver(base.SqlTestCase):
class TestExecutionDriver(base.TestCase):
class ExtendedExecutionDriver(datasource_driver.ExecutionDriver):
"""Subclass of test target.
Execution Driver is an add-on class for datasource driver so
it's assumed to have heartbeat_callbacks variable defined in
DataService class.
"""
def __init__(self):
# A variable defined in datasource_driver
self.heartbeat_callbacks = {}
super(TestExecutionDriver.ExtendedExecutionDriver, self).__init__()
def setUp(self):
super(TestExecutionDriver, self).setUp()
self.exec_driver = datasource_driver.ExecutionDriver()
self.exec_driver = TestExecutionDriver.ExtendedExecutionDriver()
def test_get_method_nested(self):
class server(object):