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(ci): add end to end testing mechanism #1247

Merged
merged 81 commits into from
Jul 14, 2022

Conversation

mploski
Copy link
Contributor

@mploski mploski commented Jun 13, 2022

Issue number: #1226

Summary

This PR implements proposal shared in RFC

IT add mechanism to run an end to end tests on Lambda Powertools library using real AWS Services (Lambda, DynamoDB) in real AWS Account.
Initially, tests can be run manually by maintainers on specific branch to ensure expected feature works.
Tests should be triggered in GitHub but also maintainers/contributors should be able to run them in their local environment using their own AWS Account.

In order to run them manually:

  1. Export your AWS_PROFILE to point tests to your AWS Account2.
  2. Run make e2e-test from project root directory

Changes

  1. Modify Makefile to add new e2e-test command automating test execution. pytest uses x-dist plugin to parallelize execution over test groups.
  2. Add new test groups (logger/metrics/tracer) under tests/e2e directory. They contains pytest tests that calls lambda endpoint and fetch information about execution from CloudWatch Metrics/CloudWatch Logs/X-Ray API. We store Lambda handler code under handler/ sub directory. We use this handlers to spawn new lambdas during infrastructure deployment
  3. Under tests/e2e/utils directory we store:
  • infrastructure.py - contains class responsible for spawning infrastructure in test account
  • helpers.py - stores helpers methods here that simplify fetching data from CloudWatch Metrics/CloudWatch Logs/X-Ray API
  • Dockerfile - used by CDK code to create custom lambda powertools layer
  1. Add session fixture in conftest.py file responsible for creating infrastructure for every test group and removing it at the end of test group execution. Fixture uses infrastructure class methods for creating/removing infrastructure
  2. Modify GitHub workflow mechanism by adding run-e2e-tests.yaml. User triggers new workflow manually from github. Workflow authorize to our test AWS account using OIDC and then run end to end tests against it

User experience

Users are not affected by this change. It enables new testing capabilities for maintainers and contributors to ensure highest possible code quality

Maintainer experience

Maintainer can run this job either from GitHub Actions Page

Screenshot 2022-06-14 at 08 36 50

Or from local shell
image

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change? No **RFC issue number**: https://github.com//issues/1226

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

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

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@boring-cyborg boring-cyborg bot added dependencies Pull requests that update a dependency file github-actions Pull requests that update Github_actions code internal Maintenance changes tests labels Jun 13, 2022
@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 13, 2022
@mploski mploski changed the title Add mechanism for end to end testing chore: add mechanism for end to end testing Jun 13, 2022
@mploski mploski marked this pull request as draft June 13, 2022 21:43
@mploski mploski force-pushed the feature/e2e-tests branch 2 times, most recently from 097463f to bd8211f Compare June 14, 2022 06:40
@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 14, 2022
@mploski mploski force-pushed the feature/e2e-tests branch from bd8211f to 5dd3edf Compare June 14, 2022 06:43
@pull-request-size pull-request-size bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 14, 2022
@mploski mploski force-pushed the feature/e2e-tests branch from 5dd3edf to 62ddaf7 Compare June 14, 2022 18:31
@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 14, 2022
@mploski mploski requested a review from heitorlessa June 14, 2022 19:47
heitorlessa and others added 13 commits July 12, 2022 15:26
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1284)

Bumps [cdk-lambda-powertools-python-layer](https://github.com/aws-samples/cdk-lambda-powertools-python-layer) from 2.0.48 to 2.0.49.
- [Release notes](https://github.com/aws-samples/cdk-lambda-powertools-python-layer/releases)
- [Commits](aws-samples/cdk-lambda-powertools-python-layer@v2.0.48...v2.0.49)

---
updated-dependencies:
- dependency-name: cdk-lambda-powertools-python-layer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@mploski mploski requested a review from heitorlessa July 12, 2022 16:28
@mploski mploski force-pushed the feature/e2e-tests branch from 91500de to 1d832b0 Compare July 12, 2022 16:30
Michal Ploski and others added 3 commits July 12, 2022 18:34
…s-powertools#1293)

Bumps [mypy-boto3-dynamodb](https://github.com/youtype/mypy_boto3_builder) from 1.24.12 to 1.24.27.
- [Release notes](https://github.com/youtype/mypy_boto3_builder/releases)
- [Commits](https://github.com/youtype/mypy_boto3_builder/commits)

---
updated-dependencies:
- dependency-name: mypy-boto3-dynamodb
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@heitorlessa heitorlessa force-pushed the develop branch 2 times, most recently from 742ccf5 to b582992 Compare July 13, 2022 11:59
@heitorlessa heitorlessa changed the title chore: add mechanism for end to end testing chore(ci): add end to end testing mechanism Jul 14, 2022
@heitorlessa heitorlessa merged commit b852946 into aws-powertools:develop Jul 14, 2022
heitorlessa added a commit that referenced this pull request Jul 14, 2022
…tools-python into develop

* 'develop' of https://github.com/awslabs/aws-lambda-powertools-python:
  chore(ci): add end to end testing mechanism (#1247)
  chore(deps-dev): bump mypy-boto3-appconfig from 1.24.0 to 1.24.29 (#1295)
heitorlessa added a commit to heitorlessa/aws-lambda-powertools-python that referenced this pull request Jul 14, 2022
* develop:
  chore(deps): bump jsii from 1.61.0 to 1.62.0 (aws-powertools#1294)
  chore(ci): experiment with conditional on outputs
  chore(ci): improve error handling for non-issue numbers
  fix(ci): address conditional type on_merge
  chore(ci): add end to end testing mechanism (aws-powertools#1247)
  chore(deps-dev): bump mypy-boto3-appconfig from 1.24.0 to 1.24.29 (aws-powertools#1295)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file github-actions Pull requests that update Github_actions code internal Maintenance changes size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants