Skip to content

Commit 2fba9d5

Browse files
authored
Merge pull request #1655 from AntelopeIO/GH-1643-sync-test-main
[1.2.1 -> main] Test: Modify sync test to sync from the same node
2 parents b3b4550 + 5996b62 commit 2fba9d5

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

tests/p2p_sync_throttle_test.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
Print("Stand up cluster")
5353
# Custom topology:
5454
# prodNode <-> nonProdNode
55-
# <-> throttlingNode <-> throttledNode
56-
# <-> unThrottledNode
55+
# <-> throttlingNode <-> throttledNode (20KB/s)
56+
# <-> unThrottledNode (1TB/s)
5757
#
5858
# Compare the sync time of throttledNode and unThrottledNode
5959
if cluster.launch(pnodes=pnodes, unstartedNodes=3, totalNodes=total_nodes, prodCount=prod_count,
@@ -109,18 +109,25 @@
109109
throttlingNode.cmd[i+1] = throttlingNode.cmd[i+1] + ':20KB/s'
110110
throttleListenIP, throttleListenPort = throttleListenAddr.split(':')
111111
throttlingNode.cmd.append('--p2p-listen-endpoint')
112-
throttlingNode.cmd.append(f'{throttleListenIP}:{int(throttleListenPort)+100}:1TB/s')
112+
unThrottleListenAddr = f'{throttleListenIP}:{int(throttleListenPort)+100}'
113+
throttlingNode.cmd.append(f'{unThrottleListenAddr}:1TB/s')
113114

114115
cluster.biosNode.kill(signal.SIGTERM)
115116

116117
Print("Launch throttling node")
117118
cluster.launchUnstarted(1)
118-
119119
assert throttlingNode.verifyAlive(), "throttling node did not launch"
120120

121121
# Throttling node was offline during block generation and once online receives blocks as fast as possible
122122
assert throttlingNode.waitForBlock(endLargeBlocksHeadBlock), f'wait for block {endLargeBlocksHeadBlock} on throttled node timed out'
123123

124+
throttledNode = cluster.unstartedNodes[0]
125+
throttledNode.cmd.append('--p2p-peer-address')
126+
throttledNode.cmd.append(throttleListenAddr)
127+
unThrottledNode = cluster.unstartedNodes[1]
128+
unThrottledNode.cmd.append('--p2p-peer-address')
129+
unThrottledNode.cmd.append(unThrottleListenAddr)
130+
124131
Print("Launch throttled and un-throttled nodes")
125132
clusterStart = time.time()
126133
cluster.launchUnstarted(2)

tests/p2p_sync_throttle_test_shape.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@
132132
}
133133
],
134134
"peers": [
135-
"testnet_02"
136135
],
137136
"producers": [],
138137
"dont_start": true,
@@ -156,7 +155,6 @@
156155
}
157156
],
158157
"peers": [
159-
"testnet_01"
160158
],
161159
"producers": [],
162160
"dont_start": true,

0 commit comments

Comments
 (0)