Repository: awslabs/aws-lambda-rust-runtime (language: rust)

Issue:
Not possible to create a Context for testing
I would like to create a mock Context to be able to test my handler fully. Unfortunately deadline is private and new requires a config provider and the ConfigProvider is in env, which is private.

Any pointers?


Discussion / hints:
Uh, we should probably make those public. That’s my suggestion 😬
Pretty pretty please - It'd make testing a lot easier. They are public in the Java libs.

Fix patch:
diff --git a/lambda-runtime/src/context.rs b/lambda-runtime/src/context.rs
index d918ec57..3fcc08b1 100644
--- a/lambda-runtime/src/context.rs
+++ b/lambda-runtime/src/context.rs
@@ -61,7 +61,7 @@ pub struct Context {
 
     /// The deadline for the current handler execution in milliseconds, based
     /// on a unix `MONOTONIC` clock.
-    pub(super) deadline: i64,
+    pub deadline: i64,
 }
 
 impl Context {


Test patch: