Add new test based on token auth with TLS

This commit is contained in:
2022-09-02 09:43:07 +02:00
parent 886843d087
commit 40c1bfc938
32 changed files with 747 additions and 30 deletions

View File

@ -5,7 +5,7 @@ use crate::tcp_relay_server::server_config::ServerConfig;
use crate::test::dummy_tcp_sockets::{
dummy_tcp_client_square_root_requests, wait_for_port, DummyTCPServer,
};
use crate::test::{get_port_number, PortsAllocation, LOCALHOST};
use crate::test::{get_port_number, PortsAllocation, LOCALHOST_IP};
const VALID_TOKEN: &str = "AvalidTOKEN";
@ -14,7 +14,7 @@ fn port(index: u16) -> u16 {
}
#[tokio::test(flavor = "multi_thread")]
async fn valid_with_token_auth() {
async fn test() {
let _ = env_logger::builder().is_test(true).try_init();
// Start internal service
@ -46,8 +46,8 @@ async fn valid_with_token_auth() {
// Start client relay
task::spawn(crate::tcp_relay_client::run_app(ClientConfig {
token: Some(VALID_TOKEN.to_string()),
relay_url: format!("http://{}:{}", LOCALHOST, port(0)),
listen_address: LOCALHOST.to_string(),
relay_url: format!("http://{}:{}", LOCALHOST_IP, port(0)),
listen_address: LOCALHOST_IP.to_string(),
root_certificate: None,
..Default::default()
}));