Skip to content

Commit 93a372d

Browse files
authored
Add bandwidth testing (#3487)
To support performance testing with bandwidth collection, updated Hello World recipe so that it works, and specify UTF-8 encoding when processing metrics files.
1 parent 1b32087 commit 93a372d

File tree

4 files changed

+88
-19
lines changed

4 files changed

+88
-19
lines changed

test/heapwatch/metrics_delta.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,24 @@ def test_metric_line_re():
5454

5555
def parse_metrics(fin):
5656
out = dict()
57-
for line in fin:
58-
if not line:
59-
continue
60-
line = line.strip()
61-
if not line:
62-
continue
63-
if line[0] == '#':
64-
continue
65-
m = metric_line_re.match(line)
66-
if m:
67-
out[m.group(1)] = num(m.group(2))
68-
else:
69-
ab = line.split()
70-
out[ab[0]] = num(ab[1])
57+
try:
58+
for line in fin:
59+
if not line:
60+
continue
61+
line = line.strip()
62+
if not line:
63+
continue
64+
if line[0] == '#':
65+
continue
66+
m = metric_line_re.match(line)
67+
if m:
68+
out[m.group(1)] = num(m.group(2))
69+
else:
70+
ab = line.split()
71+
out[ab[0]] = num(ab[1])
72+
except:
73+
print(f'An exception occurred in parse_metrics: {sys.exc_info()}')
74+
pass
7175
return out
7276

7377
# return b-a
@@ -396,12 +400,12 @@ def process_files(self, args, nick=None, metrics_files=None):
396400
prevbi = None
397401

398402
for path in sorted(metrics_files):
399-
with open(path, 'rt') as fin:
403+
with open(path, 'rt', encoding="utf-8") as fin:
400404
cur = parse_metrics(fin)
401405
bijsonpath = path.replace('.metrics', '.blockinfo.json')
402406
bi = None
403407
if os.path.exists(bijsonpath):
404-
with open(bijsonpath, 'rt') as fin:
408+
with open(bijsonpath, 'rt', encoding="utf-8") as fin:
405409
bi = json.load(fin)
406410
curtime = os.path.getmtime(path)
407411
self.txPool.append(cur.get('algod_tx_pool_count{}'))
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
{
22
"NetworkName": "",
33
"VersionModifier": "",
4-
"ConsensusProtocol": "",
4+
"ConsensusProtocol": "future",
55
"FirstPartKeyRound": 0,
66
"LastPartKeyRound": 1000300,
7+
"PartKeyDilution": 0,
78
"Wallets": [
89
{
910
"Name": "Wallet1",
10-
"Stake": 50,
11+
"Stake": 25,
1112
"Online": true
1213
},
1314
{
1415
"Name": "Wallet2",
15-
"Stake": 50,
16+
"Stake": 25,
1617
"Online": true
18+
},
19+
{
20+
"Name": "Wallet3",
21+
"Stake": 25,
22+
"Online": true
23+
},
24+
{
25+
"Name": "Wallet4",
26+
"Stake": 25,
27+
"Online": false
1728
}
1829
]
1930
}

test/testdata/deployednettemplates/recipes/hello-world/net.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,52 @@
4949
"ConfigJSONOverride": "{ \"DNSBootstrapID\": \"<network>.algodev.network\",\"DeadlockDetection\": -1, \"PeerPingPeriodSeconds\": 30, \"EnableAgreementReporting\": true, \"EnableAgreementTimeMetrics\": true, \"EnableAssembleStats\": true, \"EnableProcessBlockStats\": true }"
5050
}
5151
]
52+
},
53+
{
54+
"Name": "N1",
55+
"Group": "",
56+
"Nodes": [
57+
{
58+
"Name": "node1",
59+
"Wallets": [
60+
{
61+
"Name": "Wallet3",
62+
"ParticipationOnly": false
63+
}
64+
],
65+
"APIEndpoint": "{{APIEndpoint}}",
66+
"APIToken": "{{APIToken}}",
67+
"EnableTelemetry": false,
68+
"TelemetryURI": "{{TelemetryURI}}",
69+
"EnableMetrics": false,
70+
"MetricsURI": "{{MetricsURI}}",
71+
"EnableService": false,
72+
"EnableBlockStats": false,
73+
"ConfigJSONOverride": "{ \"TxPoolExponentialIncreaseFactor\": 1, \"DNSBootstrapID\": \"<network>.algodev.network\", \"DeadlockDetection\": -1, \"PeerPingPeriodSeconds\": 30, \"BaseLoggerDebugLevel\": 4, \"EnableProfiler\": true, \"CadaverSizeTarget\": 0, \"EnableAccountUpdatesStats\": true}"
74+
}
75+
]
76+
},
77+
{
78+
"Name": "NPN1",
79+
"Group": "",
80+
"Nodes": [
81+
{
82+
"Name": "nonParticipatingNode1",
83+
"Wallets": [
84+
{
85+
"Name": "Wallet4",
86+
"ParticipationOnly": false
87+
}
88+
],
89+
"APIEndpoint": "{{APIEndpoint}}",
90+
"APIToken": "{{APIToken}}",
91+
"EnableTelemetry": false,
92+
"EnableMetrics": false,
93+
"EnableService": false,
94+
"EnableBlockStats": false,
95+
"ConfigJSONOverride": "{ \"TxPoolExponentialIncreaseFactor\": 1, \"DNSBootstrapID\": \"<network>.algodev.network\", \"DeadlockDetection\": -1, \"BaseLoggerDebugLevel\": 4, \"CadaverSizeTarget\": 0 }"
96+
}
97+
]
5298
}
5399
]
54100
}

test/testdata/deployednettemplates/recipes/hello-world/topology.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
{
88
"Name": "R2",
99
"Template": "AWS-US-EAST-1-Small"
10+
},
11+
{
12+
"Name": "N1",
13+
"Template": "AWS-US-EAST-1-Small"
14+
},
15+
{
16+
"Name": "NPN1",
17+
"Template": "AWS-US-EAST-1-Small"
1018
}
1119
]
1220
}

0 commit comments

Comments
 (0)