Skip to content

Commit 157cae8

Browse files
chore: re-enable tests
Signed-off-by: Henry <mail@henrygressmann.de>
1 parent 6b285af commit 157cae8

12 files changed

Lines changed: 522 additions & 251 deletions

File tree

Cargo.lock

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ tikv-jemallocator="0.6"
8989
[dev-dependencies]
9090
figment={version="*", features=["test"]}
9191
cookie={version="*", default-features=false}
92+
tower={version="*", features=["util"]}
93+
hyper={version="*", features=["full"]}
94+
axum-test={version="18"}
9295

9396
[features]
9497
default=["geoip"]

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/explodingcamera/liwan/test.yaml?style=flat-square)
1111
![GitHub Release](https://img.shields.io/github/v/release/explodingcamera/liwan?style=flat-square)
1212
[![Container](https://img.shields.io/badge/Container-ghcr.io%2Fexplodingcamera%2Fliwan%3Aedge-blue?style=flat-square)](https://github.com/explodingcamera/liwan/pkgs/container/liwan)
13-
[![brainmade.org](https://img.shields.io/badge/brainmade.org-FFFFFF?style=flat-square&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxZW0iIGhlaWdodD0iNzkiIHZpZXdCb3g9IjAgMCA2NyA3OSIgZmlsbD0ibm9uZSI%2BPHBhdGggZmlsbD0iIzAwMCIgZD0iTTUyLjYxMiA3OC43ODJIMjMuMzNhMi41NTkgMi41NTkgMCAwIDEtMi41Ni0yLjU1OHYtNy42NzdoLTcuOTczYTIuNTYgMi41NiAwIDAgMS0yLjU2LTIuNTZWNTUuMzE1bC04LjgyLTQuMzk3YTIuNTU5IDIuNTU5IDAgMCAxLS45ODYtMy43MWw5Ljg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xWm0yLjgzOS0zMi4xNDNhMTAuNjQ2IDEwLjY0NiAwIDAgMSA4LjEyNC0zLjEwNmMuMzUgNi4zNC00Ljg4OCAxMS41NzctMTEuMjI4IDExLjIzYTEwLjU4IDEwLjU4IDAgMCAxIDMuMTA0LTguMTI0Wk0yNy40MDMgMzguMTkzYTEwLjYwNyAxMC42MDcgMCAwIDEtMy4xMTgtOC4xMjNjNi4zNDQtLjM1OCAxMS41ODcgNC44ODYgMTEuMjI4IDExLjIzLTMuMDIzLjE2OS01Ljk3My0uOTYxLTguMTEtMy4xMDdaIi8%2BPC9zdmc%2B)](https://brainmade.org/)
1413

1514
</div>
1615

src/web/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl Deref for RouterState {
4646
}
4747
}
4848

49-
pub async fn start_webserver(app: Arc<Liwan>, events: Sender<Event>) -> Result<()> {
49+
pub fn router(app: Arc<Liwan>, events: Sender<Event>) -> Result<axum::Router<()>> {
5050
let mut api = openapi::OpenApi {
5151
info: openapi::Info { title: "Liwan API".to_string(), ..Default::default() },
5252
..openapi::OpenApi::default()
@@ -89,6 +89,10 @@ pub async fn start_webserver(app: Arc<Liwan>, events: Sender<Event>) -> Result<(
8989
.with_state(RouterState { app: app.clone(), events })
9090
.finish_api(&mut api);
9191

92+
Ok(router)
93+
}
94+
95+
pub async fn start_webserver(app: Arc<Liwan>, events: Sender<Event>) -> Result<()> {
9296
match app.onboarding.token()? {
9397
Some(onboarding) => {
9498
let get_started = format!("{}/setup?t={}", app.config.base_url, onboarding);
@@ -101,6 +105,7 @@ pub async fn start_webserver(app: Arc<Liwan>, events: Sender<Event>) -> Result<(
101105
}
102106
}
103107

108+
let router = router(app.clone(), events)?;
104109
let listener = tokio::net::TcpListener::bind(("0.0.0.0", app.config.port)).await.unwrap();
105110
let service = router.into_make_service_with_connect_info::<SocketAddr>();
106111
axum::serve(listener, service).await.context("server exited unexpectedly")

0 commit comments

Comments
 (0)