Skip to content

Commit 827da6a

Browse files
authored
fix: finish benchmarks migration and remove init.sh from benchmark folders (#1954)
1 parent 44b5a14 commit 827da6a

81 files changed

Lines changed: 694 additions & 928 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/benchmark.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ jobs:
2626
echo "Benchmarks for polkadot"
2727
mkdir -p artifacts
2828
yarn bench --log-level info --ws-url wss://rpc.polkadot.io
29+
if [ ! -s benchmarks.txt ]; then
30+
echo "::error::yarn bench produced empty benchmarks.txt"
31+
exit 1
32+
fi
33+
if ! grep -q "Avg RequestTime(Latency)" benchmarks.txt; then
34+
echo "::error::benchmarks.txt contains no latency results — wrk done() callback may not have fired"
35+
echo "Contents of benchmarks.txt:"
36+
cat benchmarks.txt
37+
exit 1
38+
fi
2939
mv benchmarks.txt artifacts/
3040
3141
- name: upload artifacts
@@ -56,7 +66,19 @@ jobs:
5666
path: artifacts
5767

5868
- name: Modify benches result for benchmark action
59-
run: ./scripts/ci/benchmarks/generate_benchmark_result.sh artifacts/benchmarks.txt > artifacts/benchmarks.json
69+
run: |
70+
# Write to temp file first — only promote to benchmarks.json if it has entries
71+
./scripts/ci/benchmarks/generate_benchmark_result.sh artifacts/benchmarks.txt > artifacts/benchmarks_tmp.json
72+
ENTRIES=$(python3 -c "import json; print(len(json.load(open('artifacts/benchmarks_tmp.json'))))")
73+
if [ "$ENTRIES" -eq 0 ]; then
74+
echo "::error::benchmarks.json has 0 entries after parsing"
75+
echo "Contents of benchmarks.txt:"
76+
cat artifacts/benchmarks.txt
77+
rm -f artifacts/benchmarks_tmp.json
78+
exit 1
79+
fi
80+
mv artifacts/benchmarks_tmp.json artifacts/benchmarks.json
81+
echo "benchmarks.json contains $ENTRIES benchmark results"
6082
6183
- name: Store benchmark result
6284
uses: benchmark-action/github-action-benchmark@a7bc2366eda11037936ea57d811a43b3418d3073 #1.21.0

benchmarks/accountsConvert/init.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

benchmarks/accountsValidate/init.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

benchmarks/accounts_balance_info/init.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

benchmarks/accountsConvert/accountsConvert.lua renamed to benchmarks/accounts_convert/accounts_convert.lua

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,26 @@
1414
-- You should have received a copy of the GNU General Public License
1515
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
local accountsConvert = {
18-
'0xde1894014026720b9918b1b21b488af8a0d4f15953621233830946ec0b4d7b75/convert'
17+
-- Accounts convert endpoint benchmark script
18+
-- Tests the /accounts/{accountId}/convert endpoint for latency and throughput
19+
20+
local util = require("util")
21+
22+
local endpoints = {
23+
'0xde1894014026720b9918b1b21b488af8a0d4f15953621233830946ec0b4d7b75/convert',
1924
}
2025

21-
return accountsConvert
26+
util.print_endpoints(endpoints)
27+
28+
local counter = 1
29+
30+
request = function()
31+
local endpoint = endpoints[counter]
32+
counter = counter + 1
33+
if counter > #endpoints then
34+
counter = 1
35+
end
36+
return wrk.format("GET", util.prefix .. "/accounts/" .. endpoint)
37+
end
38+
39+
done = util.done()

benchmarks/accounts_staking_info/init.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

benchmarks/accounts_staking_payouts/init.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

benchmarks/accountsValidate/accountsValidate.lua renamed to benchmarks/accounts_validate/accounts_validate.lua

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
-- You should have received a copy of the GNU General Public License
1515
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
local accountsValidate = {
17+
-- Accounts validate endpoint benchmark script
18+
-- Tests the /accounts/{accountId}/validate endpoint for latency and throughput
19+
20+
local util = require("util")
21+
22+
local endpoints = {
1823
'15GADXLmZpfCDgVcPuLGCwLAWw3hV9UpwPHw9BJuZEkQREqB/validate',
1924
'148fP7zCq1JErXCy92PkNam4KZNcroG9zbbiPwMB1qehgeT4/validate',
2025
'121bKwxHucGnDavnkQymq2hW12hsQ3KvXR1zJwAWiafG3Lfx/validate',
@@ -25,7 +30,20 @@ local accountsValidate = {
2530
'0x002a39366f6620a6c2e2fed5990a3d419e6a19dd127fc7a50b515cf17e2dc5cc592312/validate', -- polkadot addr
2631
'0x02ce046d43fc4c0fb8b3b754028515e5020f5f1d8d620b4ef0f983c5df34b1952909e9/validate', -- kusama addr
2732
'0x086d6f646c6163612f6364707400000000000000000000000000000000000000008333/validate', -- karura addr
28-
'0x2a39366f6620a6c2e2fed5990a3d419e6a19dd127fc7a50b515cf17e2dc5cc59/validate', -- Invalid addr
33+
'0x2a39366f6620a6c2e2fed5990a3d419e6a19dd127fc7a50b515cf17e2dc5cc59/validate', -- invalid addr
2934
}
3035

31-
return accountsValidate
36+
util.print_endpoints(endpoints)
37+
38+
local counter = 1
39+
40+
request = function()
41+
local endpoint = endpoints[counter]
42+
counter = counter + 1
43+
if counter > #endpoints then
44+
counter = 1
45+
end
46+
return wrk.format("GET", util.prefix .. "/accounts/" .. endpoint)
47+
end
48+
49+
done = util.done()

benchmarks/accounts_vesting_info/init.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

benchmarks/blocksBlockId/blocks.lua

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)