Skip to content

Commit 1c7b4fe

Browse files
committed
feat: use CDK direct mode on e2e and remove unecessary deps
1 parent db227e2 commit 1c7b4fe

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

tests/e2e/utils/infrastructure.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ def deploy(self) -> Dict[str, str]:
156156
stack_file = self._create_temp_cdk_app()
157157
synth_command = f"npx cdk synth --app 'python {stack_file}' -o {self._cdk_out_dir}"
158158
deploy_command = (
159-
f"npx cdk deploy --app '{self._cdk_out_dir}' -O {self._stack_outputs_file} --require-approval=never"
159+
f"npx cdk deploy --app '{self._cdk_out_dir}' -O {self._stack_outputs_file} "
160+
"--require-approval=never --method=direct"
160161
)
161162

162163
# CDK launches a background task, so we must wait

tests/e2e/utils/lambda_layer/powertools_layer.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ class LocalLambdaPowertoolsLayer(BaseLocalLambdaLayer):
1616

1717
def __init__(self, output_dir: Path = CDK_OUT_PATH):
1818
super().__init__(output_dir)
19-
self.package = f"{SOURCE_CODE_ROOT_PATH}[pydantic]"
19+
self.package = f"{SOURCE_CODE_ROOT_PATH}[all]"
2020
self.build_args = "--platform manylinux1_x86_64 --only-binary=:all: --upgrade"
2121
self.build_command = f"python -m pip install {self.package} {self.build_args} --target {self.target_dir}"
22+
self.cleanup_command = (
23+
f"rm -rf {self.target_dir}/boto* {self.target_dir}/s3transfer* && "
24+
f"rm -rf {self.target_dir}/*dateutil* {self.target_dir}/urllib3* {self.target_dir}/six* && "
25+
f"find {self.target_dir} -name '*.so' -type f -exec strip '{{}}' \; && " # noqa: W605
26+
f"find {self.target_dir} -wholename '*/tests/*' -type f -delete && " # noqa: W605
27+
f"find {self.target_dir} -regex '^.*\(__pycache__\|\.py[co]\)$' -delete" # noqa: W605
28+
)
2229
self.source_diff_file: Path = CDK_OUT_PATH / "layer_build.diff"
2330

2431
def build(self) -> str:
@@ -31,6 +38,11 @@ def build(self) -> str:
3138

3239
return str(self.output_dir)
3340

41+
def after_build(self):
42+
subprocess.run(self.cleanup_command, shell=True)
43+
44+
super(LocalLambdaPowertoolsLayer, self).after_build()
45+
3446
def _has_source_changed(self) -> bool:
3547
"""Hashes source code and
3648

0 commit comments

Comments
 (0)