Skip to content

Commit

Permalink
test: remmove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosvdr committed Jan 10, 2025
1 parent 4912d42 commit a2b7d74
Showing 1 changed file with 3 additions and 106 deletions.
109 changes: 3 additions & 106 deletions crates/tap-agent/src/tap_agent_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
#[cfg(test)]
pub mod tests {
// use bigdecimal::{BigDecimal, FromPrimitive};
// use indexer_config::{
// BlockchainConfig, Config, DatabaseConfig, EscrowSubgraphConfig, GraphNodeConfig, IndexerConfig,
// MetricsConfig, NetworkSubgraphConfig, NonZeroGRT, RavRequestConfig, ServiceConfig,
// SubgraphConfig, SubgraphsConfig, TapConfig,
// };

use indexer_monitor::{DeploymentDetails, SubgraphClient};
use ractor::call;
use ractor::{concurrency::JoinHandle, Actor, ActorRef};
use serde_json::json;
use sqlx::PgPool;
use tap_core::receipt::state::Checking;
use tap_core::receipt::ReceiptWithState;
use wiremock::matchers::body_string_contains;
use wiremock::MockGuard;

use crate::agent::sender_account::SenderAccountMessage;
use crate::agent::sender_accounts_manager::{
Expand Down Expand Up @@ -67,29 +60,9 @@ pub mod tests {
Arc<Notify>,
(ActorRef<SenderAccountsManagerMessage>, JoinHandle<()>),
) {
// let allocation = INDEXER_ALLOCATIONS.values().next().unwrap().clone();
// let deployment = allocation.subgraph_deployment.id;

let escrow_subgraph_mock_server = mock_escrow_subgraph_empty_response().await;
//let graph_node_mock_server = MockServer::start().await;
let network_subgraph_mock_server = MockServer::start().await;
// let graph_node_mock_server = MockServer::start().await;
// let mock = Mock::given(method("POST"))
// .and(path(format!("/subgraphs/id/{deployment}")))
// .respond_with(ResponseTemplate::new(200).set_body_raw(
// r#"
// {
// "data": {
// "graphNetwork": {
// "currentEpoch": 960
// }
// }
// }
// "#,
// "application/json",
// ));
// graph_node_mock_server.register(mock).await;

let network_subgraph_mock_server = MockServer::start().await;
// Start a TAP aggregator server.
let (_handle, aggregator_endpoint) = run_server(
0,
Expand All @@ -111,76 +84,12 @@ pub mod tests {

let (_allocations_tx, indexer_allocations1) = watch::channel(INDEXER_ALLOCATIONS.clone());

//let graph_node_url = Url::parse(&graph_node_mock_server.uri()).unwrap();
let mut sender_aggregator_endpoints: HashMap<Address, Url> = HashMap::new();
sender_aggregator_endpoints.insert(
TAP_SENDER.1,
Url::from_str(&format!("http://{}", aggregator_endpoint))
.expect("This should not fail"),
);
println!("Sender: {}", TAP_SENDER.1);
// let config = Config {
// indexer: IndexerConfig {
// indexer_address: INDEXER_ADDRESS,
// operator_mnemonic: INDEXER_MNEMONIC.clone(),
// },
// graph_node: GraphNodeConfig {
// status_url: graph_node_url.clone(),
// query_url: graph_node_url.clone(),
// },
// database: DatabaseConfig::PostgresUrl {
// postgres_url: Url::from_str(&db_url).expect("should be able to create it"),
// },
// subgraphs: SubgraphsConfig {
// network: NetworkSubgraphConfig {
// config: SubgraphConfig {
// query_url: Url::from_str(&network_subgraph_mock_server.uri()).unwrap(),
// query_auth_token: None,
// deployment_id: None,
// syncing_interval_secs: Duration::from_secs(30),
// },
// recently_closed_allocation_buffer_secs: Duration::from_secs(30),
// },
// escrow: EscrowSubgraphConfig {
// config: SubgraphConfig {
// query_url: Url::from_str(&escrow_subgraph_mock_server.uri()).unwrap(),
// query_auth_token: None,
// deployment_id: None,
// syncing_interval_secs: Duration::from_secs(30),
// },
// },
// },
// tap: TapConfig {
// // TODO: replace with a proper implementation once the gateway registry contract is ready
// max_amount_willing_to_lose_grt: NonZeroGRT::new(1).expect("Should be able to convert"),
// rav_request: RavRequestConfig {
// trigger_value_divisor: BigDecimal::from_i32(1000).expect("shouldnt fail"),
// timestamp_buffer_secs: Duration::from_secs(30),
// request_timeout_secs: Duration::from_secs(60),
// max_receipts_per_request: 100,
// },
// sender_timeout_secs: Duration::from_secs(60),
// sender_aggregator_endpoints,
// },
// metrics: MetricsConfig { port: 12 },
// blockchain: BlockchainConfig {
// chain_id: indexer_config::TheGraphChainId::Test,
// receipts_verifier_address: VERIFIER_ADDRESS,
// },
// service: ServiceConfig {
// serve_network_subgraph: false,
// serve_escrow_subgraph: false,
// serve_auth_token: None,
// host_and_port: "0.0.0.0:0".parse().unwrap(),
// url_prefix: "/".into(),
// tap: indexer_config::ServiceTapConfig {
// max_receipt_value_grt: NonZeroGRT::new(1000000000000).unwrap(),
// },
// free_query_auth_token: None,
// },
// dips: None,
// };

let http_client = reqwest::Client::new();

let network_subgraph = Box::leak(Box::new(
Expand All @@ -192,15 +101,6 @@ pub mod tests {
.await,
));

// let _indexer_allocations = indexer_allocations(
// network_subgraph,
// INDEXER_ADDRESS,
// Duration::from_secs(30),
// Duration::from_secs(30),
// )
// .await
// .expect("Failed to initialize indexer_allocations watcher");

let escrow_subgraph = Box::leak(Box::new(
SubgraphClient::new(
http_client.clone(),
Expand Down Expand Up @@ -243,9 +143,6 @@ pub mod tests {
notify,
Actor::spawn(None, actor, args).await.unwrap(),
)
// SenderAccountsManager::spawn(None, SenderAccountsManager, args)
// .await
// .expect("Failed to start sender accounts manager actor.")
}

#[sqlx::test(migrations = "../../migrations")]
Expand All @@ -254,7 +151,7 @@ pub mod tests {
.is_test(true)
.filter_level(log::LevelFilter::Debug)
.try_init(); // Initialize logger
let (prefix, notify, (actor_ref, handle)) = start_agent(pgpool.clone()).await;
let (prefix, notify, (actor_ref, _handle)) = start_agent(pgpool.clone()).await;
actor_ref
.cast(SenderAccountsManagerMessage::UpdateSenderAccounts(
vec![TAP_SENDER.1].into_iter().collect(),
Expand Down

0 comments on commit a2b7d74

Please sign in to comment.