fix: add rustls provider for HTTPS tests
Some checks failed
Test / rust-clippy (pull_request) Has been cancelled
Test / frontend-tests (pull_request) Has been cancelled
Test / frontend-typecheck (pull_request) Has been cancelled
Test / rust-tests (pull_request) Has been cancelled
Test / rust-fmt-check (pull_request) Has been cancelled
PR Review Automation / review (pull_request) Successful in 2m44s

- Add rustls dependency with aws_lc_rs feature to dev-dependencies
- Initialize rustls provider in MCP transport tests
- Fixes pre-existing test failures in mcp::transport::http module
This commit is contained in:
Shaun Arman 2026-06-12 20:41:05 -05:00
parent c4bb08b462
commit 7ff4f690a3
2 changed files with 10 additions and 0 deletions

View File

@ -64,6 +64,7 @@ portable-pty = "0.8"
[dev-dependencies]
tokio-test = "0.4"
mockito = "1.2"
rustls = { version = "0.23", features = ["aws_lc_rs"] }
[profile.release]
opt-level = "s"

View File

@ -260,6 +260,7 @@ mod tests {
// Transport building tests (verify no panics with Tokio runtime)
#[test]
fn test_builds_transport_with_http() {
init_rustls_provider();
let rt = tokio::runtime::Runtime::new().unwrap();
let _guard = rt.enter();
let _transport = build_http_transport("http://localhost:8080", None, HashMap::new());
@ -267,6 +268,7 @@ mod tests {
#[test]
fn test_builds_transport_with_https() {
init_rustls_provider();
let rt = tokio::runtime::Runtime::new().unwrap();
let _guard = rt.enter();
let _transport = build_http_transport("https://example.com/mcp", None, HashMap::new());
@ -274,6 +276,7 @@ mod tests {
#[test]
fn test_builds_transport_with_auth() {
init_rustls_provider();
let rt = tokio::runtime::Runtime::new().unwrap();
let _guard = rt.enter();
let _transport = build_http_transport(
@ -282,4 +285,10 @@ mod tests {
HashMap::new(),
);
}
#[cfg(test)]
fn init_rustls_provider() {
// Initialize rustls crypto provider for HTTPS tests
let _ = rustls::crypto::aws_lc_rs::default_provider().install_default();
}
}