Skip to content

Commit d5df0f9

Browse files
committed
test: fix tests
1 parent 46c7745 commit d5df0f9

File tree

7 files changed

+83
-181
lines changed

7 files changed

+83
-181
lines changed

.sqlx/query-4c857a980b1eddc4fa85ccad223762d85614c249e06180e0b8dda8e14eff93f4.json renamed to .sqlx/query-6fc518e6b980f6dcc160d8310fc7e761625a862578b61ce925910c351edbbda8.json

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ pub mod tests {
10751075
assert_not_triggered, assert_triggered,
10761076
test::{
10771077
actors::{create_mock_sender_allocation, MockSenderAllocation},
1078-
create_rav, create_sender_account, store_rav_with_options,
1078+
create_rav, create_sender_account, store_rav_with_options, TRIGGER_VALUE,
10791079
},
10801080
};
10811081

@@ -1124,10 +1124,8 @@ pub mod tests {
11241124
}
11251125

11261126
pub static PREFIX_ID: AtomicU32 = AtomicU32::new(0);
1127-
const TRIGGER_VALUE: u128 = 500;
11281127
const ESCROW_VALUE: u128 = 1000;
11291128
const BUFFER_DURATION: Duration = Duration::from_millis(100);
1130-
const RECEIPT_LIMIT: u64 = 10000;
11311129
const RETRY_DURATION: Duration = Duration::from_millis(1000);
11321130

11331131
#[rstest::fixture]
@@ -1177,12 +1175,8 @@ pub mod tests {
11771175

11781176
let (sender_account, notify, prefix, _) = create_sender_account()
11791177
.pgpool(pgpool)
1180-
.initial_allocation(HashSet::new())
1181-
.rav_request_trigger_value(TRIGGER_VALUE)
1182-
.max_amount_willing_to_lose_grt(TRIGGER_VALUE)
11831178
.escrow_subgraph_endpoint(&mock_escrow_subgraph.uri())
11841179
.network_subgraph_endpoint(&mock_server.uri())
1185-
.rav_request_receipt_limit(RECEIPT_LIMIT)
11861180
.call()
11871181
.await;
11881182

@@ -1267,12 +1261,8 @@ pub mod tests {
12671261

12681262
let (sender_account, notify, prefix, _) = create_sender_account()
12691263
.pgpool(pgpool)
1270-
.initial_allocation(HashSet::new())
1271-
.rav_request_trigger_value(TRIGGER_VALUE)
1272-
.max_amount_willing_to_lose_grt(TRIGGER_VALUE)
12731264
.escrow_subgraph_endpoint(&mock_escrow_subgraph.uri())
12741265
.network_subgraph_endpoint(&mock_server.uri())
1275-
.rav_request_receipt_limit(RECEIPT_LIMIT)
12761266
.call()
12771267
.await;
12781268

@@ -1354,14 +1344,7 @@ pub mod tests {
13541344

13551345
#[sqlx::test(migrations = "../../migrations")]
13561346
async fn test_update_receipt_fees_no_rav(pgpool: PgPool) {
1357-
let (sender_account, _, prefix, _) = create_sender_account()
1358-
.pgpool(pgpool)
1359-
.initial_allocation(HashSet::new())
1360-
.rav_request_trigger_value(TRIGGER_VALUE)
1361-
.max_amount_willing_to_lose_grt(TRIGGER_VALUE)
1362-
.rav_request_receipt_limit(RECEIPT_LIMIT)
1363-
.call()
1364-
.await;
1347+
let (sender_account, _, prefix, _) = create_sender_account().pgpool(pgpool).call().await;
13651348

13661349
// create a fake sender allocation
13671350
let (triggered_rav_request, _, _) = create_mock_sender_allocation(
@@ -1387,14 +1370,8 @@ pub mod tests {
13871370

13881371
#[sqlx::test(migrations = "../../migrations")]
13891372
async fn test_update_receipt_fees_trigger_rav(pgpool: PgPool) {
1390-
let (sender_account, notify, prefix, _) = create_sender_account()
1391-
.pgpool(pgpool)
1392-
.initial_allocation(HashSet::new())
1393-
.rav_request_trigger_value(TRIGGER_VALUE)
1394-
.max_amount_willing_to_lose_grt(TRIGGER_VALUE)
1395-
.rav_request_receipt_limit(RECEIPT_LIMIT)
1396-
.call()
1397-
.await;
1373+
let (sender_account, notify, prefix, _) =
1374+
create_sender_account().pgpool(pgpool).call().await;
13981375

13991376
// create a fake sender allocation
14001377
let (triggered_rav_request, _, _) = create_mock_sender_allocation(
@@ -1433,9 +1410,6 @@ pub mod tests {
14331410
async fn test_counter_greater_limit_trigger_rav(pgpool: PgPool) {
14341411
let (sender_account, notify, prefix, _) = create_sender_account()
14351412
.pgpool(pgpool.clone())
1436-
.initial_allocation(HashSet::new())
1437-
.rav_request_trigger_value(TRIGGER_VALUE)
1438-
.max_amount_willing_to_lose_grt(TRIGGER_VALUE)
14391413
.rav_request_receipt_limit(2)
14401414
.call()
14411415
.await;
@@ -1490,10 +1464,8 @@ pub mod tests {
14901464
let (sender_account, _, prefix, _) = create_sender_account()
14911465
.pgpool(pgpool)
14921466
.initial_allocation(vec![ALLOCATION_ID_0].into_iter().collect())
1493-
.rav_request_trigger_value(TRIGGER_VALUE)
14941467
.max_amount_willing_to_lose_grt(TRIGGER_VALUE + 1000)
14951468
.escrow_subgraph_endpoint(&mock_escrow_subgraph.uri())
1496-
.rav_request_receipt_limit(RECEIPT_LIMIT)
14971469
.call()
14981470
.await;
14991471

@@ -1537,10 +1509,7 @@ pub mod tests {
15371509

15381510
let (sender_account, _notify, _, _) = create_sender_account()
15391511
.pgpool(pgpool.clone())
1540-
.initial_allocation(HashSet::new())
1541-
.rav_request_trigger_value(TRIGGER_VALUE)
15421512
.max_amount_willing_to_lose_grt(TRIGGER_VALUE + 1000)
1543-
.rav_request_receipt_limit(RECEIPT_LIMIT)
15441513
.call()
15451514
.await;
15461515

@@ -1555,10 +1524,7 @@ pub mod tests {
15551524

15561525
let (sender_account, notify, prefix, _) = create_sender_account()
15571526
.pgpool(pgpool)
1558-
.initial_allocation(HashSet::new())
1559-
.rav_request_trigger_value(TRIGGER_VALUE)
15601527
.max_amount_willing_to_lose_grt(max_unaggregated_fees_per_sender)
1561-
.rav_request_receipt_limit(RECEIPT_LIMIT)
15621528
.call()
15631529
.await;
15641530

@@ -1602,10 +1568,8 @@ pub mod tests {
16021568
// Making sure no RAV is going to be triggered during the test
16031569
let (sender_account, notify, _, _) = create_sender_account()
16041570
.pgpool(pgpool.clone())
1605-
.initial_allocation(HashSet::new())
16061571
.rav_request_trigger_value(u128::MAX)
16071572
.max_amount_willing_to_lose_grt(max_unaggregated_fees_per_sender)
1608-
.rav_request_receipt_limit(RECEIPT_LIMIT)
16091573
.call()
16101574
.await;
16111575

@@ -1698,10 +1662,7 @@ pub mod tests {
16981662

16991663
let (sender_account, _notify, _, _) = create_sender_account()
17001664
.pgpool(pgpool.clone())
1701-
.initial_allocation(HashSet::new())
1702-
.rav_request_trigger_value(TRIGGER_VALUE)
17031665
.max_amount_willing_to_lose_grt(u128::MAX)
1704-
.rav_request_receipt_limit(RECEIPT_LIMIT)
17051666
.call()
17061667
.await;
17071668

@@ -1728,10 +1689,8 @@ pub mod tests {
17281689
// initialize with no trigger value and no max receipt deny
17291690
let (sender_account, notify, prefix, _) = create_sender_account()
17301691
.pgpool(pgpool.clone())
1731-
.initial_allocation(HashSet::new())
17321692
.rav_request_trigger_value(trigger_rav_request)
17331693
.max_amount_willing_to_lose_grt(u128::MAX)
1734-
.rav_request_receipt_limit(RECEIPT_LIMIT)
17351694
.call()
17361695
.await;
17371696

@@ -1833,11 +1792,8 @@ pub mod tests {
18331792

18341793
let (sender_account, notify, _, escrow_accounts_tx) = create_sender_account()
18351794
.pgpool(pgpool.clone())
1836-
.initial_allocation(HashSet::new())
1837-
.rav_request_trigger_value(TRIGGER_VALUE)
18381795
.max_amount_willing_to_lose_grt(u128::MAX)
18391796
.escrow_subgraph_endpoint(&mock_server.uri())
1840-
.rav_request_receipt_limit(RECEIPT_LIMIT)
18411797
.call()
18421798
.await;
18431799

@@ -1888,10 +1844,7 @@ pub mod tests {
18881844

18891845
let (sender_account, notify, _, escrow_accounts_tx) = create_sender_account()
18901846
.pgpool(pgpool.clone())
1891-
.initial_allocation(HashSet::new())
1892-
.rav_request_trigger_value(TRIGGER_VALUE)
18931847
.max_amount_willing_to_lose_grt(u128::MAX)
1894-
.rav_request_receipt_limit(RECEIPT_LIMIT)
18951848
.call()
18961849
.await;
18971850

@@ -1934,10 +1887,7 @@ pub mod tests {
19341887

19351888
let (sender_account, notify, prefix, _) = create_sender_account()
19361889
.pgpool(pgpool)
1937-
.initial_allocation(HashSet::new())
1938-
.rav_request_trigger_value(TRIGGER_VALUE)
19391890
.max_amount_willing_to_lose_grt(max_unaggregated_fees_per_sender)
1940-
.rav_request_receipt_limit(RECEIPT_LIMIT)
19411891
.call()
19421892
.await;
19431893

0 commit comments

Comments
 (0)