Skip to content

Commit b17ead3

Browse files
committed
chore: remove too complex testing
1 parent bb3a83e commit b17ead3

1 file changed

Lines changed: 0 additions & 49 deletions

File tree

lambda-runtime/src/layers/api_client.rs

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ mod tests {
132132
use httpmock::prelude::*;
133133
use std::future;
134134
use tower::Service;
135-
use tracing_capture::{CaptureLayer, SharedStorage};
136-
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
137135

138136
fn make_invocation() -> LambdaInvocation {
139137
let (parts, _) = http::Response::new(()).into_parts();
@@ -201,53 +199,6 @@ mod tests {
201199
assert!(result.is_ok());
202200
}
203201

204-
#[tokio::test]
205-
async fn test_non_2xx_logs_status_and_body() {
206-
let storage = SharedStorage::default();
207-
// Use set_default (thread-local) so we don't race with other tests that call
208-
// set_global_default. #[tokio::test] uses a single-threaded executor, so the
209-
// guard remains valid for the entire test body.
210-
let _guard = tracing_subscriber::registry()
211-
.with(CaptureLayer::new(&storage))
212-
.set_default();
213-
214-
let server = MockServer::start();
215-
216-
const BODY: &str = r#"{"errorMessage":"Invoke timeout","errorType":"InvokeTimeout"}"#;
217-
218-
server.mock(|when, then| {
219-
when.any_request();
220-
then.status(410).header("content-type", "application/json").body(BODY);
221-
});
222-
223-
let client = make_client(&server);
224-
let req = http::Request::builder().uri("/some/path").body(Body::empty()).unwrap();
225-
let mut svc = RuntimeApiClientService::new(mock_inner(req), client);
226-
svc.call(make_invocation()).await.unwrap();
227-
228-
let storage = storage.lock();
229-
let event = storage
230-
.all_events()
231-
.find(|e| {
232-
e.metadata().level() == &tracing::Level::ERROR
233-
&& e.value("status")
234-
.and_then(|v| v.as_debug_str())
235-
.map_or(false, |s| s.contains("410"))
236-
})
237-
.expect("expected an error event with status 410 to be logged");
238-
239-
assert!(
240-
event["status"].as_debug_str().unwrap().contains("410"),
241-
"expected status to contain '410', got: {:?}",
242-
event["status"].as_debug_str()
243-
);
244-
assert!(
245-
event["body"].as_debug_str().unwrap().eq(BODY),
246-
"expected body to contain 'InvokeTimeout', got: {:?}",
247-
event["body"].as_debug_str()
248-
);
249-
}
250-
251202
#[tokio::test]
252203
async fn test_inner_service_error_propagates() {
253204
let server = MockServer::start();

0 commit comments

Comments
 (0)