Skip to content

Commit b6d6e7c

Browse files
committed
chore: fmt code
Signed-off-by: Xin Liu <[email protected]>
1 parent cda8e39 commit b6d6e7c

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

tests/integration.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Integration tests for ss-proxy server
22
// Tests HTTP/HTTPS and WebSocket proxy functionality
33

4-
use tokio::time::Duration;
5-
use std::process::{Command, Child};
6-
use std::sync::{Once, Mutex};
4+
use std::process::{Child, Command};
75
use std::sync::OnceLock;
6+
use std::sync::{Mutex, Once};
7+
use tokio::time::Duration;
88

99
static INIT: Once = Once::new();
1010
static SERVER_PROCESS: OnceLock<Mutex<Option<Child>>> = OnceLock::new();
@@ -57,7 +57,8 @@ fn setup_test_server() {
5757
.spawn()
5858
.expect("Failed to start server");
5959

60-
SERVER_PROCESS.set(Mutex::new(Some(server)))
60+
SERVER_PROCESS
61+
.set(Mutex::new(Some(server)))
6162
.expect("Failed to set server process");
6263

6364
// Wait for server to start
@@ -155,7 +156,10 @@ async fn test_http_proxy_with_query_params() {
155156

156157
let client = reqwest::Client::new();
157158
let response = client
158-
.get(format!("{}/test-http/get?foo=bar&hello=world", get_base_url()))
159+
.get(format!(
160+
"{}/test-http/get?foo=bar&hello=world",
161+
get_base_url()
162+
))
159163
.send()
160164
.await
161165
.expect("Failed to send request");
@@ -222,8 +226,8 @@ async fn test_inactive_session() {
222226

223227
#[tokio::test]
224228
async fn test_websocket_echo() {
229+
use futures_util::{SinkExt, StreamExt};
225230
use tokio_tungstenite::connect_async;
226-
use futures_util::{StreamExt, SinkExt};
227231
use tokio_tungstenite::tungstenite::Message;
228232

229233
setup_test_server();
@@ -260,8 +264,8 @@ async fn test_websocket_echo() {
260264

261265
#[tokio::test]
262266
async fn test_websocket_binary_message() {
267+
use futures_util::{SinkExt, StreamExt};
263268
use tokio_tungstenite::connect_async;
264-
use futures_util::{StreamExt, SinkExt};
265269
use tokio_tungstenite::tungstenite::Message;
266270

267271
setup_test_server();
@@ -305,13 +309,16 @@ async fn test_websocket_session_not_found() {
305309
// Try to connect to non-existent session
306310
let result = connect_async(format!("{}/ws/nonexistent-session", get_ws_base_url())).await;
307311

308-
assert!(result.is_err(), "Connection should fail for non-existent session");
312+
assert!(
313+
result.is_err(),
314+
"Connection should fail for non-existent session"
315+
);
309316
}
310317

311318
#[tokio::test]
312319
async fn test_websocket_multiple_messages() {
320+
use futures_util::{SinkExt, StreamExt};
313321
use tokio_tungstenite::connect_async;
314-
use futures_util::{StreamExt, SinkExt};
315322
use tokio_tungstenite::tungstenite::Message;
316323

317324
setup_test_server();

0 commit comments

Comments
 (0)