///
import * as child_process from 'child_process';
import { AwsClients } from './aws-helpers';
import { TestContext } from './test-helpers';
export declare type AwsContext = {
readonly aws: AwsClients;
};
/**
* Higher order function to execute a block with an AWS client setup
*
* Allocate the next region from the REGION pool and dispose it afterwards.
*/
export declare function withAws(block: (context: A & AwsContext) => Promise): (context: A) => Promise;
/**
* Higher order function to execute a block with a CDK app fixture
*
* Requires an AWS client to be passed in.
*
* For backwards compatibility with existing tests (so we don't have to change
* too much) the inner block is expecte to take a `TestFixture` object.
*/
export declare function withCdkApp(block: (context: TestFixture) => Promise): (context: A) => Promise;
/**
* Default test fixture for most (all?) integ tests
*
* It's a composition of withAws/withCdkApp, expecting the test block to take a `TestFixture`
* object.
*
* We could have put `withAws(withCdkApp(fixture => { /... actual test here.../ }))` in every
* test declaration but centralizing it is going to make it convenient to modify in the future.
*/
export declare function withDefaultFixture(block: (context: TestFixture) => Promise): (context: TestContext) => Promise;
export interface ShellOptions extends child_process.SpawnOptions {
/**
* Properties to add to 'env'
*/
modEnv?: Record;
/**
* Don't fail when exiting with an error
*
* @default false
*/
allowErrExit?: boolean;
/**
* Whether to capture stderr
*
* @default true
*/
captureStderr?: boolean;
/**
* Pass output here
*/
output?: NodeJS.WritableStream;
}
export interface CdkCliOptions extends ShellOptions {
options?: string[];
neverRequireApproval?: boolean;
}
/**
* Prepare a target dir byreplicating a source directory
*/
export declare function cloneDirectory(source: string, target: string, output?: NodeJS.WritableStream): Promise;
export declare class TestFixture {
readonly integTestDir: string;
readonly stackNamePrefix: string;
readonly output: NodeJS.WritableStream;
readonly aws: AwsClients;
readonly qualifier: string;
private readonly bucketsToDelete;
constructor(integTestDir: string, stackNamePrefix: string, output: NodeJS.WritableStream, aws: AwsClients);
log(s: string): void;
shell(command: string[], options?: Omit): Promise;
cdkDeploy(stackNames: string | string[], options?: CdkCliOptions): Promise;
cdkDestroy(stackNames: string | string[], options?: CdkCliOptions): Promise;
cdk(args: string[], options?: CdkCliOptions): Promise;
fullStackName(stackName: string): string;
fullStackName(stackNames: string[]): string[];
/**
* Append this to the list of buckets to potentially delete
*
* At the end of a test, we clean up buckets that may not have gotten destroyed
* (for whatever reason).
*/
rememberToDeleteBucket(bucketName: string): void;
/**
* Cleanup leftover stacks and buckets
*/
dispose(success: boolean): Promise;
/**
* Return the stacks starting with our testing prefix that should be deleted
*/
private deleteableStacks;
}
/**
* A shell command that does what you want
*
* Is platform-aware, handles errors nicely.
*/
export declare function shell(command: string[], options?: ShellOptions): Promise;
/**
* rm -rf reimplementation, don't want to depend on an NPM package for this
*/
export declare function rimraf(fsPath: string): void;
export declare function randomString(): string;