mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
Feat/lambda image config working directory (#673)
* feat(lambda): support ImageConfig.WorkingDirectory override Propagate WorkingDirectory from the Lambda ImageConfig through the full stack so container images that rely on a specific WORKDIR can be invoked correctly, matching real AWS behavior. - LambdaFunction: add imageConfigWorkingDirectory field + getter/setter - LambdaService: parse WorkingDirectory on CreateFunction and UpdateFunctionConfiguration - ContainerSpec: add workingDir record component - ContainerBuilder: add withWorkingDir() fluent method - ContainerLifecycleManager: pass workingDir to Docker via withWorkingDir() - ContainerLauncher: apply workingDir when building the container spec - LambdaController: serialize WorkingDirectory in ImageConfigResponse * test(lambda): add tests for ImageConfig.WorkingDirectory Unit tests (LambdaImageConfigTest): - CreateFunction stores WorkingDirectory alongside Command/EntryPoint - createFunction with all three fields together - updateFunctionConfiguration updates and clears WorkingDirectory - ContainerLauncher passes workingDir to ContainerSpec Compat tests across all SDKs: - awscli (lambda.bats): create/get/update WorkingDirectory round-trip - Java SDK (LambdaFunctionConfigTest): ImageConfig.WorkingDirectory round-trip - Python (test_lambda_function_config.py): TestImageConfigWorkingDirectory class - Node (lambda.test.ts): create/update WorkingDirectory assertions - Go (lambda_test.go): TestLambdaImageConfigWorkingDirectory subtests - Rust (lambda_test.rs): full create/get/update round-trip
This commit is contained in:
14 files changed
+494
-5
No files matched your search
@@ -280,3 +280,83 @@ class TestUpdateFunctionConfiguration:
|
||||
)
|
||||
finally:
|
||||
lambda_client.delete_function(FunctionName=fn)
|
||||
|
||||
|
||||
class TestImageConfigWorkingDirectory:
|
||||
"""ImageConfig.WorkingDirectory is persisted and returned correctly."""
|
||||
|
||||
IMAGE_URI = "000000000000.dkr.ecr.us-east-1.amazonaws.com/fake-repo:latest"
|
||||
|
||||
def test_create_image_function_with_working_directory(
|
||||
self, lambda_client, unique_name
|
||||
):
|
||||
fn = f"pytest-imgwd-{unique_name}"
|
||||
try:
|
||||
resp = lambda_client.create_function(
|
||||
FunctionName=fn,
|
||||
PackageType="Image",
|
||||
Role=ROLE,
|
||||
Code={"ImageUri": self.IMAGE_URI},
|
||||
ImageConfig={"WorkingDirectory": "/app"},
|
||||
)
|
||||
wd = (
|
||||
resp.get("ImageConfigResponse", {})
|
||||
.get("ImageConfig", {})
|
||||
.get("WorkingDirectory")
|
||||
)
|
||||
assert wd == "/app", (
|
||||
f"CreateFunction response must include ImageConfig.WorkingDirectory='/app', got: {wd!r}"
|
||||
)
|
||||
finally:
|
||||
lambda_client.delete_function(FunctionName=fn)
|
||||
|
||||
def test_get_function_configuration_persists_working_directory(
|
||||
self, lambda_client, unique_name
|
||||
):
|
||||
fn = f"pytest-imgwd-get-{unique_name}"
|
||||
try:
|
||||
lambda_client.create_function(
|
||||
FunctionName=fn,
|
||||
PackageType="Image",
|
||||
Role=ROLE,
|
||||
Code={"ImageUri": self.IMAGE_URI},
|
||||
ImageConfig={"WorkingDirectory": "/workspace"},
|
||||
)
|
||||
resp = lambda_client.get_function_configuration(FunctionName=fn)
|
||||
wd = (
|
||||
resp.get("ImageConfigResponse", {})
|
||||
.get("ImageConfig", {})
|
||||
.get("WorkingDirectory")
|
||||
)
|
||||
assert wd == "/workspace", (
|
||||
f"GetFunctionConfiguration must persist WorkingDirectory='/workspace', got: {wd!r}"
|
||||
)
|
||||
finally:
|
||||
lambda_client.delete_function(FunctionName=fn)
|
||||
|
||||
def test_update_function_configuration_updates_working_directory(
|
||||
self, lambda_client, unique_name
|
||||
):
|
||||
fn = f"pytest-imgwd-upd-{unique_name}"
|
||||
try:
|
||||
lambda_client.create_function(
|
||||
FunctionName=fn,
|
||||
PackageType="Image",
|
||||
Role=ROLE,
|
||||
Code={"ImageUri": self.IMAGE_URI},
|
||||
ImageConfig={"WorkingDirectory": "/initial"},
|
||||
)
|
||||
resp = lambda_client.update_function_configuration(
|
||||
FunctionName=fn,
|
||||
ImageConfig={"WorkingDirectory": "/updated"},
|
||||
)
|
||||
wd = (
|
||||
resp.get("ImageConfigResponse", {})
|
||||
.get("ImageConfig", {})
|
||||
.get("WorkingDirectory")
|
||||
)
|
||||
assert wd == "/updated", (
|
||||
f"UpdateFunctionConfiguration must update WorkingDirectory to '/updated', got: {wd!r}"
|
||||
)
|
||||
finally:
|
||||
lambda_client.delete_function(FunctionName=fn)
|
||||
Reference in new issue
Block a user