-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add Amplify integration tests (#31921)
Test integration with the Amplify client, that uses CDK under the hood. Creates a new project, deploys it, and then deletes it again. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/@aws-cdk-testing/cli-integ/tests/tool-integrations/amplify.integtest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { promises as fs } from 'fs'; | ||
import * as path from 'path'; | ||
import { integTest, withTemporaryDirectory, ShellHelper, withPackages, TemporaryDirectoryContext } from '../../lib'; | ||
|
||
const TIMEOUT = 1800_000; | ||
|
||
integTest('amplify integration', withTemporaryDirectory(withPackages(async (context) => { | ||
const shell = ShellHelper.fromContext(context); | ||
|
||
await shell.shell(['npm', 'create', '-y', 'amplify@latest']); | ||
await shell.shell(['npx', 'ampx', 'configure', 'telemetry', 'disable']); | ||
|
||
// This will create 'package.json' implicating a certain version of the CDK | ||
await updateCdkDependency(context, context.packages.requestedCliVersion(), context.packages.requestedFrameworkVersion()); | ||
await shell.shell(['npm', 'install']); | ||
|
||
await shell.shell(['npx', 'ampx', 'sandbox', '--once']); | ||
await shell.shell(['npx', 'ampx', 'sandbox', 'delete', '--yes']); | ||
})), TIMEOUT); | ||
|
||
async function updateCdkDependency(context: TemporaryDirectoryContext, cliVersion: string, libVersion: string) { | ||
const filename = path.join(context.integTestDir, 'package.json'); | ||
const pj = JSON.parse(await fs.readFile(filename, { encoding: 'utf-8' })); | ||
pj.devDependencies['aws-cdk'] = cliVersion; | ||
pj.devDependencies['aws-cdk-lib'] = libVersion; | ||
await fs.writeFile(filename, JSON.stringify(pj, undefined, 2), { encoding: 'utf-8' }); | ||
} |