Skip to content

Commit f119d81

Browse files
authored
Add function's EphemeralStorage update support (#73)
Description of changes: - Add function's EphemeralStorage update support - Add e2e tests By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 2981dfc commit f119d81

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

pkg/resource/function/hooks.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,15 @@ func (rm *resourceManager) updateFunctionConfiguration(
238238
input.VpcConfig = VPCConfig
239239
}
240240

241+
if delta.DifferentAt("Spec.EphemeralStorage") {
242+
ephemeralStorage := &svcsdk.EphemeralStorage{}
243+
if dspec.EphemeralStorage != nil {
244+
ephemeralStorageCopy := dspec.EphemeralStorage.DeepCopy()
245+
ephemeralStorage.Size = ephemeralStorageCopy.Size
246+
}
247+
input.EphemeralStorage = ephemeralStorage
248+
}
249+
241250
_, err = rm.sdkapi.UpdateFunctionConfigurationWithContext(ctx, input)
242251
rm.metrics.RecordAPICall("UPDATE", "UpdateFunctionConfiguration", err)
243252
if err != nil {

test/e2e/tests/test_function.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def test_function_package_type_image(self, lambda_client):
332332
assert lambda_validator.function_exists(resource_name)
333333

334334
cr["spec"]["timeout"] = 10
335-
cr["spec"]["ephemeralStorage"] = { "size" : 512 }
335+
cr["spec"]["ephemeralStorage"] = { "size" : 1024 }
336336

337337
# Patch k8s resource
338338
k8s.patch_custom_resource(ref, cr)
@@ -341,7 +341,7 @@ def test_function_package_type_image(self, lambda_client):
341341
# Check function updated fields
342342
function = lambda_validator.get_function(resource_name)
343343
assert function["Configuration"]["Timeout"] == 10
344-
assert function["Configuration"]["EphemeralStorage"]["Size"] == 512
344+
assert function["Configuration"]["EphemeralStorage"]["Size"] == 1024
345345

346346
# Delete k8s resource
347347
_, deleted = k8s.delete_custom_resource(ref)

0 commit comments

Comments
 (0)