micro_http: fix doctest socket conflicts
Doctests in `lib.rs` and `server.rs` were both using the same hardcoded socket path `/tmp/example.sock`. When running tests in parallel, this caused conflicts and sporadic failures with `AddrInUse`. Fix this by using unique socket paths for each doctest. Assisted-by: Antigravity:Gemini-3.5-Flash Signed-off-by: Changyuan Lyu <changyuanl@google.com>
This commit is contained in:
committed by
Ilias Stamatis
parent
f2d91703a1
commit
7975fe0e59
@@ -83,7 +83,7 @@
|
|||||||
//! ```
|
//! ```
|
||||||
//! use micro_http::{HttpServer, Response, StatusCode};
|
//! use micro_http::{HttpServer, Response, StatusCode};
|
||||||
//!
|
//!
|
||||||
//! let path_to_socket = "/tmp/example.sock";
|
//! let path_to_socket = "/tmp/example_lib.sock";
|
||||||
//! std::fs::remove_file(path_to_socket).unwrap_or_default();
|
//! std::fs::remove_file(path_to_socket).unwrap_or_default();
|
||||||
//!
|
//!
|
||||||
//! // Start the server.
|
//! // Start the server.
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ impl<T: Read + Write + ScmSocket> ClientConnection<T> {
|
|||||||
/// ```
|
/// ```
|
||||||
/// use micro_http::{HttpServer, Response, StatusCode};
|
/// use micro_http::{HttpServer, Response, StatusCode};
|
||||||
///
|
///
|
||||||
/// let path_to_socket = "/tmp/example.sock";
|
/// let path_to_socket = "/tmp/example_server.sock";
|
||||||
/// std::fs::remove_file(path_to_socket).unwrap_or_default();
|
/// std::fs::remove_file(path_to_socket).unwrap_or_default();
|
||||||
///
|
///
|
||||||
/// // Start the server.
|
/// // Start the server.
|
||||||
|
|||||||
Reference in New Issue
Block a user