-
Notifications
You must be signed in to change notification settings - Fork 421
chore(tests): build and deploy Lambda Layer stack once #1466
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(tests): build and deploy Lambda Layer stack once #1466
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1466 +/- ##
========================================
Coverage 99.89% 99.89%
========================================
Files 123 123
Lines 5497 5499 +2
Branches 629 629
========================================
+ Hits 5491 5493 +2
Misses 2 2
Partials 4 4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I've increased test distribution parallelization algorithm from module (loadscope) to per test file (loadist).
Numbers are slightly higher now as I've included all extra dependencies to futureproof when we test Parser. |
Coordinating across shared queue memory required some changes in how we define infrastructure and their dependencies to run.
BEFORE from pathlib import Path
import pytest
from tests.e2e.logger.infrastructure import LoggerStack
@pytest.fixture(autouse=True, scope="module")
def infrastructure(request: pytest.FixtureRequest, tmp_path_factory: pytest.TempPathFactory, worker_id: str):
yield from deploy_once(stack=LoggerStack, request=request, tmp_path_factory=tmp_path_factory, worker_id=worker_id) AFTER from pathlib import Path
import pytest
from tests.e2e.logger.infrastructure import LoggerStack
@pytest.fixture(autouse=True, scope="module")
def infrastructure(request: pytest.FixtureRequest, lambda_layer_arn: str):
stack = LoggerStack(handlers_dir=Path(f"{request.path.parent}/handlers"), layer_arn=lambda_layer_arn)
try:
yield stack.deploy()
finally:
stack.delete() |
Stacks changed signature to accept a new optional argument ( BEFORE from pathlib import Path
from tests.e2e.utils.infrastructure import BaseInfrastructureV2
class LoggerStack(BaseInfrastructureV2):
def __init__(self, handlers_dir: Path, feature_name: str = "logger") -> None:
super().__init__(feature_name, handlers_dir)
def create_resources(self):
self.create_lambda_functions() AFTER from pathlib import Path
from tests.e2e.utils.infrastructure import BaseInfrastructureV2
class LoggerStack(BaseInfrastructureV2):
FEATURE_NAME = "logger"
def __init__(self, handlers_dir: Path, feature_name: str = FEATURE_NAME, layer_arn: str = "") -> None:
super().__init__(feature_name, handlers_dir, layer_arn)
def create_resources(self):
self.create_lambda_functions() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work Heitor, no comments from me. I was expecting a lot of logic to handle the "map-reduce", but it seems the pytest plugin already handles this for you. So no comments here :)
I'm gonna remove the old BaseInfrastructure and rename V2 so we solidify this thing now that all stacks are migrated. |
thanks for the approval @rubenfonseca !! Merging now, and will send one last PR to enable E2E at CI level and document it in the contributing guide. |
Issue number: #1464
Summary
This PR introduces
LambdaLayerStack
that is deployed per test session. It coordinates all parallel workers across CPU to wait for completion before they begin deploying their respective stacks and test run.This diagram may better explain. More details on a few differences at the comment section.
Changes
User experience
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
RFC issue number:
Checklist:
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.