GeezerVison is showing github.com — chore(ci): migrate E2E tests to CDK CLI and off Docker (#1501) · duc00/powertools-lambda-python@e201bd2
File treeExpand file treeCollapse file tree Open diff view settings aws_lambda_powertools/tracing
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/run-e2e-tests.yml +10-2Lines changed: 10 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 28 | 28 | strategy: | 29 | 29 | matrix: | 30 | 30 | # Maintenance: disabled until we discover concurrency lock issue with multiple versions and tmp | 31 | | - # version: ["3.7", "3.8", "3.9"] | 32 | | - version: ["3.7"] | | 31 | + version: ["3.7", "3.8", "3.9"] | | 32 | + # version: ["3.7"] | 33 | 33 | steps: | 34 | 34 | - name: "Checkout" | 35 | 35 | uses: actions/checkout@v3 | | 41 | 41 | python-version: ${{ matrix.version }} | 42 | 42 | architecture: "x64" | 43 | 43 | cache: "poetry" | | 44 | + - name: Setup Node.js | | 45 | + uses: actions/setup-node@v3 | | 46 | + with: | | 47 | + node-version: "16.12" | | 48 | + - name: Install CDK CLI | | 49 | + run: | | | 50 | + npm install | | 51 | + cdk --version | 44 | 52 | - name: Install dependencies | 45 | 53 | run: make dev | 46 | 54 | - name: Configure AWS credentials | |
Collapse file Copy file name to clipboardExpand all lines: .gitignore +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -310,3 +310,7 @@ site/ | 310 | 310 |
| 311 | 311 | !.github/workflows/lib | 312 | 312 | examples/**/sam/.aws-sam | | 313 | + | | 314 | +cdk.out | | 315 | +# NOTE: different accounts will be used for E2E thus creating unnecessary git clutter | | 316 | +cdk.context.json |
Collapse file Copy file name to clipboardExpand all lines: MAINTAINERS.md +326-67Lines changed: 326 additions & 67 deletions - Display the source diff
- Display the rich diff
Large diffs are not rendered by default. Collapse file Copy file name to clipboardExpand all lines: aws_lambda_powertools/tracing/tracer.py +13-12Lines changed: 13 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -300,16 +300,6 @@ def handler(event, context): | 300 | 300 | @functools.wraps(lambda_handler) | 301 | 301 | def decorate(event, context, **kwargs): | 302 | 302 | with self.provider.in_subsegment(name=f"## {lambda_handler_name}") as subsegment: | 303 | | - global is_cold_start | 304 | | - logger.debug("Annotating cold start") | 305 | | - subsegment.put_annotation(key="ColdStart", value=is_cold_start) | 306 | | - | 307 | | - if is_cold_start: | 308 | | - is_cold_start = False | 309 | | - | 310 | | - if self.service: | 311 | | - subsegment.put_annotation(key="Service", value=self.service) | 312 | | - | 313 | 303 | try: | 314 | 304 | logger.debug("Calling lambda handler") | 315 | 305 | response = lambda_handler(event, context, **kwargs) | @@ -325,7 +315,18 @@ def decorate(event, context, **kwargs): | 325 | 315 | self._add_full_exception_as_metadata( | 326 | 316 | method_name=lambda_handler_name, error=err, subsegment=subsegment, capture_error=capture_error | 327 | 317 | ) | | 318 | + | 328 | 319 | raise | | 320 | + finally: | | 321 | + global is_cold_start | | 322 | + logger.debug("Annotating cold start") | | 323 | + subsegment.put_annotation(key="ColdStart", value=is_cold_start) | | 324 | + | | 325 | + if is_cold_start: | | 326 | + is_cold_start = False | | 327 | + | | 328 | + if self.service: | | 329 | + subsegment.put_annotation(key="Service", value=self.service) | 329 | 330 |
| 330 | 331 | return response | 331 | 332 |
| @@ -672,7 +673,7 @@ def _add_response_as_metadata( | 672 | 673 | if data is None or not capture_response or subsegment is None: | 673 | 674 | return | 674 | 675 |
| 675 | | - subsegment.put_metadata(key=f"{method_name} response", value=data, namespace=self._config["service"]) | | 676 | + subsegment.put_metadata(key=f"{method_name} response", value=data, namespace=self.service) | 676 | 677 |
| 677 | 678 | def _add_full_exception_as_metadata( | 678 | 679 | self, | @@ -697,7 +698,7 @@ def _add_full_exception_as_metadata( | 697 | 698 | if not capture_error: | 698 | 699 | return | 699 | 700 |
| 700 | | - subsegment.put_metadata(key=f"{method_name} error", value=error, namespace=self._config["service"]) | | 701 | + subsegment.put_metadata(key=f"{method_name} error", value=error, namespace=self.service) | 701 | 702 |
| 702 | 703 | @staticmethod | 703 | 704 | def _disable_tracer_provider(): | |
Collapse file Copy file name to clipboardExpand all lines: package-lock.json +58Lines changed: 58 additions & 0 deletions Collapse file Copy file name to clipboard +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "name": "aws-lambda-powertools-python-e2e", | | 3 | + "version": "1.0.0", | | 4 | + "devDependencies": { | | 5 | + "aws-cdk": "2.40.0" | | 6 | + } | | 7 | +} |
Collapse file Copy file name to clipboardExpand all lines: parallel_run_e2e.py -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,6 @@ def main(): | 8 | 8 | workers = len(list(features)) - 1 | 9 | 9 |
| 10 | 10 | command = f"poetry run pytest -n {workers} --dist loadfile -o log_cli=true tests/e2e" | 11 | | - print(f"Running E2E tests with: {command}") | 12 | 11 | subprocess.run(command.split(), shell=False) | 13 | 12 |
| 14 | 13 |
| |
Collapse file Copy file name to clipboardExpand all lines: poetry.lock +35-67Lines changed: 35 additions & 67 deletions Collapse file Copy file name to clipboardExpand all lines: pyproject.toml +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,7 +50,7 @@ xenon = "^0.9.0" | 50 | 50 | flake8-eradicate = "^1.2.1" | 51 | 51 | flake8-bugbear = "^22.9.23" | 52 | 52 | mkdocs-git-revision-date-plugin = "^0.3.2" | 53 | | -mike = "^0.6.0" | | 53 | +mike = "^1.1.2" | 54 | 54 | mypy = "^0.971" | 55 | 55 | retry = "^0.9.2" | 56 | 56 | pytest-xdist = "^2.5.0" | @@ -73,6 +73,7 @@ types-requests = "^2.28.11" | 73 | 73 | typing-extensions = "^4.4.0" | 74 | 74 | mkdocs-material = "^8.5.4" | 75 | 75 | filelock = "^3.8.0" | | 76 | +checksumdir = "^1.2.0" | 76 | 77 |
| 77 | 78 | [tool.poetry.extras] | 78 | 79 | pydantic = ["pydantic", "email-validator"] | |
|