Skip to content

chore: fix CLI integration tests#4198

Merged
mergify[bot] merged 6 commits intomasterfrom
huijbers/fix-integ-tests
Sep 24, 2019
Merged

chore: fix CLI integration tests#4198
mergify[bot] merged 6 commits intomasterfrom
huijbers/fix-integ-tests

Conversation

@rix0rrr
Copy link
Copy Markdown
Contributor

@rix0rrr rix0rrr commented Sep 23, 2019

Fixes:

Refactor:

Simplify testing scripts themselves to run commands as they normally would (just runs cdk, just calls npm install @aws-cdk/core), and remove the dependency on a complex set of sourced bash scripts with functions that need to be called at the right moment.

Instead, there are three new dispatcher scripts:

run-against-repo
run-against-dist
run-against-release

Which set up an appropriate environment before calling a command that is passed.

Each of them does something different, but through a combination of PATH manipulation, config file rewriting and other things makes it so that in the subsequent script the cdk command points to an appropriate instance of the CDK, npm install and pip install will install packages from an appropriate source, etc.

To be used like so:

./run-against-repo cli/test.sh
./run-against-dist cli/test.sh
./run-against-release init/test-all.sh
# etc

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

Fix breakage introduced by #3782, which changed the wrong string.

Update other expectation to match change introduced in #3772.
@rix0rrr rix0rrr self-assigned this Sep 23, 2019
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 23, 2019

Thanks so much for taking the time to contribute to the AWS CDK ❤️

We will shortly assign someone to review this pull request and help get it
merged. In the meantime, please take a minute to make sure you follow this
checklist
:

  • PR title type(scope): text
    • type: fix, feat, refactor go into CHANGELOG, chore is hidden
    • scope: name of module without aws- or cdk- prefix or postfix (e.g. s3 instead of aws-s3-deployment)
    • text: use all lower-case, do not end with a period, do not include issue refs
  • PR Description
    • Rationale: describe rationale of change and approach taken
    • Issues: indicate issues fixed via: fixes #xxx or closes #xxx
    • Breaking?: last paragraph: BREAKING CHANGE: <describe what changed + link for details>
  • Testing
    • Unit test added. Prefer to add a new test rather than modify existing tests
    • CLI or init templates change? Re-run/add CLI integration tests
  • Documentation
    • README: update module README to describe new features
    • API docs: public APIs must be documented. Copy from official AWS docs when possible
    • Design: for significant features, follow design process


assert "cdk_synth ${STACK_NAME_PREFIX}-missing-ssm-parameter -c test:ssm-parameter-name=${parameterName}" <<HERE
SSM parameter not available in account ${account}, region ${region}: ${parameterName}
[Error at /cdk-toolkit-integration-missing-ssm-parameter] SSM parameter not available in account 993655754359, region us-east-1: /does/not/exist
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you sure we don’t want to use substitution here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

does this work:

[Error at ${STACK_NAME_PREFIX}-missing-ssm-parameter] SSM parameter not available in account ${account}, region ${region}: ${parameterName}

or adding errorKey=[Error at /cdk-toolkit-integration-missing-ssm-parameter] and use it as ${errorKey} ahead of the rest of the existing error message?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Doh, you are correct.


assert "cdk_synth ${STACK_NAME_PREFIX}-missing-ssm-parameter -c test:ssm-parameter-name=${parameterName}" <<HERE
SSM parameter not available in account ${account}, region ${region}: ${parameterName}
[Error at /cdk-toolkit-integration-missing-ssm-parameter] SSM parameter not available in account 993655754359, region us-east-1: /does/not/exist
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

does this work:

[Error at ${STACK_NAME_PREFIX}-missing-ssm-parameter] SSM parameter not available in account ${account}, region ${region}: ${parameterName}

or adding errorKey=[Error at /cdk-toolkit-integration-missing-ssm-parameter] and use it as ${errorKey} ahead of the rest of the existing error message?

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@rix0rrr
Copy link
Copy Markdown
Contributor Author

rix0rrr commented Sep 24, 2019

I'm going to drastically simplify the scripts used here, and remove the references to verdaccio etc. Setting up the runtime environment so that we can choose what artifacts to work from should be the responsibility of the caller, not of the tests themselves.

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@rix0rrr rix0rrr force-pushed the huijbers/fix-integ-tests branch from 140de50 to 4269940 Compare September 24, 2019 14:18
@rix0rrr rix0rrr requested a review from skinny85 as a code owner September 24, 2019 14:18
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Copy link
Copy Markdown
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

👌👌❤️👌❤️

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 24, 2019

Thank you for contributing! Your pull request is now being automatically merged.

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants