mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
benchmark: fix write benchmark.json (#956)
This commit is contained in:
1 parent
f36c13dcf5
commit
985fd7224d
1 file changed
+2
-2
+2
-2
@@ -61,8 +61,8 @@ describe('App', () => {
|
|||||||
|
|
||||||
// TODO add more tests
|
// TODO add more tests
|
||||||
|
|
||||||
|
const results: Record<string, autocannon.Result> = {};
|
||||||
if (process.env.BENCHMARK) {
|
if (process.env.BENCHMARK) {
|
||||||
const results: Record<string, autocannon.Result> = {};
|
|
||||||
routes.forEach((route) => it(`Performance test ${route}`, { timeout: 60000 }, async () => {
|
routes.forEach((route) => it(`Performance test ${route}`, { timeout: 60000 }, async () => {
|
||||||
await global.Hydro.model.system.set('limit.global', 99999);
|
await global.Hydro.model.system.set('limit.global', 99999);
|
||||||
const result = await autocannon({ url: `http://localhost:8888${route}` });
|
const result = await autocannon({ url: `http://localhost:8888${route}` });
|
||||||
@@ -73,7 +73,7 @@ describe('App', () => {
|
|||||||
|
|
||||||
after(() => {
|
after(() => {
|
||||||
if (process.env.BENCHMARK) {
|
if (process.env.BENCHMARK) {
|
||||||
const metrics = Object.entries(([k, v]) => ({
|
const metrics = Object.entries(results).map(([k, v]) => ({
|
||||||
name: `Benchmark - ${k} - Req/sec`,
|
name: `Benchmark - ${k} - Req/sec`,
|
||||||
unit: 'Req/sec',
|
unit: 'Req/sec',
|
||||||
value: v.requests.average,
|
value: v.requests.average,
|
||||||
|
|||||||
Reference in new issue
Block a user