Check the case with invalid token
This commit is contained in:
@ -3,16 +3,12 @@ use tokio::task;
|
||||
use crate::tcp_relay_client::client_config::ClientConfig;
|
||||
use crate::tcp_relay_server::server_config::ServerConfig;
|
||||
use crate::test::dummy_tcp_sockets::{
|
||||
dummy_tcp_client_square_root_requests, dummy_tcp_client_write_then_read_conn, wait_for_port,
|
||||
DummyTCPServer,
|
||||
dummy_tcp_client_square_root_requests, wait_for_port, DummyTCPServer,
|
||||
};
|
||||
use crate::test::{get_port_number, PortsAllocation, LOCALHOST};
|
||||
|
||||
const VALID_TOKEN: &str = "AvalidTOKEN";
|
||||
|
||||
const DATA_1: &[u8] = "DATA1".as_bytes();
|
||||
const DATA_2: &[u8] = "DATA2".as_bytes();
|
||||
|
||||
fn port(index: u16) -> u16 {
|
||||
get_port_number(PortsAllocation::ValidWithTokenAuth, index)
|
||||
}
|
||||
@ -21,10 +17,10 @@ fn port(index: u16) -> u16 {
|
||||
async fn valid_with_token_auth() {
|
||||
let _ = env_logger::builder().is_test(true).try_init();
|
||||
|
||||
// Start internal service
|
||||
let local_server = DummyTCPServer::start(port(1)).await;
|
||||
tokio::spawn(async move {
|
||||
// Start internal service
|
||||
let local_server = DummyTCPServer::start(port(1)).await;
|
||||
local_server.next_conn_square_operations().await;
|
||||
local_server.loop_conn_square_operations().await;
|
||||
});
|
||||
|
||||
let local_set = task::LocalSet::new();
|
||||
@ -56,6 +52,8 @@ async fn valid_with_token_auth() {
|
||||
..Default::default()
|
||||
}));
|
||||
wait_for_port(port(2)).await;
|
||||
|
||||
dummy_tcp_client_square_root_requests(port(2), 10).await;
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
Reference in New Issue
Block a user