Skip to content

Commit b13c6a7

Browse files
author
Dmitry Surnin
committed
Add data_dir_path override in testNodeClass init
1 parent a7a9d56 commit b13c6a7

18 files changed

+35
-21
lines changed

plenum/test/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ def txnPoolNodeSet(patchPluginManager,
730730
node = exitStack.enter_context(
731731
testNodeClass(nm,
732732
basedirpath=tdirWithPoolTxns,
733+
base_data_dir=tdirWithPoolTxns,
733734
config=tconf,
734735
pluginPaths=allPluginsPath))
735736
txnPoolNodesLooper.add(node)
@@ -814,7 +815,7 @@ def testNode(pluginManager, tdir):
814815
nodeReg = genNodeReg(names=[name])
815816
ha, cliname, cliha = nodeReg[name]
816817
node = TestNode(name=name, ha=ha, cliname=cliname, cliha=cliha,
817-
nodeRegistry=copy(nodeReg), basedirpath=tdir,
818+
nodeRegistry=copy(nodeReg), basedirpath=tdir, base_data_dir=tdir,
818819
primaryDecider=None, pluginPaths=None, seed=randomSeed())
819820
node.start(None)
820821
yield node

plenum/test/node_catchup/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ def nodeCreatedAfterSomeTxns(looper, txnPoolNodeSet,
5353
newStewardWallet
5454

5555

56+
def test_tt(nodeCreatedAfterSomeTxns):
57+
pass
58+
59+
5660
@pytest.fixture("module")
5761
def nodeSetWithNodeAddedAfterSomeTxns(
5862
txnPoolNodeSet, nodeCreatedAfterSomeTxns):
@@ -115,3 +119,7 @@ def poolAfterSomeTxns(
115119
client,
116120
txnCount)
117121
yield looper, client, wallet
122+
123+
124+
def test_trtr(poolAfterSomeTxns):
125+
pass

plenum/test/node_catchup/test_node_catchup_after_restart_after_txns.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def test_node_catchup_after_restart_with_txns(
6464
newNode = TestNode(
6565
newNode.name,
6666
basedirpath=tdirWithPoolTxns,
67+
base_data_dir=tdirWithPoolTxns,
6768
config=tconf,
6869
ha=nodeHa,
6970
cliha=nodeCHa,

plenum/test/node_catchup/test_node_catchup_after_restart_no_txns.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def test_node_catchup_after_restart_no_txns(
4949
new_node = TestNode(
5050
new_node.name,
5151
basedirpath=tdirWithPoolTxns,
52+
base_data_dir=tdirWithPoolTxns,
5253
config=tconf,
5354
ha=nodeHa,
5455
cliha=nodeCHa,

plenum/test/pool_transactions/helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def start_newly_added_node(
110110
auto_start,
111111
plugin_path,
112112
nodeClass):
113-
node = nodeClass(node_name, basedirpath=tdir, config=conf,
113+
node = nodeClass(node_name, basedirpath=tdir, base_data_dir=tdir, config=conf,
114114
ha=node_ha, cliha=client_ha,
115115
pluginPaths=plugin_path)
116116
if auto_start:
@@ -192,7 +192,7 @@ def updateNodeDataAndReconnect(looper, steward, stewardWallet, node,
192192
client_ip = node_data.get(CLIENT_IP, None) or node.clientstack.ha.host
193193
client_port = node_data.get(CLIENT_PORT, None) or node.clientstack.ha.port
194194
looper.removeProdable(name=node.name)
195-
restartedNode = TestNode(node_alias, basedirpath=tdirWithPoolTxns,
195+
restartedNode = TestNode(node_alias, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns,
196196
config=tconf,
197197
ha=HA(node_ip, node_port),
198198
cliha=HA(client_ip, client_port))

plenum/test/pool_transactions/test_change_ha_persists_post_nodes_restart.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ def testChangeHaPersistsPostNodesRestart(looper, txnPoolNodeSet,
4444
# what happens when starting the node with script
4545
restartedNodes = []
4646
for node in txnPoolNodeSet[:-1]:
47-
restartedNode = TestNode(node.name, basedirpath=tdirWithPoolTxns,
47+
restartedNode = TestNode(node.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns,
4848
config=tconf, ha=node.nodestack.ha,
4949
cliha=node.clientstack.ha)
5050
looper.add(restartedNode)
5151
restartedNodes.append(restartedNode)
5252

5353
# Starting the node whose HA was changed
54-
node = TestNode(newNode.name, basedirpath=tdirWithPoolTxns, config=tconf,
54+
node = TestNode(newNode.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns, config=tconf,
5555
ha=nodeNewHa, cliha=clientNewHa)
5656
looper.add(node)
5757
restartedNodes.append(node)

plenum/test/pool_transactions/test_client_with_pool_txns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def testClientConnectToRestartedNodes(looper, txnPoolNodeSet, tdirWithPoolTxns,
7171
# looper.run(newClient.ensureDisconnectedToNodes(timeout=60))
7272
txnPoolNodeSet = []
7373
for nm in poolTxnNodeNames:
74-
node = TestNode(nm, basedirpath=tdirWithPoolTxns,
74+
node = TestNode(nm, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns,
7575
config=tconf, pluginPaths=allPluginsPath)
7676
looper.add(node)
7777
txnPoolNodeSet.append(node)

plenum/test/pool_transactions/test_nodes_ha_change_back.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def testChangeNodeHaBack(looper, txnPoolNodeSet, tdirWithPoolTxns,
4545

4646
# In order to save the time the pool connection is not maintaining
4747
# during the steps, only the final result is checked.
48-
restartedNode = TestNode(theta.name, basedirpath=tdirWithPoolTxns,
48+
restartedNode = TestNode(theta.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns,
4949
config=tconf, ha=correctNodeHa, cliha=clientHa)
5050
looper.add(restartedNode)
5151
txnPoolNodeSet[-1] = restartedNode

plenum/test/pool_transactions/test_suspend_node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def testStewardSuspendsNode(looper, txnPoolNodeSet,
7575
if not n.hasPrimary][0]
7676
oldNode.stop()
7777
looper.removeProdable(oldNode)
78-
oldNode = TestNode(oldNode.name, basedirpath=tdirWithPoolTxns,
78+
oldNode = TestNode(oldNode.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns,
7979
config=tconf, pluginPaths=allPluginsPath)
8080
looper.add(oldNode)
8181
txnPoolNodeSet[oldNodeIdx] = oldNode
@@ -86,7 +86,7 @@ def testStewardSuspendsNode(looper, txnPoolNodeSet,
8686
# nodes and clients can also connect to that node
8787
cancelNodeSuspension(looper, newSteward, newStewardWallet, newNodeNym,
8888
newNode.name)
89-
nodeTheta = TestNode(newNode.name, basedirpath=tdirWithPoolTxns,
89+
nodeTheta = TestNode(newNode.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns,
9090
config=tconf, pluginPaths=allPluginsPath,
9191
ha=newNode.nodestack.ha, cliha=newNode.clientstack.ha)
9292
looper.add(nodeTheta)

plenum/test/pool_transactions/test_z_node_key_changed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def testNodeKeysChanged(looper, txnPoolNodeSet, tdirWithPoolTxns,
4242
override=True)
4343

4444
logger.debug("{} starting with HAs {} {}".format(newNode, nodeHa, nodeCHa))
45-
node = TestNode(newNode.name, basedirpath=tdirWithPoolTxns, config=tconf,
45+
node = TestNode(newNode.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns, config=tconf,
4646
ha=nodeHa, cliha=nodeCHa, pluginPaths=allPluginsPath)
4747
looper.add(node)
4848
# The last element of `txnPoolNodeSet` is the node Theta that was just

plenum/test/primary_selection/test_primary_selection_after_primary_demotion_and_pool_restart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_primary_selection_after_primary_demotion_and_pool_restart(looper,
4747
# what happens when starting the node with script
4848
restartedNodes = []
4949
for node in txnPoolNodeSet:
50-
restartedNode = TestNode(node.name, basedirpath=tdirWithPoolTxns,
50+
restartedNode = TestNode(node.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns,
5151
config=tconf, ha=node.nodestack.ha,
5252
cliha=node.clientstack.ha)
5353
looper.add(restartedNode)

plenum/test/script/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def changeNodeHa(looper, txnPoolNodeSet, tdirWithPoolTxns,
5656
looper.removeProdable(subjectedNode)
5757

5858
# start node with new HA
59-
restartedNode = TestNode(subjectedNode.name, basedirpath=tdirWithPoolTxns,
59+
restartedNode = TestNode(subjectedNode.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns,
6060
config=tconf, ha=nodeStackNewHA,
6161
cliha=clientStackNewHA)
6262
looper.add(restartedNode)

plenum/test/test_node.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ def addNode(self, name: str) -> TestNode:
436436
cliha=cliha,
437437
nodeRegistry=copy(self.nodeReg),
438438
basedirpath=self.tmpdir,
439+
base_data_dir=self.tmpdir,
439440
primaryDecider=self.primaryDecider,
440441
pluginPaths=self.pluginPaths,
441442
seed=seed))

plenum/test/test_node_connection.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def testNodesConnectsWhenOneNodeIsLate(allPluginsPath, tdirAndLooper,
5959
logger.debug("Node names: {}".format(names))
6060

6161
def create(name):
62-
node = TestNode(name, nodeReg, basedirpath=tdir,
62+
node = TestNode(name, nodeReg, basedirpath=tdir, base_data_dir=tdir,
6363
pluginPaths=allPluginsPath)
6464
nodes.append(node)
6565
return node
@@ -97,7 +97,7 @@ def testNodesConnectWhenTheyAllStartAtOnce(allPluginsPath, tdirAndLooper,
9797
initLocalKeys(tdir, nodeReg)
9898

9999
for name in nodeReg:
100-
node = TestNode(name, nodeReg, basedirpath=tdir,
100+
node = TestNode(name, nodeReg, basedirpath=tdir, base_data_dir=tdir,
101101
pluginPaths=allPluginsPath)
102102
nodes.append(node)
103103

@@ -130,7 +130,7 @@ def testNodesComingUpAtDifferentTimes(allPluginsPath, tdirAndLooper,
130130
rwaits = [randint(1, 10) for _ in names]
131131

132132
for name in names:
133-
node = TestNode(name, nodeReg, basedirpath=tdir,
133+
node = TestNode(name, nodeReg, basedirpath=tdir, base_data_dir=tdir,
134134
pluginPaths=allPluginsPath)
135135
nodes.append(node)
136136

@@ -172,7 +172,7 @@ def testNodeConnection(allPluginsPath, tdirAndLooper, nodeReg):
172172
logger.debug(names)
173173
nodes = []
174174
for name in names:
175-
node = TestNode(name, nrg, basedirpath=tdir,
175+
node = TestNode(name, nrg, basedirpath=tdir, base_data_dir=tdir,
176176
pluginPaths=allPluginsPath)
177177
nodes.append(node)
178178

@@ -208,7 +208,7 @@ def testNodeRemoveUnknownRemote(allPluginsPath, tdirAndLooper, nodeReg, conf):
208208

209209
nodes = []
210210
for name in names:
211-
node = TestNode(name, nrg, basedirpath=tdir,
211+
node = TestNode(name, nrg, basedirpath=tdir, base_data_dir=tdir,
212212
pluginPaths=allPluginsPath)
213213
nodes.append(node)
214214

@@ -222,7 +222,7 @@ def testNodeRemoveUnknownRemote(allPluginsPath, tdirAndLooper, nodeReg, conf):
222222

223223
initLocalKeys(tdir, {"Gamma": nodeReg["Gamma"]})
224224
C = TestNode("Gamma", {**nrg, **{"Gamma": nodeReg["Gamma"]}},
225-
basedirpath=tdir, pluginPaths=allPluginsPath)
225+
basedirpath=tdir, base_data_dir=tdir, pluginPaths=allPluginsPath)
226226
for node in nodes:
227227
tellKeysToOthers(node, [C, ])
228228

plenum/test/test_performance.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ def test_node_load_after_add_then_disconnect(newNodeCaughtUp, txnPoolNodeSet,
227227
new_node = TestNode(
228228
new_node.name,
229229
basedirpath=tdirWithPoolTxns,
230+
base_data_dir=tdirWithPoolTxns,
230231
config=tconf,
231232
ha=nodeHa,
232233
cliha=nodeCHa,
@@ -295,7 +296,7 @@ def test_node_load_after_disconnect(looper, txnPoolNodeSet, tconf,
295296
format(i + 1, txns_per_batch, perf_counter() - s))
296297

297298
nodeHa, nodeCHa = HA(*x.nodestack.ha), HA(*x.clientstack.ha)
298-
newNode = TestNode(x.name, basedirpath=tdirWithPoolTxns, config=tconf,
299+
newNode = TestNode(x.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns, config=tconf,
299300
ha=nodeHa, cliha=nodeCHa, pluginPaths=allPluginsPath)
300301
looper.add(newNode)
301302
txnPoolNodeSet[-1] = newNode

plenum/test/test_state_regenerated_from_ledger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_state_regenerated_from_ledger(
4343

4444
shutil.rmtree(state_db_path)
4545

46-
restarted_node = TestNode(node_to_stop.name, basedirpath=tdirWithPoolTxns,
46+
restarted_node = TestNode(node_to_stop.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns,
4747
config=tconf, ha=nodeHa, cliha=nodeCHa,
4848
pluginPaths=allPluginsPath)
4949
looper.add(restarted_node)

plenum/test/view_change/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def start_stopped_node(stopped_node, looper, tconf,
213213
nodeHa, nodeCHa = HA(*
214214
stopped_node.nodestack.ha), HA(*
215215
stopped_node.clientstack.ha)
216-
restarted_node = TestNode(stopped_node.name, basedirpath=tdirWithPoolTxns,
216+
restarted_node = TestNode(stopped_node.name, basedirpath=tdirWithPoolTxns, base_data_dir=tdirWithPoolTxns,
217217
config=tconf,
218218
ha=nodeHa, cliha=nodeCHa,
219219
pluginPaths=allPluginsPath)

plenum/test/zstack_tests/test_zstack_reconnection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def checkFlakyConnected(conn=True):
5050
node = TestNode(
5151
nodeToCrash.name,
5252
basedirpath=tdirWithPoolTxns,
53+
base_data_dir=tdirWithPoolTxns,
5354
config=tconf,
5455
ha=nodeToCrash.nodestack.ha,
5556
cliha=nodeToCrash.clientstack.ha)

0 commit comments

Comments
 (0)