Skip to content
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

chore(toolkit): requireApproval option for deploy #32977

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

kaizencc
Copy link
Contributor

adds toolkit tests for deploy


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the p2 label Jan 16, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team January 16, 2025 23:52
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 16, 2025
@@ -148,9 +150,9 @@ export interface BaseDeployOptions {
* A 'hotswap' deployment will attempt to short-circuit CloudFormation
* and update the affected resources like Lambda functions directly.
*
* @default - `HotswapMode.FALL_BACK` for regular deployments, `HotswapMode.HOTSWAP_ONLY` for 'watch' deployments
* @default - no hotswap
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is the correct thing to say here

Comment on lines 428 to 434
stack: {
stackName: stack.stackName,
hierarchicalId: stack.hierarchicalId,
template: stack.template,
stringifiedJson: serializeStructure(obscuredTemplate, true),
stringifiedYaml: serializeStructure(obscuredTemplate, false),
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not quite sure exactly what information we want to send via this channel but i mostly copied what was done on synth

beforeEach(() => {
requestResponseSpy.mockClear();
notifySpy.mockClear();
mockCloudFormationClient.reset();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all this mockCloudFormation stuff is copied over. there's a whole bunch more to mock as we add more unit tests...

}));
});

test('deploy from app', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again this one doesn't work yet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't need to test all the different assembly types on all commands. Once it has synth'd it should be.

@mrgrain mrgrain force-pushed the mrgrain/toolkit/synth-tests branch 5 times, most recently from eaf5f8c to 3e1c437 Compare January 17, 2025 13:13
Base automatically changed from mrgrain/toolkit/synth-tests to main January 17, 2025 13:42
Comment on lines 86 to 93
const cx = await cdk.fromAssemblyBuilder(async () => {
const app = new core.App();
const stack = new core.Stack(app, 'Stack1');
new iam.Role(stack, 'Role', {
assumedBy: new iam.ArnPrincipal('arn'),
});
return app.synth() as any;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Let's move it into fixtures so other tests can re-use it.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 82466be
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 17, 2025
@kaizencc kaizencc changed the title test(toolkit): tests for deploy chore(toolkit): requireApproval option for deploy Jan 17, 2025
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.44%. Comparing base (d16482f) to head (09ea55a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #32977   +/-   ##
=======================================
  Coverage   81.44%   81.44%           
=======================================
  Files         225      225           
  Lines       13702    13702           
  Branches     2404     2404           
=======================================
  Hits        11160    11160           
  Misses       2267     2267           
  Partials      275      275           
Flag Coverage Δ
suite.unit 81.44% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 80.81% <ø> (ø)
packages/aws-cdk-lib/core 82.10% <ø> (ø)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants