forked from aws-amplify/amplify-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: defer root stack creation to first
amplify push
(aws-amplify#…
- Loading branch information
1 parent
5c918be
commit d28dd1c
Showing
18 changed files
with
348 additions
and
124 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
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
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
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
81 changes: 81 additions & 0 deletions
81
packages/amplify-e2e-tests/src/__tests__/defer-init-push.test.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,81 @@ | ||
import { | ||
addFunction, | ||
amplifyInitYes, | ||
amplifyPushAuth, | ||
createNewProjectDir, | ||
deleteProject, | ||
deleteProjectDir, | ||
getLocalEnvInfo, | ||
getTeamProviderInfo, | ||
initJSProjectWithProfile, | ||
} from 'amplify-e2e-core'; | ||
import { addEnvironment, addEnvironmentYes, checkoutEnvironment, removeEnvironment } from '../environment/env'; | ||
|
||
describe('defer root stack push', () => { | ||
let projRoot: string; | ||
beforeEach(async () => { | ||
projRoot = await createNewProjectDir('defer-init-push'); | ||
}); | ||
|
||
afterEach(async () => { | ||
await deleteProject(projRoot); | ||
deleteProjectDir(projRoot); | ||
}); | ||
|
||
it('does not create a root stack on interactive init', async () => { | ||
await initJSProjectWithProfile(projRoot, { name: 'deferInitPush', envName: 'dev' }); | ||
const tpi_before = getTeamProviderInfo(projRoot); | ||
expect(tpi_before?.dev?.awscloudformation?.DeploymentBucketName).toBeUndefined(); | ||
await addFunction(projRoot, { functionTemplate: 'Hello World' }, 'nodejs'); | ||
await amplifyPushAuth(projRoot); | ||
const tpi_after = getTeamProviderInfo(projRoot); | ||
expect(tpi_after?.dev?.awscloudformation?.DeploymentBucketName).toBeDefined(); | ||
}); | ||
|
||
it('does not create a root stack on interactive env add', async () => { | ||
await initJSProjectWithProfile(projRoot, { name: 'deferInitPush', envName: 'dev' }); | ||
const tpi_dev = getTeamProviderInfo(projRoot); | ||
expect(tpi_dev?.dev?.awscloudformation?.DeploymentBucketName).toBeUndefined(); | ||
await addEnvironment(projRoot, { envName: 'test' }); | ||
const tpi_test = getTeamProviderInfo(projRoot); | ||
expect(tpi_test?.test?.awscloudformation?.DeploymentBucketName).toBeUndefined(); | ||
}); | ||
|
||
it('creates a root stack on headless init', async () => { | ||
await amplifyInitYes(projRoot); | ||
const tpi_after = getTeamProviderInfo(projRoot); | ||
expect(tpi_after?.dev?.awscloudformation?.DeploymentBucketName).toBeDefined(); | ||
}); | ||
|
||
it('creates a root stack on headless env add', async () => { | ||
await initJSProjectWithProfile(projRoot, { name: 'deferInitPush', envName: 'dev' }); | ||
const tpi_dev = getTeamProviderInfo(projRoot); | ||
expect(tpi_dev?.dev?.awscloudformation?.DeploymentBucketName).toBeUndefined(); | ||
await addEnvironmentYes(projRoot, { envName: 'test' }); | ||
const tpi_test = getTeamProviderInfo(projRoot); | ||
expect(tpi_test?.test?.awscloudformation?.DeploymentBucketName).toBeDefined(); | ||
}); | ||
|
||
it('can checkout unpushed environment', async () => { | ||
await initJSProjectWithProfile(projRoot, { name: 'deferInitPush', envName: 'dev' }); | ||
const tpi_dev = getTeamProviderInfo(projRoot); | ||
expect(tpi_dev?.dev?.awscloudformation?.DeploymentBucketName).toBeUndefined(); | ||
await addEnvironment(projRoot, { envName: 'test' }); | ||
const tpi_test = getTeamProviderInfo(projRoot); | ||
expect(tpi_test?.test?.awscloudformation?.DeploymentBucketName).toBeUndefined(); | ||
await checkoutEnvironment(projRoot, { envName: 'dev' }); | ||
const localEnvInfo = getLocalEnvInfo(projRoot); | ||
expect(localEnvInfo?.envName).toEqual('dev'); | ||
}); | ||
|
||
it('can remove unpushed environment', async () => { | ||
await initJSProjectWithProfile(projRoot, { name: 'deferInitPush', envName: 'dev' }); | ||
await addEnvironment(projRoot, { envName: 'test' }); | ||
await checkoutEnvironment(projRoot, { envName: 'dev' }); | ||
const tpi_before = getTeamProviderInfo(projRoot); | ||
expect(Object.keys(tpi_before).sort()).toEqual(['dev', 'test']); | ||
await removeEnvironment(projRoot, { envName: 'test' }); | ||
const tpi_after = getTeamProviderInfo(projRoot); | ||
expect(Object.keys(tpi_after)).toEqual(['dev']); | ||
}); | ||
}); |
Oops, something went wrong.