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

feat(integ-runner): support --language presets for JavaScript, TypeScript, Python and Go #22058

Merged
merged 5 commits into from
Jan 5, 2023

Conversation

mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Sep 15, 2022

It was already possible to run tests in any language by providing --app and --test-regex directly.
This change introduces the concept of language presets that can be selected.
By default all supported languages will be detected.

Users can run integration tests for multiple languages at the same time, using the default preset configuration.
To further customize anything, only a single language can be selected. However it's always possible to call the integ-runner multiple times:

integ-runner --language typescript
integ-runner --language python --app="python3.2"
integ-runner --language go --test-regex=".*\.integ\.go"

Resolves part of #21169


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

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 Sep 15, 2022

@github-actions github-actions bot added the p2 label Sep 15, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team September 15, 2022 15:49
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 15, 2022
@mrgrain mrgrain added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Sep 15, 2022
@mrgrain mrgrain marked this pull request as ready for review September 15, 2022 15:53
@mrgrain
Copy link
Contributor Author

mrgrain commented Sep 15, 2022

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Sep 15, 2022

update

✅ Branch has been successfully updated

@mrgrain mrgrain force-pushed the feat/integ-runner-ts branch 2 times, most recently from 2b3d688 to be513c7 Compare September 23, 2022 18:13
@mrgrain mrgrain marked this pull request as draft September 24, 2022 08:58
@mrgrain mrgrain changed the title feat(integ-runner): support typescript tests feat(integ-runner): support tests in different languages Oct 16, 2022
@mrgrain mrgrain force-pushed the feat/integ-runner-ts branch from be513c7 to 6afa4c7 Compare October 17, 2022 13:24
@mrgrain mrgrain force-pushed the feat/integ-runner-ts branch 2 times, most recently from b48d2fa to e18a78b Compare November 11, 2022 10:46
@mrgrain mrgrain changed the title feat(integ-runner): support tests in different languages feat(integ-runner): support --language presets in integ-runner Nov 11, 2022
@mrgrain mrgrain changed the title feat(integ-runner): support --language presets in integ-runner feat(integ-runner): support --language presets Nov 11, 2022
@mrgrain mrgrain force-pushed the feat/integ-runner-ts branch 2 times, most recently from e90f498 to 47e1534 Compare November 11, 2022 10:53
@mrgrain mrgrain self-assigned this Dec 9, 2022
@mrgrain mrgrain force-pushed the feat/integ-runner-ts branch from 47e1534 to 0601279 Compare December 13, 2022 09:37
@mrgrain mrgrain removed the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Dec 15, 2022
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

@aws-cdk-automation aws-cdk-automation dismissed their stale review December 15, 2022 14:10

✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.

@mrgrain mrgrain removed their assignment Jan 4, 2023
@mrgrain mrgrain force-pushed the feat/integ-runner-ts branch from 18364d3 to 0b6d427 Compare January 4, 2023 13:16
@mrgrain
Copy link
Contributor Author

mrgrain commented Jan 4, 2023

Replaces #22927

@mrgrain mrgrain force-pushed the feat/integ-runner-ts branch 2 times, most recently from 6af5c14 to 3a6057c Compare January 4, 2023 14:57
@mrgrain mrgrain marked this pull request as ready for review January 4, 2023 15:59
@mrgrain
Copy link
Contributor Author

mrgrain commented Jan 5, 2023

Unsupported languages du to lack of testing

{     
      // works but it's a bit ugly to need to have a project per test case - is there a better solution?
      csharp: ['dotnet run --project {filePath}', ['^Integ.*\\.csproj$']],
      fsharp: ['dotnet run --project {filePath}', ['^Integ.*\\.fsproj$']],
      // untested, but should be working
      go: ['go mod download && go run {filePath}', ['^integ_.*\\.go$']],
      // this doesn't work. See previous PR attempts for ideas
      java: ['mvn -e -q compile exec:java', ['^Integ.*\\.java$']],
}

@mrgrain mrgrain force-pushed the feat/integ-runner-ts branch 2 times, most recently from 0a745b2 to f40bd8f Compare January 5, 2023 09:50
@aws aws deleted a comment from aws-cdk-automation Jan 5, 2023
@mrgrain mrgrain force-pushed the feat/integ-runner-ts branch from d3cb979 to f40bd8f Compare January 5, 2023 10:54
@aws aws deleted a comment from aws-cdk-automation Jan 5, 2023
@aws aws deleted a comment from aws-cdk-automation Jan 5, 2023
Copy link
Contributor

@corymhall corymhall left a comment

Choose a reason for hiding this comment

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

Awesome!!

Comment on lines +100 to +108
test('cannot use --test-regex by itself with more than one language preset', async () => {
await expect(() => main([
'--list',
'--directory=test/test-data',
'--language=javascript',
'--language=typescript',
'--test-regex="^xxxxx\.integ-test[12]\.js$"',
])).rejects.toThrowError('Only a single "--language" can be used with "--test-regex". Alternatively provide both "--app" and "--test-regex" to fully customize the configuration.');
});
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm reading everything correctly you can run it for multiple languages if you
just use the defaults, but if you want to customize anything you can only run it
for a single language? Is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that's right. It's because we only have a single pair of --app and --test-regex. A possible future extension would be to allow configuring the presets or support passing in a map of app -> test-regex.

In the meantime, if both is needed, users can always run integ-runner multiple times, e.g.:

integ-runner --language typescript
integ-runner --language python --app="python3.2"
integ-runner --language go --test-regex=".*\.integ\.go"

@@ -0,0 +1,17 @@
import aws_cdk as cdk
Copy link
Contributor

Choose a reason for hiding this comment

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

Very cool!

@mrgrain mrgrain force-pushed the feat/integ-runner-ts branch from 6a39e0a to 5ea37fc Compare January 5, 2023 18:06
@mrgrain mrgrain changed the title feat(integ-runner): support --language presets feat(integ-runner): support --language presets for JavaScript, TypeScript, Python and Go Jan 5, 2023
@mrgrain mrgrain added pr/do-not-merge This PR should not be merged at this time. and removed pr/do-not-merge This PR should not be merged at this time. labels Jan 5, 2023
@mergify
Copy link
Contributor

mergify bot commented Jan 5, 2023

Thank you for contributing! Your pull request will be updated from main 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: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: abcc28c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit 22673b2 into aws:main Jan 5, 2023
@mergify
Copy link
Contributor

mergify bot commented Jan 5, 2023

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

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants