22// SPDX-License-Identifier: Apache-2.0
33#[ cfg( test) ]
44pub mod tests {
5- // use bigdecimal::{BigDecimal, FromPrimitive};
6- // use indexer_config::{
7- // BlockchainConfig, Config, DatabaseConfig, EscrowSubgraphConfig, GraphNodeConfig, IndexerConfig,
8- // MetricsConfig, NetworkSubgraphConfig, NonZeroGRT, RavRequestConfig, ServiceConfig,
9- // SubgraphConfig, SubgraphsConfig, TapConfig,
10- // };
5+
116 use indexer_monitor:: { DeploymentDetails , SubgraphClient } ;
127 use ractor:: call;
138 use ractor:: { concurrency:: JoinHandle , Actor , ActorRef } ;
149 use serde_json:: json;
1510 use sqlx:: PgPool ;
1611 use tap_core:: receipt:: state:: Checking ;
1712 use tap_core:: receipt:: ReceiptWithState ;
18- use wiremock:: matchers:: body_string_contains;
19- use wiremock:: MockGuard ;
2013
2114 use crate :: agent:: sender_account:: SenderAccountMessage ;
2215 use crate :: agent:: sender_accounts_manager:: {
@@ -67,29 +60,9 @@ pub mod tests {
6760 Arc < Notify > ,
6861 ( ActorRef < SenderAccountsManagerMessage > , JoinHandle < ( ) > ) ,
6962 ) {
70- // let allocation = INDEXER_ALLOCATIONS.values().next().unwrap().clone();
71- // let deployment = allocation.subgraph_deployment.id;
72-
7363 let escrow_subgraph_mock_server = mock_escrow_subgraph_empty_response ( ) . await ;
74- //let graph_node_mock_server = MockServer::start().await;
75- let network_subgraph_mock_server = MockServer :: start ( ) . await ;
76- // let graph_node_mock_server = MockServer::start().await;
77- // let mock = Mock::given(method("POST"))
78- // .and(path(format!("/subgraphs/id/{deployment}")))
79- // .respond_with(ResponseTemplate::new(200).set_body_raw(
80- // r#"
81- // {
82- // "data": {
83- // "graphNetwork": {
84- // "currentEpoch": 960
85- // }
86- // }
87- // }
88- // "#,
89- // "application/json",
90- // ));
91- // graph_node_mock_server.register(mock).await;
9264
65+ let network_subgraph_mock_server = MockServer :: start ( ) . await ;
9366 // Start a TAP aggregator server.
9467 let ( _handle, aggregator_endpoint) = run_server (
9568 0 ,
@@ -111,76 +84,12 @@ pub mod tests {
11184
11285 let ( _allocations_tx, indexer_allocations1) = watch:: channel ( INDEXER_ALLOCATIONS . clone ( ) ) ;
11386
114- //let graph_node_url = Url::parse(&graph_node_mock_server.uri()).unwrap();
11587 let mut sender_aggregator_endpoints: HashMap < Address , Url > = HashMap :: new ( ) ;
11688 sender_aggregator_endpoints. insert (
11789 TAP_SENDER . 1 ,
11890 Url :: from_str ( & format ! ( "http://{}" , aggregator_endpoint) )
11991 . expect ( "This should not fail" ) ,
12092 ) ;
121- println ! ( "Sender: {}" , TAP_SENDER . 1 ) ;
122- // let config = Config {
123- // indexer: IndexerConfig {
124- // indexer_address: INDEXER_ADDRESS,
125- // operator_mnemonic: INDEXER_MNEMONIC.clone(),
126- // },
127- // graph_node: GraphNodeConfig {
128- // status_url: graph_node_url.clone(),
129- // query_url: graph_node_url.clone(),
130- // },
131- // database: DatabaseConfig::PostgresUrl {
132- // postgres_url: Url::from_str(&db_url).expect("should be able to create it"),
133- // },
134- // subgraphs: SubgraphsConfig {
135- // network: NetworkSubgraphConfig {
136- // config: SubgraphConfig {
137- // query_url: Url::from_str(&network_subgraph_mock_server.uri()).unwrap(),
138- // query_auth_token: None,
139- // deployment_id: None,
140- // syncing_interval_secs: Duration::from_secs(30),
141- // },
142- // recently_closed_allocation_buffer_secs: Duration::from_secs(30),
143- // },
144- // escrow: EscrowSubgraphConfig {
145- // config: SubgraphConfig {
146- // query_url: Url::from_str(&escrow_subgraph_mock_server.uri()).unwrap(),
147- // query_auth_token: None,
148- // deployment_id: None,
149- // syncing_interval_secs: Duration::from_secs(30),
150- // },
151- // },
152- // },
153- // tap: TapConfig {
154- // // TODO: replace with a proper implementation once the gateway registry contract is ready
155- // max_amount_willing_to_lose_grt: NonZeroGRT::new(1).expect("Should be able to convert"),
156- // rav_request: RavRequestConfig {
157- // trigger_value_divisor: BigDecimal::from_i32(1000).expect("shouldnt fail"),
158- // timestamp_buffer_secs: Duration::from_secs(30),
159- // request_timeout_secs: Duration::from_secs(60),
160- // max_receipts_per_request: 100,
161- // },
162- // sender_timeout_secs: Duration::from_secs(60),
163- // sender_aggregator_endpoints,
164- // },
165- // metrics: MetricsConfig { port: 12 },
166- // blockchain: BlockchainConfig {
167- // chain_id: indexer_config::TheGraphChainId::Test,
168- // receipts_verifier_address: VERIFIER_ADDRESS,
169- // },
170- // service: ServiceConfig {
171- // serve_network_subgraph: false,
172- // serve_escrow_subgraph: false,
173- // serve_auth_token: None,
174- // host_and_port: "0.0.0.0:0".parse().unwrap(),
175- // url_prefix: "/".into(),
176- // tap: indexer_config::ServiceTapConfig {
177- // max_receipt_value_grt: NonZeroGRT::new(1000000000000).unwrap(),
178- // },
179- // free_query_auth_token: None,
180- // },
181- // dips: None,
182- // };
183-
18493 let http_client = reqwest:: Client :: new ( ) ;
18594
18695 let network_subgraph = Box :: leak ( Box :: new (
@@ -192,15 +101,6 @@ pub mod tests {
192101 . await ,
193102 ) ) ;
194103
195- // let _indexer_allocations = indexer_allocations(
196- // network_subgraph,
197- // INDEXER_ADDRESS,
198- // Duration::from_secs(30),
199- // Duration::from_secs(30),
200- // )
201- // .await
202- // .expect("Failed to initialize indexer_allocations watcher");
203-
204104 let escrow_subgraph = Box :: leak ( Box :: new (
205105 SubgraphClient :: new (
206106 http_client. clone ( ) ,
@@ -243,9 +143,6 @@ pub mod tests {
243143 notify,
244144 Actor :: spawn ( None , actor, args) . await . unwrap ( ) ,
245145 )
246- // SenderAccountsManager::spawn(None, SenderAccountsManager, args)
247- // .await
248- // .expect("Failed to start sender accounts manager actor.")
249146 }
250147
251148 #[ sqlx:: test( migrations = "../../migrations" ) ]
@@ -254,7 +151,7 @@ pub mod tests {
254151 . is_test ( true )
255152 . filter_level ( log:: LevelFilter :: Debug )
256153 . try_init ( ) ; // Initialize logger
257- let ( prefix, notify, ( actor_ref, handle ) ) = start_agent ( pgpool. clone ( ) ) . await ;
154+ let ( prefix, notify, ( actor_ref, _handle ) ) = start_agent ( pgpool. clone ( ) ) . await ;
258155 actor_ref
259156 . cast ( SenderAccountsManagerMessage :: UpdateSenderAccounts (
260157 vec ! [ TAP_SENDER . 1 ] . into_iter ( ) . collect ( ) ,
0 commit comments