Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
97c38239
Unverified
Commit
97c38239
authored
Sep 22, 2025
by
Simo Lin
Committed by
GitHub
Sep 22, 2025
Browse files
[router] refactor router and worker management 3/n (#10727)
parent
60dbbd08
Changes
25
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
50 deletions
+86
-50
sgl-router/tests/api_endpoints_test.rs
sgl-router/tests/api_endpoints_test.rs
+19
-13
sgl-router/tests/common/test_app.rs
sgl-router/tests/common/test_app.rs
+36
-0
sgl-router/tests/policy_registry_integration.rs
sgl-router/tests/policy_registry_integration.rs
+3
-15
sgl-router/tests/request_formats_test.rs
sgl-router/tests/request_formats_test.rs
+14
-11
sgl-router/tests/streaming_tests.rs
sgl-router/tests/streaming_tests.rs
+14
-11
No files found.
sgl-router/tests/api_endpoints_test.rs
View file @
97c38239
This diff is collapsed.
Click to expand it.
sgl-router/tests/common/test_app.rs
View file @
97c38239
...
@@ -51,3 +51,39 @@ pub fn create_test_app(
...
@@ -51,3 +51,39 @@ pub fn create_test_app(
router_config
.cors_allowed_origins
.clone
(),
router_config
.cors_allowed_origins
.clone
(),
)
)
}
}
/// Create a test Axum application with an existing AppContext
#[allow(dead_code)]
pub
fn
create_test_app_with_context
(
router
:
Arc
<
dyn
RouterTrait
>
,
app_context
:
Arc
<
AppContext
>
,
)
->
Router
{
// Create AppState with the test router and context
let
app_state
=
Arc
::
new
(
AppState
{
router
,
context
:
app_context
.clone
(),
concurrency_queue_tx
:
None
,
router_manager
:
None
,
});
// Get config from the context
let
router_config
=
&
app_context
.router_config
;
// Configure request ID headers (use defaults if not specified)
let
request_id_headers
=
router_config
.request_id_headers
.clone
()
.unwrap_or_else
(||
{
vec!
[
"x-request-id"
.to_string
(),
"x-correlation-id"
.to_string
(),
"x-trace-id"
.to_string
(),
"request-id"
.to_string
(),
]
});
// Use the actual server's build_app function
build_app
(
app_state
,
router_config
.max_payload_size
,
request_id_headers
,
router_config
.cors_allowed_origins
.clone
(),
)
}
sgl-router/tests/policy_registry_integration.rs
View file @
97c38239
This diff is collapsed.
Click to expand it.
sgl-router/tests/request_formats_test.rs
View file @
97c38239
This diff is collapsed.
Click to expand it.
sgl-router/tests/streaming_tests.rs
View file @
97c38239
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment