mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
refactor(benchmark): Use kebab-case for file and directory names (#10787)
This commit is contained in:
parent
86f4877bab
commit
8fdbf25837
|
@ -12,9 +12,10 @@ module.exports = {
|
|||
project: './tsconfig.json',
|
||||
},
|
||||
|
||||
ignorePatterns: ['scenarios/**', 'scripts/**'],
|
||||
ignorePatterns: ['scenarios/**'],
|
||||
|
||||
rules: {
|
||||
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
||||
'n8n-local-rules/no-plain-errors': 'off',
|
||||
complexity: 'error',
|
||||
},
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
"benchmark": "zx scripts/run.mjs",
|
||||
"benchmark-in-cloud": "pnpm benchmark --env cloud",
|
||||
"benchmark-locally": "pnpm benchmark --env local",
|
||||
"provision-cloud-env": "zx scripts/provisionCloudEnv.mjs",
|
||||
"destroy-cloud-env": "zx scripts/destroyCloudEnv.mjs",
|
||||
"provision-cloud-env": "zx scripts/provision-cloud-env.mjs",
|
||||
"destroy-cloud-env": "zx scripts/destroy-cloud-env.mjs",
|
||||
"watch": "concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\""
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
"$schema": "../scenario.schema.json",
|
||||
"name": "BinaryData",
|
||||
"description": "Send a binary file to a webhook, write it to FS, read it from FS and receive it back",
|
||||
"scenarioData": { "workflowFiles": ["binaryData.json"] },
|
||||
"scriptPath": "binaryData.script.js"
|
||||
"scenarioData": { "workflowFiles": ["binary-data.json"] },
|
||||
"scriptPath": "binary-data.script.js"
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
"$schema": "../scenario.schema.json",
|
||||
"name": "HttpNode",
|
||||
"description": "Webhook -> 3x HTTP request to a mock API -> Merge -> Respond to Webhook. Requires a mock API running at http://mockapi:8080",
|
||||
"scenarioData": { "workflowFiles": ["httpNode.json"] },
|
||||
"scriptPath": "httpNode.script.js"
|
||||
"scenarioData": { "workflowFiles": ["http-node.json"] },
|
||||
"scriptPath": "http-node.script.js"
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
"$schema": "../scenario.schema.json",
|
||||
"name": "CodeNodeJsOnceForEach",
|
||||
"description": "A JS Code Node that runs once for each item and adds, modifies and removes properties. The data of 5 items is generated using DebugHelper Node, and returned with RespondToWebhook Node.",
|
||||
"scenarioData": { "workflowFiles": ["jsCodeNodeOnceForEach.json"] },
|
||||
"scriptPath": "jsCodeNodeOnceForEach.script.js"
|
||||
"scenarioData": { "workflowFiles": ["js-code-node-once-for-each.json"] },
|
||||
"scriptPath": "js-code-node-once-for-each.script.js"
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
"$schema": "../scenario.schema.json",
|
||||
"name": "SetNodeExpressions",
|
||||
"description": "Expressions in a Set node",
|
||||
"scenarioData": { "workflowFiles": ["setNodeExpressions.json"] },
|
||||
"scriptPath": "setNodeExpressions.script.js"
|
||||
"scenarioData": { "workflowFiles": ["set-node-expressions.json"] },
|
||||
"scriptPath": "set-node-expressions.script.js"
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
"$schema": "../scenario.schema.json",
|
||||
"name": "SingleWebhook",
|
||||
"description": "A single webhook trigger that responds with a 200 status code",
|
||||
"scenarioData": { "workflowFiles": ["singleWebhook.json"] },
|
||||
"scriptPath": "singleWebhook.script.ts"
|
||||
"scenarioData": { "workflowFiles": ["single-webhook.json"] },
|
||||
"scriptPath": "single-webhook.script.ts"
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
// @ts-check
|
||||
import { $, minimist } from 'zx';
|
||||
import { TerraformClient } from './clients/terraformClient.mjs';
|
||||
import { TerraformClient } from './clients/terraform-client.mjs';
|
||||
|
||||
const RESOURCE_GROUP_NAME = 'n8n-benchmarking';
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
// @ts-check
|
||||
import { which, minimist } from 'zx';
|
||||
import { TerraformClient } from './clients/terraformClient.mjs';
|
||||
import { TerraformClient } from './clients/terraform-client.mjs';
|
||||
|
||||
const args = minimist(process.argv.slice(3), {
|
||||
boolean: ['debug'],
|
|
@ -5,12 +5,12 @@
|
|||
// @ts-check
|
||||
import path from 'path';
|
||||
import { $, argv, fs } from 'zx';
|
||||
import { DockerComposeClient } from './clients/dockerComposeClient.mjs';
|
||||
import { DockerComposeClient } from './clients/docker-compose-client.mjs';
|
||||
import { flagsObjectToCliArgs } from './utils/flags.mjs';
|
||||
|
||||
const paths = {
|
||||
n8nSetupsDir: path.join(__dirname, 'n8nSetups'),
|
||||
mockApiDataPath: path.join(__dirname, 'mockApi'),
|
||||
n8nSetupsDir: path.join(__dirname, 'n8n-setups'),
|
||||
mockApiDataPath: path.join(__dirname, 'mock-api'),
|
||||
};
|
||||
|
||||
const N8N_ENCRYPTION_KEY = 'very-secret-encryption-key';
|
|
@ -11,8 +11,8 @@
|
|||
// @ts-check
|
||||
import { sleep, which, $, tmpdir } from 'zx';
|
||||
import path from 'path';
|
||||
import { SshClient } from './clients/sshClient.mjs';
|
||||
import { TerraformClient } from './clients/terraformClient.mjs';
|
||||
import { SshClient } from './clients/ssh-client.mjs';
|
||||
import { TerraformClient } from './clients/terraform-client.mjs';
|
||||
import { flagsObjectToCliArgs } from './utils/flags.mjs';
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ async function runBenchmarksOnVm(config, benchmarkEnv) {
|
|||
*/
|
||||
async function runBenchmarkForN8nSetup({ config, sshClient, scriptsDir, n8nSetup }) {
|
||||
console.log(`Running benchmarks for ${n8nSetup}...`);
|
||||
const runScriptPath = path.join(scriptsDir, 'runForN8nSetup.mjs');
|
||||
const runScriptPath = path.join(scriptsDir, 'run-for-n8n-setup.mjs');
|
||||
|
||||
const cliArgs = flagsObjectToCliArgs({
|
||||
n8nDockerTag: config.n8nTag,
|
|
@ -39,7 +39,7 @@ const paths = {
|
|||
* @param {Config} config
|
||||
*/
|
||||
export async function runLocally(config) {
|
||||
const runScriptPath = path.join(paths.scriptsDir, 'runForN8nSetup.mjs');
|
||||
const runScriptPath = path.join(paths.scriptsDir, 'run-for-n8n-setup.mjs');
|
||||
|
||||
const cliArgs = flagsObjectToCliArgs({
|
||||
n8nDockerTag: config.n8nTag,
|
|
@ -9,11 +9,11 @@
|
|||
import fs from 'fs';
|
||||
import minimist from 'minimist';
|
||||
import path from 'path';
|
||||
import { runInCloud } from './runInCloud.mjs';
|
||||
import { runLocally } from './runLocally.mjs';
|
||||
import { runInCloud } from './run-in-cloud.mjs';
|
||||
import { runLocally } from './run-locally.mjs';
|
||||
|
||||
const paths = {
|
||||
n8nSetupsDir: path.join(path.resolve('scripts'), 'n8nSetups'),
|
||||
n8nSetupsDir: path.join(path.resolve('scripts'), 'n8n-setups'),
|
||||
};
|
||||
|
||||
async function main() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Command } from '@oclif/core';
|
||||
import { ScenarioLoader } from '@/scenario/scenarioLoader';
|
||||
import { testScenariosPath } from '@/config/commonFlags';
|
||||
import { ScenarioLoader } from '@/scenario/scenario-loader';
|
||||
import { testScenariosPath } from '@/config/common-flags';
|
||||
|
||||
export default class ListCommand extends Command {
|
||||
static description = 'List all available scenarios';
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { Command, Flags } from '@oclif/core';
|
||||
import { ScenarioLoader } from '@/scenario/scenarioLoader';
|
||||
import { ScenarioRunner } from '@/testExecution/scenarioRunner';
|
||||
import { N8nApiClient } from '@/n8nApiClient/n8nApiClient';
|
||||
import { ScenarioDataFileLoader } from '@/scenario/scenarioDataLoader';
|
||||
import type { K6Tag } from '@/testExecution/k6Executor';
|
||||
import { K6Executor } from '@/testExecution/k6Executor';
|
||||
import { testScenariosPath } from '@/config/commonFlags';
|
||||
import { ScenarioLoader } from '@/scenario/scenario-loader';
|
||||
import { ScenarioRunner } from '@/test-execution/scenario-runner';
|
||||
import { N8nApiClient } from '@/n8n-api-client/n8n-api-client';
|
||||
import { ScenarioDataFileLoader } from '@/scenario/scenario-data-loader';
|
||||
import type { K6Tag } from '@/test-execution/k6-executor';
|
||||
import { K6Executor } from '@/test-execution/k6-executor';
|
||||
import { testScenariosPath } from '@/config/common-flags';
|
||||
|
||||
export default class RunCommand extends Command {
|
||||
static description = 'Run all (default) or specified test scenarios';
|
||||
|
@ -80,10 +80,12 @@ export default class RunCommand extends Command {
|
|||
k6ApiToken: flags.k6ApiToken,
|
||||
n8nApiBaseUrl: flags.n8nBaseUrl,
|
||||
tags,
|
||||
resultsWebhook: {
|
||||
url: flags.resultWebhookUrl,
|
||||
authHeader: flags.resultWebhookAuthHeader,
|
||||
},
|
||||
resultsWebhook: flags.resultWebhookUrl
|
||||
? {
|
||||
url: flags.resultWebhookUrl,
|
||||
authHeader: flags.resultWebhookAuthHeader,
|
||||
}
|
||||
: undefined,
|
||||
}),
|
||||
{
|
||||
email: flags.n8nUserEmail,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { AxiosRequestConfig } from 'axios';
|
||||
import { N8nApiClient } from './n8nApiClient';
|
||||
import { N8nApiClient } from './n8n-api-client';
|
||||
|
||||
export class AuthenticatedN8nApiClient extends N8nApiClient {
|
||||
constructor(
|
|
@ -1,5 +1,5 @@
|
|||
import type { AuthenticatedN8nApiClient } from './authenticatedN8nApiClient';
|
||||
import type { Workflow } from '@/n8nApiClient/n8nApiClient.types';
|
||||
import type { AuthenticatedN8nApiClient } from './authenticated-n8n-api-client';
|
||||
import type { Workflow } from '@/n8n-api-client/n8n-api-client.types';
|
||||
|
||||
export class WorkflowApiClient {
|
||||
constructor(private readonly apiClient: AuthenticatedN8nApiClient) {}
|
|
@ -1,7 +1,7 @@
|
|||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import type { Scenario } from '@/types/scenario';
|
||||
import type { Workflow } from '@/n8nApiClient/n8nApiClient.types';
|
||||
import type { Workflow } from '@/n8n-api-client/n8n-api-client.types';
|
||||
|
||||
/**
|
||||
* Loads scenario data files from FS
|
|
@ -3,7 +3,7 @@ import path from 'path';
|
|||
import assert from 'node:assert/strict';
|
||||
import { $, which, tmpfile } from 'zx';
|
||||
import type { Scenario } from '@/types/scenario';
|
||||
import { buildTestReport, type K6Tag } from '@/testExecution/testReport';
|
||||
import { buildTestReport, type K6Tag } from '@/test-execution/test-report';
|
||||
export type { K6Tag };
|
||||
|
||||
export type K6ExecutorOpts = {
|
|
@ -1,6 +1,6 @@
|
|||
import type { AuthenticatedN8nApiClient } from '@/n8nApiClient/authenticatedN8nApiClient';
|
||||
import type { Workflow } from '@/n8nApiClient/n8nApiClient.types';
|
||||
import { WorkflowApiClient } from '@/n8nApiClient/workflowsApiClient';
|
||||
import type { AuthenticatedN8nApiClient } from '@/n8n-api-client/authenticated-n8n-api-client';
|
||||
import type { Workflow } from '@/n8n-api-client/n8n-api-client.types';
|
||||
import { WorkflowApiClient } from '@/n8n-api-client/workflows-api-client';
|
||||
|
||||
/**
|
||||
* Imports scenario data into an n8n instance
|
|
@ -1,9 +1,9 @@
|
|||
import type { K6Executor } from './k6Executor';
|
||||
import type { K6Executor } from './k6-executor';
|
||||
import type { Scenario } from '@/types/scenario';
|
||||
import type { N8nApiClient } from '@/n8nApiClient/n8nApiClient';
|
||||
import type { ScenarioDataFileLoader } from '@/scenario/scenarioDataLoader';
|
||||
import { ScenarioDataImporter } from '@/testExecution/scenarioDataImporter';
|
||||
import { AuthenticatedN8nApiClient } from '@/n8nApiClient/authenticatedN8nApiClient';
|
||||
import type { N8nApiClient } from '@/n8n-api-client/n8n-api-client';
|
||||
import type { ScenarioDataFileLoader } from '@/scenario/scenario-data-loader';
|
||||
import { ScenarioDataImporter } from '@/test-execution/scenario-data-importer';
|
||||
import { AuthenticatedN8nApiClient } from '@/n8n-api-client/authenticated-n8n-api-client';
|
||||
|
||||
/**
|
||||
* Runs scenarios
|
Loading…
Reference in a new issue