Skip to content

Commit

Permalink
Fix the failing test in the server-aws-lambda
Browse files Browse the repository at this point in the history
Since we upgraded Deno, along came a newer version of Tokio, which made a (breaking change)[tokio-rs/tokio#5766] to make `EnterGuard` `!Send`. We need to use `Handle::current()` to get the current handle so those dynamically loaded libraries will work with the same runtime (see comments in subsystem_resolver.rs).

Only one test in the server-aws-lambda crate was using the dynamically loaded library, so we fixed
by using static loaders, instead.

Filed #868
  • Loading branch information
ramnivas committed Aug 2, 2023
1 parent fc9b19c commit ea68f4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ pub trait SubsystemResolver: Sync {
request_context: &'a RequestContext,
system_resolver: &'a SystemResolver,
) -> Result<Option<QueryResponse>, SubsystemResolutionError> {
// let _guard = handle.enter();
// TODO: reintroduce `let _guard = handle.enter();` or an equivalent mechanism to
// ensure dynamically loaded resolvers continue to work
// See issue #868
self.resolve(operation, operation_type, request_context, system_resolver)
.await
}
Expand All @@ -57,7 +59,7 @@ pub trait SubsystemResolver: Sync {
request_context: &'a RequestContext<'a>,
system_resolver: &'a SystemResolver,
) -> Result<Option<QueryResponse>, SubsystemResolutionError> {
// let _guard = handle.enter();
// TODO: See above for `let _guard = handle.enter();` reintroduction
self.invoke_interceptor(
interceptor_index,
intercepted_operation,
Expand Down
3 changes: 2 additions & 1 deletion crates/server-aws-lambda/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::sync::Arc;
use resolver::create_system_resolver_from_serialized_bytes;
use serde_json::Value;
use server_aws_lambda::resolve;
use server_common::create_static_loaders;

pub async fn test_query(json_input: Value, exo_model: &str, expected: Value) {
let context = lambda_runtime::Context::default();
Expand All @@ -29,7 +30,7 @@ pub async fn test_query(json_input: Value, exo_model: &str, expected: Value) {
.await
.unwrap();
let system_resolver = Arc::new(
create_system_resolver_from_serialized_bytes(model_system, vec![])
create_system_resolver_from_serialized_bytes(model_system, create_static_loaders())
.await
.unwrap(),
);
Expand Down

0 comments on commit ea68f4a

Please sign in to comment.