Skip to content

Conversation

@mprencipe
Copy link
Contributor

Validate InitFile content to catch error during synth instead of deploy. Fixes issue #13009


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

Validate InitFile content to catch error during synth instead of deploy.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@gitpod-io
Copy link

gitpod-io bot commented Feb 17, 2021

@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Feb 17, 2021

test('empty content string throws error', () => {
expect(() => {
ec2.InitFile.symlink('/tmp/foo', '');
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have you changed fromString and are you testing symlink ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typo, fixed.

*/
public static fromString(fileName: string, content: string, options: InitFileOptions = {}): InitFile {
if (!content) {
throw new Error('Content was empty');
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be more descriptive, at least referencing the file that was trying to be created. Also, we like our error messages to suggest a clear path forward.

How about:

InitFile ${fileName}: cannot create empty file. Please supply at least one character of content.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion, fixed.

@mergify mergify bot dismissed rix0rrr’s stale review February 25, 2021 18:54

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Feb 26, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 77a7a37
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Feb 26, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 81a78a3 into aws:master Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants