import type { ResourceImpact } from '@aws-cdk/cloudformation-diff'; import type { EnvironmentSummary, TestEnvironment } from './environment-pool'; import type { IntegTestInfo } from '../runner/integration-tests'; /** * The aggregate results from running assertions on a test case */ export type AssertionResults = { [id: string]: AssertionResult; }; /** * The result of an individual assertion */ export interface AssertionResult { /** * The assertion message. If the assertion failed, this will * include the reason. */ readonly message: string; /** * Whether the assertion succeeded or failed */ readonly status: 'success' | 'fail'; } /** * Config for an integration test */ export interface IntegTestWorkerConfig extends IntegTestInfo { /** * A list of any destructive changes * * @default [] */ readonly destructiveChanges?: DestructiveChange[]; } /** * Information on any destructive changes */ export interface DestructiveChange { /** * The logicalId of the resource with a destructive change */ readonly logicalId: string; /** * The name of the stack that contains the destructive change */ readonly stackName: string; /** * The impact of the destructive change */ readonly impact: ResourceImpact; } /** * Represents integration tests metrics for a given worker */ export interface IntegRunnerMetrics { /** * The region the test was run in */ readonly region: string; /** * The total duration of the worker. * This will be the sum of all individual test durations */ readonly duration: number; /** * Contains the duration of individual tests that the * worker executed. * * Map of testName to duration. */ readonly tests: { [testName: string]: number; }; /** * The profile that was used to run the test * * @default - default profile */ readonly profile?: string; } export interface SnapshotVerificationOptions { /** * Retain failed snapshot comparisons * * @default false */ readonly retain?: boolean; /** * Verbose mode * * @default false */ readonly verbose?: boolean; /** * In unit test mode, leave the synth output directories, don't clean them. * * Many of our tests use mocks and don't actually synth output directories, they are * static and must not be deleted. */ readonly testingUsingMocksLeaveDirectories?: boolean; } /** * Integration test results */ export interface IntegBatchResponse { /** * List of failed tests */ readonly failedTests: IntegTestInfo[]; /** * List of Integration test metrics. Each entry in the * list represents metrics from a single worker (account + region). */ readonly metrics: IntegRunnerMetrics[]; /** * Summary of the environments used during the test run */ readonly testEnvironments: EnvironmentSummary; } /** * Common options for running integration tests */ export interface IntegTestOptions { /** * A list of integration tests to run * in this batch */ readonly tests: IntegTestWorkerConfig[]; /** * Whether or not to destroy the stacks at the * end of the test * * @default true */ readonly clean?: boolean; /** * When this is set to `true` the snapshot will * be created _without_ running the integration test * The resulting snapshot SHOULD NOT be checked in * * @default false */ readonly dryRun?: boolean; /** * The level of verbosity for logging. * Higher number means more output. * * @default 0 */ readonly verbosity?: number; /** * If this is set to true then the stack update workflow will be disabled * * @default true */ readonly updateWorkflow?: boolean; /** * List of git tags to deploy in sequence before deploying the current code. * When provided, replaces the normal merge-base update workflow. * * @default - use the normal update workflow */ readonly updateFromTags?: string[]; /** * true if running in watch mode * * @default false */ readonly watch?: boolean; /** * Use the indicated proxy * * @default - no proxy */ readonly proxy?: string; /** * Path to CA certificate to use when validating HTTPS requests * * @default - no additional CA bundle */ readonly caBundlePath?: string; /** * ARN of the IAM role for CloudFormation to assume during deploy/destroy * * @default - use the bootstrap cfn-exec role */ readonly roleArn?: string; /** * Whether to allow resources that fail to delete during a stack update. * * When false, the test will fail if CloudFormation skips deleting a resource * during a stack update. When true, only a warning is printed. * * @default false */ readonly allowDeleteFailures?: boolean; /** * In unit test mode, leave the synth output directories, don't clean them. * * Many of our tests use mocks and don't actually synth output directories, they are * static and must not be deleted. */ readonly testingUsingMocksLeaveDirectories?: boolean; } /** * Represents possible reasons for a diagnostic */ export declare enum DiagnosticReason { /** * The integration test failed because there * is not existing snapshot */ NO_SNAPSHOT = "NO_SNAPSHOT", /** * The integration test failed */ TEST_FAILED = "TEST_FAILED", /** * There was an error running the integration test */ TEST_ERROR = "TEST_ERROR", /** * A non-failing warning from the integration test run */ TEST_WARNING = "TEST_WARNING", /** * The snapshot test failed because the actual * snapshot was different than the expected snapshot */ SNAPSHOT_FAILED = "SNAPSHOT_FAILED", /** * The snapshot test failed because there was an error executing it */ SNAPSHOT_ERROR = "SNAPSHOT_ERROR", /** * The snapshot test succeeded */ SNAPSHOT_SUCCESS = "SNAPSHOT_SUCCESS", /** * The integration test succeeded */ TEST_SUCCESS = "TEST_SUCCESS", /** * The assertion failed */ ASSERTION_FAILED = "ASSERTION_FAILED", /** * The test environment is not bootstrapped * * The test did not fail because of its own behavior and * can be retried in a different environment. */ NOT_BOOTSTRAPPED = "NOT_BOOTSTRAPPED" } /** * Integration test diagnostics * This is used to report back the status of each test */ export interface Diagnostic { /** * The name of the test */ readonly testName: string; /** * The name of the stack * * @default - not associated with a specific stack */ readonly stackName?: string; /** * The diagnostic message */ readonly message: string; /** * The time it took to run the test */ readonly duration?: number; /** * The reason for the diagnostic */ readonly reason: DiagnosticReason; /** * Additional messages to print */ readonly additionalMessages?: string[]; /** * Relevant config options that were used for the integ test */ readonly config?: Record; /** * The environment the diagnostic occurred in * * Set for `NOT_BOOTSTRAPPED` diagnostics, so the orchestrator can remove * the environment from its pool and report it at the end of the run. * * @default - not relevant for this diagnostic */ readonly environment?: TestEnvironment; } export declare function printSummary(total: number, failed: number): void; /** * Format the assertion results so that the results can be * printed */ export declare function formatAssertionResults(results: AssertionResults): string; /** * Print out the results from tests */ export declare function printResults(diagnostic: Diagnostic): void; export declare function printLaggards(testNames: Set): void; export declare function formatError(error: any): string; /** * Formats an environment as `profile/region` (or just `region` for the default profile) */ export declare function formatEnvironmentName(env: TestEnvironment): string; /** * Prints a summary of environments that were removed during the test run, * including the exact `cdk bootstrap` command to fix each one. */ export declare function printEnvironmentsSummary(summary: EnvironmentSummary): void; //# sourceMappingURL=common.d.ts.map