Skip to content

Commit 8ed3cc2

Browse files
authored
Shows region being used when starting sandbox (#2486)
* adds region on sandbox start * change set
1 parent 32bcc0b commit 8ed3cc2

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.changeset/thirty-weeks-whisper.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/sandbox': patch
3+
---
4+
5+
shows region on sandbox start

packages/sandbox/src/file_watching_sandbox.test.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,20 +353,39 @@ void describe('Sandbox using local project name resolver', () => {
353353
undefined,
354354
false
355355
));
356-
assert.strictEqual(printer.log.mock.callCount(), 7);
356+
assert.strictEqual(printer.log.mock.callCount(), 8);
357357

358358
assert.strictEqual(
359359
printer.log.mock.calls[1].arguments[0],
360360
format.indent(`${format.bold('Identifier:')} \ttestSandboxName`)
361361
);
362362
assert.strictEqual(
363-
printer.log.mock.calls[3].arguments[0],
363+
printer.log.mock.calls[4].arguments[0],
364364
`${format.indent(
365365
format.dim('\nTo specify a different sandbox identifier, use ')
366366
)}${format.bold('--identifier')}`
367367
);
368368
});
369369

370+
void it('correctly displays the region at the startup', async () => {
371+
({ sandboxInstance } = await setupAndStartSandbox(
372+
{
373+
executor: sandboxExecutor,
374+
ssmClient: ssmClientMock,
375+
functionsLogStreamer:
376+
functionsLogStreamerMock as unknown as LambdaFunctionLogStreamer,
377+
},
378+
undefined,
379+
false
380+
));
381+
assert.strictEqual(printer.log.mock.callCount(), 8);
382+
383+
assert.strictEqual(
384+
printer.log.mock.calls[3].arguments[0],
385+
format.indent(`${format.bold('Region:')} \ttest-region`)
386+
);
387+
});
388+
370389
void it('makes initial deployment without type checking at start if no typescript file is present', async () => {
371390
({ sandboxInstance, fileChangeEventCallback } = await setupAndStartSandbox(
372391
{

packages/sandbox/src/file_watching_sandbox.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,13 +442,15 @@ export class FileWatchingSandbox extends EventEmitter implements Sandbox {
442442
);
443443
const stackName =
444444
BackendIdentifierConversions.toStackName(sandboxBackendId);
445+
const region = await this.ssmClient.config.region();
445446
this.printer.log(
446447
format.indent(format.highlight(format.bold('\nAmplify Sandbox\n')))
447448
);
448449
this.printer.log(
449450
format.indent(`${format.bold('Identifier:')} \t${sandboxBackendId.name}`)
450451
);
451452
this.printer.log(format.indent(`${format.bold('Stack:')} \t${stackName}`));
453+
this.printer.log(format.indent(`${format.bold('Region:')} \t${region}`));
452454
if (!sandboxIdentifier) {
453455
this.printer.log(
454456
`${format.indent(

0 commit comments

Comments
 (0)