-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: multi-env container hosting (#7009) #7346
Changes from all commits
0ebbb2d
ef0e983
c4e0cbf
4dffe1a
4b1b106
a61d2bf
c518432
5d00599
3afe8d3
361b57c
a4e2faf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,44 @@ export function addDEVHosting(cwd: string): Promise<void> { | |
}); | ||
} | ||
|
||
export function enableContainerHosting(cwd: string): Promise<void> { | ||
return new Promise((resolve, reject) => { | ||
spawn(getCLIPath(), ['configure', 'project'], { cwd, stripColors: true }) | ||
.wait('Which setting do you want to configure?') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we discussed offline, could you make it to use single select and not arrow movement? |
||
.sendKeyDown(2) | ||
.sendCarriageReturn() | ||
.wait('Do you want to enable container-based deployments?') | ||
.sendConfirmYes() | ||
.run((err: Error) => { | ||
if (!err) { | ||
resolve(); | ||
} else { | ||
reject(err); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
export function addDevContainerHosting(cwd: string): Promise<void> { | ||
return new Promise((resolve, reject) => { | ||
spawn(getCLIPath(), ['add', 'hosting'], { cwd, stripColors: true }) | ||
.wait('Select the plugin module to execute') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
.sendKeyDown(2) | ||
.sendCarriageReturn() | ||
.wait('Provide your web app endpoint (e.g. app.example.com or www.example.com):') | ||
.sendLine('www.test-amplify-app.com') | ||
.wait('Do you want to automatically protect your web app using Amazon Cognito Hosted UI') | ||
.sendConfirmNo() | ||
.run((err: Error) => { | ||
if (!err) { | ||
resolve(); | ||
} else { | ||
reject(err); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
export function addPRODHosting(cwd: string): Promise<void> { | ||
return new Promise((resolve, reject) => { | ||
spawn(getCLIPath(), ['add', 'hosting'], { cwd, stripColors: true }) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { | ||
addDevContainerHosting, | ||
createNewProjectDir, | ||
deleteProject, | ||
deleteProjectDir, | ||
enableContainerHosting, | ||
getBackendAmplifyMeta, | ||
initJSProjectWithProfile, | ||
removeHosting | ||
} from 'amplify-e2e-core'; | ||
|
||
import * as fs from 'fs-extra'; | ||
import * as path from 'path'; | ||
|
||
|
||
describe('amplify add hosting - container', () => { | ||
let projRoot: string; | ||
|
||
beforeAll(async () => { | ||
projRoot = await createNewProjectDir('container-hosting'); | ||
await initJSProjectWithProfile(projRoot, {}); | ||
await enableContainerHosting(projRoot); | ||
await addDevContainerHosting(projRoot); | ||
}); | ||
|
||
afterAll(async () => { | ||
await removeHosting(projRoot); | ||
await deleteProject(projRoot); | ||
deleteProjectDir(projRoot); | ||
}); | ||
|
||
it('add container hosting works', async () => { | ||
expect(fs.existsSync(path.join(projRoot, 'amplify', 'backend', 'hosting', 'ElasticContainer'))).toBe(true); | ||
const projectMeta = getBackendAmplifyMeta(projRoot); | ||
expect(projectMeta.hosting).toBeDefined(); | ||
expect(projectMeta.hosting.ElasticContainer).toBeDefined(); | ||
Comment on lines
+35
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there anything else we can check to ensure things are working correctly? |
||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
categoryName