Skip to content

Commit

Permalink
chore: rename testing http gateway client
Browse files Browse the repository at this point in the history
commit-id:116b21cb
  • Loading branch information
Itay-Tsabary-Starkware committed Sep 16, 2024
1 parent 7c12924 commit d0fd64d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions crates/tests-integration/src/integration_test_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ use starknet_task_executor::tokio_executor::TokioExecutor;
use tokio::runtime::Handle;
use tokio::task::JoinHandle;

use crate::integration_test_utils::{create_config, GatewayClient};
use crate::integration_test_utils::{create_config, HttpTestClient};
use crate::mock_batcher::MockBatcher;
use crate::state_reader::spawn_test_rpc_state_reader;

pub struct IntegrationTestSetup {
pub task_executor: TokioExecutor,
pub gateway_client: GatewayClient,
pub http_test_client: HttpTestClient,
pub batcher: MockBatcher,
pub gateway_handle: JoinHandle<()>,
pub mempool_handle: JoinHandle<()>,
Expand Down Expand Up @@ -52,7 +52,7 @@ impl IntegrationTestSetup {
let (clients, servers) = create_clients_servers_from_config(&config);

let GatewayNetworkConfig { ip, port } = config.gateway_config.network_config;
let gateway_client = GatewayClient::new(SocketAddr::from((ip, port)));
let http_test_client = HttpTestClient::new(SocketAddr::from((ip, port)));

let gateway_future = get_server_future("Gateway", true, servers.gateway);
let gateway_handle = task_executor.spawn_with_handle(gateway_future);
Expand All @@ -69,15 +69,15 @@ impl IntegrationTestSetup {
let mempool_future = get_server_future("Mempool", true, servers.mempool);
let mempool_handle = task_executor.spawn_with_handle(mempool_future);

Self { task_executor, gateway_client, batcher, gateway_handle, mempool_handle }
Self { task_executor, http_test_client, batcher, gateway_handle, mempool_handle }
}

pub async fn assert_add_tx_success(&self, tx: &RpcTransaction) -> TransactionHash {
self.gateway_client.assert_add_tx_success(tx).await
self.http_test_client.assert_add_tx_success(tx).await
}

pub async fn assert_add_tx_error(&self, tx: &RpcTransaction) -> GatewaySpecError {
self.gateway_client.assert_add_tx_error(tx).await
self.http_test_client.assert_add_tx_error(tx).await
}

pub async fn get_txs(&self, n_txs: usize) -> Vec<Transaction> {
Expand Down
6 changes: 3 additions & 3 deletions crates/tests-integration/src/integration_test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ pub async fn create_config(rpc_server_addr: SocketAddr) -> MempoolNodeConfig {
MempoolNodeConfig { gateway_config, rpc_state_reader_config, ..MempoolNodeConfig::default() }
}

/// A test utility client for interacting with a gateway server.
pub struct GatewayClient {
/// A test utility client for interacting with an http server.
pub struct HttpTestClient {
socket: SocketAddr,
client: Client,
}

impl GatewayClient {
impl HttpTestClient {
pub fn new(socket: SocketAddr) -> Self {
let client = Client::new();
Self { socket, client }
Expand Down

0 comments on commit d0fd64d

Please sign in to comment.