feat(benchmark): New options for n8n benchmark (#10741)

This commit is contained in:
Tomi Turtiainen
2024-09-10 09:25:41 +03:00
committed by GitHub
parent 96db501a61
commit d81f21d08e
14 changed files with 165 additions and 117 deletions

View File

@@ -3,10 +3,20 @@ import path from 'path';
import { $, which, tmpfile } from 'zx';
import type { Scenario } from '@/types/scenario';
export type K6Tag = {
name: string;
value: string;
};
export type K6ExecutorOpts = {
k6ExecutablePath: string;
/** How many concurrent requests to make */
vus: number;
/** Test duration, e.g. 1m or 30s */
duration: string;
k6ApiToken?: string;
n8nApiBaseUrl: string;
tags?: K6Tag[];
};
export type K6RunOpts = {
@@ -19,7 +29,7 @@ export type K6RunOpts = {
* @example ['--duration', '1m']
* @example ['--quiet']
*/
type K6CliFlag = [string] | [string, string];
type K6CliFlag = [string | number] | [string, string | number];
/**
* Executes test scenarios using k6
@@ -45,7 +55,11 @@ export function handleSummary(data) {
const augmentedTestScriptPath = this.augmentSummaryScript(scenario, scenarioRunName);
const runDirPath = path.dirname(augmentedTestScriptPath);
const flags: K6CliFlag[] = [['--quiet'], ['--duration', '3m'], ['--vus', '5']];
const flags: K6CliFlag[] = [
['--quiet'],
['--duration', this.opts.duration],
['--vus', this.opts.vus],
];
if (this.opts.k6ApiToken) {
flags.push(['--out', 'cloud']);

View File

@@ -243,7 +243,7 @@ interface RootGroup {
name: string;
path: string;
id: string;
groups: any[];
groups: unknown[];
checks: Check[];
}