-
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.
refactor(cli): remove unused v1 bootstrapping detection (#32606)
### Reason for this change Removing dead code in `determineV1BootstrapSource` which could not be called anymore since version always returns v2 these days. ### Description of changes Remove the dead code and conditional. Also slightly changes the contract of `CliToolkit.bootstrap()` to take a `BootstrapSource` as part of options, instead of a the `Bootstrapper`. ### Describe any new or updated permissions being added n/a ### Description of how you validated changes existing tests and integ tests ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
189bae3
commit 8b48fe8
Showing
6 changed files
with
77 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Bootstrapper } from '../lib/api/bootstrap/bootstrap-environment'; | ||
import { exec } from '../lib/cli'; | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
describe('cdk bootstrap', () => { | ||
const bootstrapEnvironmentMock = jest.spyOn(Bootstrapper.prototype, 'bootstrapEnvironment'); | ||
|
||
test('will bootstrap the a provided environment', async () => { | ||
bootstrapEnvironmentMock.mockResolvedValueOnce({ | ||
noOp: false, | ||
outputs: {}, | ||
type: 'did-deploy-stack', | ||
stackArn: 'fake-arn', | ||
}); | ||
|
||
await exec(['bootstrap', 'aws://123456789012/us-east-1']); | ||
expect(bootstrapEnvironmentMock).toHaveBeenCalledTimes(1); | ||
expect(bootstrapEnvironmentMock).toHaveBeenCalledWith({ | ||
name: 'aws://123456789012/us-east-1', | ||
account: '123456789012', | ||
region: 'us-east-1', | ||
}, expect.anything(), expect.anything()); | ||
}); | ||
}); | ||
|
||
describe('cdk bootstrap --show-template', () => { | ||
const stdoutSpy = jest.spyOn(process.stdout, 'write').mockImplementation(() => { return true; }); | ||
|
||
test('prints the default bootstrap template', async () => { | ||
await exec(['bootstrap', '--show-template']); | ||
expect(stdoutSpy).toHaveBeenCalledWith(expect.stringContaining('BootstrapVersion')); | ||
}); | ||
}); |
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