MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / MockCluster

Class MockCluster

tests/unit/test_control_connection.py:66–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65
66class MockCluster(object):
67
68 max_schema_agreement_wait = 5
69 profile_manager = ProfileManager()
70 reconnection_policy = ConstantReconnectionPolicy(2)
71 address_translator = IdentityTranslator()
72 down_host = None
73 contact_points = []
74 is_shutdown = False
75
76 def __init__(self):
77 self.metadata = MockMetadata()
78 self.added_hosts = []
79 self.removed_hosts = []
80 self.scheduler = Mock(spec=_Scheduler)
81 self.executor = Mock(spec=ThreadPoolExecutor)
82 self.profile_manager.profiles[EXEC_PROFILE_DEFAULT] = ExecutionProfile(RoundRobinPolicy())
83 self.endpoint_factory = DefaultEndPointFactory().configure(self)
84
85 def add_host(self, endpoint, datacenter, rack, signal=False, refresh_nodes=True):
86 host = Host(endpoint, SimpleConvictionPolicy, datacenter, rack)
87 self.added_hosts.append(host)
88 return host, True
89
90 def remove_host(self, host):
91 self.removed_hosts.append(host)
92
93 def on_up(self, host):
94 pass
95
96 def on_down(self, host, is_host_addition):
97 self.down_host = host
98
99
100def _node_meta_results(local_results, peer_results):

Callers 3

setUpMethod · 0.85
test_refresh_disabledMethod · 0.85
setUpMethod · 0.85

Calls 3

ProfileManagerClass · 0.90
IdentityTranslatorClass · 0.90

Tested by 3

setUpMethod · 0.68
test_refresh_disabledMethod · 0.68
setUpMethod · 0.68