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

@ -6,7 +6,7 @@ use crate::test::dummy_tcp_sockets::{
dummy_tcp_client_additions_requests, 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";
const NUM_INC: i32 = 5;
@ -16,7 +16,7 @@ fn port(index: u16) -> u16 {
}
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn valid_with_token_auth() {
async fn test() {
let _ = env_logger::builder().is_test(true).try_init();
// Start internal services
@ -53,8 +53,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()
}));