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: run e2e tests on demand #441

Merged
merged 45 commits into from
Jan 14, 2022
Merged

chore: run e2e tests on demand #441

merged 45 commits into from
Jan 14, 2022

Conversation

flochaz
Copy link
Contributor

@flochaz flochaz commented Jan 7, 2022

Description of your changes

Running e2e tests on demand.

Next we will need to make sure that some following PRs handle decision made in discussion #315 .

Potential improvment

Run only when module changes with --onlyChanged --changedSince=main option on jest

How to verify this change

Check for https://github.com/awslabs/aws-lambda-powertools-typescript/actions/workflows/run-e2e-tests.yml tests run

Related issues, RFCs

#418

PR status

Is this ready for review?: YES
Is it a breaking change?: NO

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • The code coverage hasn't decreased
  • I have added tests that prove my change is effective and works
  • New and existing unit tests pass locally and in Github Actions
  • Any dependent changes have been merged and published in downstream module
  • The PR title follows the conventional commit semantics

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions github-actions bot added the internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) label Jan 7, 2022
Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Thanks, this is huge!

Just left some minor suggestions to reword part of the contributing section + added a disclaimer about potential costs of running the tests.

Only other note is that the unit tests in logger are not yet tagged so even when running test:e2e the regular unit ones are running. Done in e3a83ce

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
@dreamorosi dreamorosi added all automation This item relates to automation labels Jan 7, 2022
@dreamorosi dreamorosi added this to the production-ready-release milestone Jan 7, 2022
@flochaz
Copy link
Contributor Author

flochaz commented Jan 7, 2022

Thanks, this is huge!

Just left some minor suggestions to reword part of the contributing section + added a disclaimer about potential costs of running the tests.

Only other note is that the unit tests in logger are not yet tagged so even when running test:e2e the regular unit ones are running. Done in e3a83ce

thx for the commit !

flochaz and others added 6 commits January 7, 2022 18:15
Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
flochaz and others added 6 commits January 12, 2022 16:31
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Copy link
Contributor

@saragerion saragerion left a comment

Choose a reason for hiding this comment

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

Thanks for the great work @flochaz! Looking forward to merge this one, but I left a few comments in this PR that I think should be discussed before merging it.

Also I think I need a better understanding of what will be included in the upcoming PR's related to the same ticket, always in the spirit of maintaining the PRs size small.

CONTRIBUTING.md Show resolved Hide resolved
CONTRIBUTING.md Show resolved Hide resolved
CONTRIBUTING.md Outdated
* `AWS_PROFILE` to use the right credentials
* `DISABLE_TEARDOWN` if you don't want your stack to be destroyed at the end of the test (useful in dev mode when iterating over your code).

Example: `DISABLE_TEARDOWN=true AWS_PROFILE=ara npx jest --group=integ/other/example`
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: can we add a real example?

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
flochaz and others added 5 commits January 13, 2022 07:37
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
Co-authored-by: Sara Gerion <47529391+saragerion@users.noreply.github.com>
@flochaz flochaz force-pushed the chore/cicd/automateIntegTests branch from f90ba87 to 64304ce Compare January 13, 2022 08:10
@flochaz flochaz force-pushed the chore/cicd/automateIntegTests branch from 3151afc to 4f62c1a Compare January 13, 2022 17:23
dreamorosi
dreamorosi previously approved these changes Jan 14, 2022
CONTRIBUTING.md Show resolved Hide resolved
Copy link
Contributor

@saragerion saragerion left a comment

Choose a reason for hiding this comment

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

Almost there!

CONTRIBUTING.md Outdated
Comment on lines 130 to 147
1. Create an IAM role in your target AWS account, with the least amount of privilege.

As mentioned above in this page, we are leveraging CDK to deploy and consequently clean-up resources on AWS. Therefore to run those tests through Github actions you will need to grant specific permissions to your workflow.

We recommend following [Amazon IAM best practices](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) for the AWS credentials used in GitHub Actions workflows, including:
* Do not store credentials in your repository's code.
* [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege) to the credentials used in GitHub Actions workflows. Grant only the permissions required to perform the actions in your GitHub Actions workflows.
* [Monitor the activity](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#keep-a-log) of the credentials used in GitHub Actions workflows.

For an example of how to create a role in CDK, you can look at [@pahud/cdk-github-oidc](https://constructs.dev/packages/@pahud/cdk-github-oidc) construct.

More information about:

- [Github OpenID Connect](https://github.blog/changelog/2021-10-27-github-actions-secure-cloud-deployments-with-openid-connect/
- ["Configure AWS Credentials" Action For GitHub Actions](https://github.com/aws-actions/configure-aws-credentials/)
1. Add your new role into your [Github fork secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) with name `AWS_ROLE_ARN_TO_ASSUME`.
1. In your forked repository, go to the "Actions" tabs, select the `run-e2e-tests` workflow.
1. In the run-e2e-tests workflow page, select "Run workflow" and run it on the desired branch.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: steps numbers are all "1."

Copy link
Contributor

Choose a reason for hiding this comment

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

They rendered correctly by GitHub preview & according to spec it's not required for them to be in order:

To create an ordered list, add line items with numbers followed by periods. The numbers don’t have to be in numerical order, but the list should start with the number one.

But for those who are reading the source I agree that it was confusing, changed it in 973a9d5.

@@ -11,7 +11,8 @@
},
"scripts": {
"commit": "commit",
"test": "jest --detectOpenHandles --coverage --verbose",
"test": "npm run test:unit",
"test:unit": "jest --group=unit --detectOpenHandles --coverage --verbose",
Copy link
Contributor

Choose a reason for hiding this comment

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

Love it!

@dreamorosi
Copy link
Contributor

@flochaz pushed a commit because I noticed that the "⚠️ " symbol here was not rendering properly, also addressed one comment while there, hope you don't mind.

Copy link
Contributor

@saragerion saragerion left a comment

Choose a reason for hiding this comment

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

LGTM

@flochaz flochaz merged commit d6aae13 into main Jan 14, 2022
@flochaz flochaz deleted the chore/cicd/automateIntegTests branch January 14, 2022 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation This item relates to automation internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maintenance: automate integration test run
4 participants