Skip to content

Commit

Permalink
remove test updates and only update init
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealAmazonKendra committed Oct 11, 2023
1 parent f319e9c commit c626a1c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 113 deletions.
52 changes: 0 additions & 52 deletions packages/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,40 +84,6 @@ export function withCdkApp(
};
}

export function withCdkMigrateApp<A extends TestContext>(language: string, block: (context: TestFixture) => Promise<void>) {
return async (context: A) => {
const stackName = `cdk-migrate-${language}-integ-${context.randomString}`;
const integTestDir = path.join(os.tmpdir(), `cdk-migrate-${language}-integ-${context.randomString}`);

context.output.write(` Stack name: ${stackName}\n`);
context.output.write(` Test directory: ${integTestDir}\n`);

const awsClients = await AwsClients.default(context.output);
fs.mkdirSync(integTestDir);
const fixture = new TestFixture(
integTestDir,
stackName,
context.output,
awsClients,
context.randomString,
);

let success = true;
try {
await block(fixture);
} catch (e) {
success = false;
throw e;
} finally {
if (process.env.INTEG_NO_CLEAN) {
context.log(`Left test directory in '${integTestDir}' ($INTEG_NO_CLEAN)`);
} else {
await fixture.dispose(success);
}
}
};
}

export function withMonolithicCfnIncludeCdkApp<A extends TestContext>(block: (context: TestFixture) => Promise<void>) {
return async (context: A) => {
const uberPackage = process.env.UBERPACKAGE;
Expand Down Expand Up @@ -175,10 +141,6 @@ export function withDefaultFixture(block: (context: TestFixture) => Promise<void
return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withCdkApp(block)));
}

export function withCDKMigrateFixture(language: string, block: (content: TestFixture) => Promise<void>) {
return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withCdkMigrateApp(language, block)));
}

export interface DisableBootstrapContext {
/**
* Whether to disable creating the default bootstrap
Expand Down Expand Up @@ -417,20 +379,6 @@ export class TestFixture extends ShellHelper {
});
}

public async cdkMigrate(language: string, stackName: string, inputPath?: string, options?: CdkCliOptions) {
console.log(path.join(__dirname, '..', 'resources', 'templates', 'sqs-template.json').toString());
return this.cdk([
'migrate',
'--language',
language,
'--stack-name',
stackName,
'--from-path',
inputPath ?? path.join(__dirname, '..', 'resources', 'templates', 'sqs-template.json').toString(),
...(options?.options ?? []),
], options);
}

public async cdk(args: string[], options: CdkCliOptions = {}) {
const verbose = options.verbose ?? true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
testTimeout: 300000,

// Affects test.concurrent(), these are self-limiting anyway
maxWorkers: '50%',
maxConcurrency: 10,
reporters: [
"default",
[ "jest-junit", { suiteName: "jest tests", outputDirectory: "coverage" } ]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -571,30 +571,6 @@ integTest('deploy with role', withDefaultFixture(async (fixture) => {
}
}));

// TODO add go back in when template synths properly
['typescript', 'python', 'csharp', 'java'].forEach(language => {
integTest(`cdk migrate ${language}`, withCDKMigrateFixture(language, async (fixture) => {
await fixture.cdkMigrate(language, fixture.stackNamePrefix);
await fixture.shell(['ls']);
await fixture.shell(['pwd']);
await fixture.shell(['cd', fixture.stackNamePrefix]);
await fixture.shell(['ls']);
await fixture.shell(['pwd']);

if (language === 'python') {
await fixture.shell(['pip', 'install', '-r', 'requirements.txt']);
}

const stackArn = await fixture.cdkDeploy(fixture.stackNamePrefix, { neverRequireApproval: true, verbose: true, captureStderr: false });
const response = await fixture.aws.cloudFormation('describeStacks', {
StackName: stackArn,
});

expect(response.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
await fixture.cdkDestroy(fixture.stackNamePrefix);
}));
});

integTest('cdk diff', withDefaultFixture(async (fixture) => {
const diff1 = await fixture.cdk(['diff', fixture.fullStackName('test-1')]);
expect(diff1).toContain('AWS::SNS::Topic');
Expand Down

0 comments on commit c626a1c

Please sign in to comment.