Skip to content

Commit

Permalink
Small code adjustments for using SocketAddr types
Browse files Browse the repository at this point in the history
  • Loading branch information
eloylp committed Apr 11, 2024
1 parent ca92a49 commit 0933b08
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ampd/src/health_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ use axum::{http::StatusCode, routing::get, Json, Router};
use serde::{Deserialize, Serialize};
use tokio_util::sync::CancellationToken;

#[cfg(test)]
use std::net::SocketAddr;

pub struct Server {
listener: tokio::net::TcpListener,
}
Expand Down Expand Up @@ -67,14 +70,14 @@ struct Status {
#[cfg(test)]
mod tests {

use std::{str::FromStr, time::Duration};

use super::*;
use std::str::FromStr;
use std::time::Duration;
use tokio::test as async_test;

#[async_test]
async fn server_lifecycle() {
let server = Server::new(SocketAddr::from_str("127.0.0.1:0").unwrap())
let server = Server::new(SocketAddrV4::from_str("127.0.0.1:0").unwrap())
.await
.unwrap();
let listening_addr = server.listening_addr().unwrap();
Expand Down

0 comments on commit 0933b08

Please sign in to comment.