n8n
Version:
n8n Workflow Automation Tool
67 lines (66 loc) • 3.33 kB
TypeScript
import { Logger } from '@n8n/backend-common';
import { ExecutionsConfig } from '@n8n/config';
import type { User, TestRun } from '@n8n/db';
import { TestCaseExecutionRepository, TestRunRepository, WorkflowRepository } from '@n8n/db';
import { ErrorReporter, InstanceSettings } from 'n8n-core';
import { ConcurrencyControlService } from '../../concurrency/concurrency-control.service';
import { Publisher } from '../../scaling/pubsub/publisher.service';
import type { IRun, IWorkflowBase } from 'n8n-workflow';
import { ActiveExecutions } from '../../active-executions';
import { EventService } from '../../events/event.service';
import { Telemetry } from '../../telemetry';
import { WorkflowRunner } from '../../workflow-runner';
export interface TestRunMetadata {
testRunId: string;
userId: string;
}
export interface TestCaseExecutionResult {
executionData: IRun;
executionId: string;
}
export declare class TestRunnerService {
private readonly logger;
private readonly telemetry;
private readonly workflowRepository;
private readonly workflowRunner;
private readonly activeExecutions;
private readonly testRunRepository;
private readonly testCaseExecutionRepository;
private readonly errorReporter;
private readonly executionsConfig;
private readonly eventService;
private readonly publisher;
private readonly instanceSettings;
private readonly concurrencyControlService;
private abortControllers;
constructor(logger: Logger, telemetry: Telemetry, workflowRepository: WorkflowRepository, workflowRunner: WorkflowRunner, activeExecutions: ActiveExecutions, testRunRepository: TestRunRepository, testCaseExecutionRepository: TestCaseExecutionRepository, errorReporter: ErrorReporter, executionsConfig: ExecutionsConfig, eventService: EventService, publisher: Publisher, instanceSettings: InstanceSettings, concurrencyControlService: ConcurrencyControlService);
private findEvaluationTriggerNode;
private validateEvaluationTriggerNode;
private hasModelNodeConnected;
private validateSetMetricsNodes;
private validateSetOutputsNodes;
private validateWorkflowConfiguration;
private runTestCase;
private runDatasetTrigger;
static getEvaluationNodes(workflow: IWorkflowBase, operation: 'setMetrics' | 'setOutputs' | 'setInputs', { isDefaultOperation }?: {
isDefaultOperation: boolean;
}): import("n8n-workflow").INode[];
static getEvaluationMetricsNodes(workflow: IWorkflowBase): import("n8n-workflow").INode[];
static getEvaluationSetOutputsNodes(workflow: IWorkflowBase): import("n8n-workflow").INode[];
private extractDatasetTriggerOutput;
private getEvaluationData;
private extractUserDefinedMetrics;
private extractPredefinedMetrics;
runTest(user: User, workflowId: string, concurrency?: number, flagEnabledForUser?: boolean): Promise<void>;
startTestRun(user: User, workflowId: string, concurrency?: number, flagEnabledForUser?: boolean): Promise<{
testRun: TestRun;
finished: Promise<void>;
}>;
private executeTestRun;
canBeCancelled(testRun: TestRun): boolean;
private cancelTestRunLocally;
handleCancelTestRunCommand({ testRunId }: {
testRunId: string;
}): void;
cancelTestRun(testRunId: string): Promise<void>;
}