n8n
Version:
n8n Workflow Automation Tool
62 lines (61 loc) • 3.32 kB
TypeScript
import { ErrorReporter, Logger } from 'n8n-core';
import type { IWorkflowBase } from 'n8n-workflow';
import { ActiveExecutions } from '../../active-executions';
import type { ExecutionEntity } from '../../databases/entities/execution-entity';
import type { TestDefinition } from '../../databases/entities/test-definition.ee';
import type { TestRun } from '../../databases/entities/test-run.ee';
import type { User } from '../../databases/entities/user';
import { ExecutionRepository } from '../../databases/repositories/execution.repository';
import { TestCaseExecutionRepository } from '../../databases/repositories/test-case-execution.repository.ee';
import { TestMetricRepository } from '../../databases/repositories/test-metric.repository.ee';
import { TestRunRepository } from '../../databases/repositories/test-run.repository.ee';
import { WorkflowRepository } from '../../databases/repositories/workflow.repository';
import { NodeTypes } from '../../node-types';
import { Telemetry } from '../../telemetry';
import { WorkflowRunner } from '../../workflow-runner';
export interface TestRunMetadata {
testRunId: string;
userId: string;
}
export interface TestCaseRunMetadata extends TestRunMetadata {
pastExecutionId: string;
annotation: ExecutionEntity['annotation'];
highlightedData: ExecutionEntity['metadata'];
}
export declare class TestRunnerService {
private readonly logger;
private readonly telemetry;
private readonly workflowRepository;
private readonly workflowRunner;
private readonly executionRepository;
private readonly activeExecutions;
private readonly testRunRepository;
private readonly testCaseExecutionRepository;
private readonly testMetricRepository;
private readonly nodeTypes;
private readonly errorReporter;
private abortControllers;
constructor(logger: Logger, telemetry: Telemetry, workflowRepository: WorkflowRepository, workflowRunner: WorkflowRunner, executionRepository: ExecutionRepository, activeExecutions: ActiveExecutions, testRunRepository: TestRunRepository, testCaseExecutionRepository: TestCaseExecutionRepository, testMetricRepository: TestMetricRepository, nodeTypes: NodeTypes, errorReporter: ErrorReporter);
cleanupIncompleteRuns(): Promise<void>;
private getStartNodesData;
private runTestCase;
syncMetrics(testDefinitionId: string, evaluationWorkflow: IWorkflowBase): Promise<Set<string>>;
private runTestCaseEvaluation;
static getEvaluationMetricsNodes(workflow: IWorkflowBase): import("n8n-workflow").INode[];
private extractEvaluationResult;
private getUsedTestMetricNames;
runTest(user: User, test: TestDefinition): Promise<void>;
canBeCancelled(testRun: TestRun): boolean;
cancelTestRun(testRunId: string): Promise<void>;
getExampleEvaluationInputData(test: TestDefinition, annotationTagId: string): Promise<{
annotations: {
vote: import("n8n-workflow").AnnotationVote | null | undefined;
tags: Pick<import("../../databases/entities/annotation-tag-entity.ee").AnnotationTagEntity, "id" | "name">[] | undefined;
highlightedData: {
[k: string]: string;
};
};
originalExecution: Record<string, any>;
newExecution: Record<string, any>;
} | null>;
}