Skip to content

Commit 26888a7

Browse files
committed
test: change unwrap_or for a match pattern obtianing url
1 parent 3476c35 commit 26888a7

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

crates/tap-agent/src/agent/sender_allocation.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,12 @@ pub mod tests {
948948
None => create_mock_sender_account().await.1,
949949
};
950950

951-
let endpoint =
952-
Endpoint::new(sender_aggregator_endpoint.unwrap_or(get_grpc_url().await)).unwrap();
951+
let aggregator_url = match sender_aggregator_endpoint {
952+
Some(url) => url,
953+
None => get_grpc_url().await,
954+
};
955+
956+
let endpoint = Endpoint::new(aggregator_url).unwrap();
953957

954958
let sender_aggregator = TapAggregatorClient::connect(endpoint.clone())
955959
.await

crates/tap-agent/src/test.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ pub async fn create_sender_account(
144144
PREFIX_ID.fetch_add(1, std::sync::atomic::Ordering::SeqCst)
145145
);
146146

147+
let aggregator_url = match aggregator_endpoint {
148+
Some(url) => url,
149+
None => Url::parse(&get_grpc_url().await).unwrap(),
150+
};
151+
147152
let args = SenderAccountArgs {
148153
config,
149154
pgpool,
@@ -153,8 +158,7 @@ pub async fn create_sender_account(
153158
escrow_subgraph,
154159
network_subgraph,
155160
domain_separator: TAP_EIP712_DOMAIN_SEPARATOR.clone(),
156-
sender_aggregator_endpoint: aggregator_endpoint
157-
.unwrap_or(Url::parse(&get_grpc_url().await).unwrap()),
161+
sender_aggregator_endpoint: aggregator_url,
158162
allocation_ids: HashSet::new(),
159163
prefix: Some(prefix.clone()),
160164
retry_interval: RETRY_DURATION,

0 commit comments

Comments
 (0)