Skip to content

Commit 9ed65ad

Browse files
committed
Use CommitStrategy::Args in place of CommitStrategy::FromBuffer for many tests
1 parent 03efa01 commit 9ed65ad

File tree

1 file changed

+86
-46
lines changed

1 file changed

+86
-46
lines changed

test-integration/test-committor-service/tests/test_ix_commit_local.rs

Lines changed: 86 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -61,34 +61,47 @@ fn expect_strategies(
6161
// -----------------
6262
// Single Account Commits
6363
// -----------------
64-
#[tokio::test]
64+
65+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
66+
// # see the PR #575 for more context.
67+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
6568
async fn test_ix_commit_single_account_100_bytes() {
6669
commit_single_account(100, CommitStrategy::Args, false).await;
6770
}
6871

69-
#[tokio::test]
72+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
73+
// # see the PR #575 for more context.
74+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
7075
async fn test_ix_commit_single_account_100_bytes_and_undelegate() {
7176
commit_single_account(100, CommitStrategy::Args, true).await;
7277
}
7378

74-
#[tokio::test]
79+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
80+
// # see the PR #575 for more context.
81+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
7582
async fn test_ix_commit_single_account_800_bytes() {
76-
commit_single_account(800, CommitStrategy::FromBuffer, false).await;
83+
commit_single_account(800, CommitStrategy::Args, false).await;
7784
}
7885

79-
#[tokio::test]
86+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
87+
// # see the PR #575 for more context.
88+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
8089
async fn test_ix_commit_single_account_800_bytes_and_undelegate() {
81-
commit_single_account(800, CommitStrategy::FromBuffer, true).await;
90+
commit_single_account(800, CommitStrategy::Args, true).await;
8291
}
8392

84-
#[tokio::test]
93+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
94+
// # see the PR #575 for more context.
95+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
8596
async fn test_ix_commit_single_account_one_kb() {
86-
commit_single_account(1024, CommitStrategy::FromBuffer, false).await;
97+
commit_single_account(1024, CommitStrategy::Args, false).await;
8798
}
8899

89-
#[tokio::test]
100+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
101+
// # see the PR #575 for more context.
102+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
90103
async fn test_ix_commit_single_account_ten_kb() {
91-
commit_single_account(10 * 1024, CommitStrategy::FromBuffer, false).await;
104+
commit_single_account(10 * 1024, CommitStrategy::Args, false).await;
92105
}
93106

94107
async fn commit_single_account(
@@ -153,19 +166,24 @@ async fn commit_single_account(
153166
// -----------------
154167
// Multiple Account Commits
155168
// -----------------
156-
#[tokio::test]
169+
170+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
171+
// # see the PR #575 for more context.
172+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
157173
async fn test_ix_commit_two_accounts_1kb_2kb() {
158174
init_logger!();
159175
commit_multiple_accounts(
160176
&[1024, 2048],
161177
1,
162178
false,
163-
expect_strategies(&[(CommitStrategy::FromBuffer, 2)]),
179+
expect_strategies(&[(CommitStrategy::Args, 2)]),
164180
)
165181
.await;
166182
}
167183

168-
#[tokio::test]
184+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
185+
// # see the PR #575 for more context.
186+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
169187
async fn test_ix_commit_two_accounts_512kb() {
170188
init_logger!();
171189
commit_multiple_accounts(
@@ -177,7 +195,9 @@ async fn test_ix_commit_two_accounts_512kb() {
177195
.await;
178196
}
179197

180-
#[tokio::test]
198+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
199+
// # see the PR #575 for more context.
200+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
181201
async fn test_ix_commit_three_accounts_512kb() {
182202
init_logger!();
183203
commit_multiple_accounts(
@@ -189,7 +209,9 @@ async fn test_ix_commit_three_accounts_512kb() {
189209
.await;
190210
}
191211

192-
#[tokio::test]
212+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
213+
// # see the PR #575 for more context.
214+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
193215
async fn test_ix_commit_six_accounts_512kb() {
194216
init_logger!();
195217
commit_multiple_accounts(
@@ -201,14 +223,16 @@ async fn test_ix_commit_six_accounts_512kb() {
201223
.await;
202224
}
203225

204-
#[tokio::test]
226+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
227+
// # see the PR #575 for more context.
228+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
205229
async fn test_ix_commit_four_accounts_1kb_2kb_5kb_10kb_single_bundle() {
206230
init_logger!();
207231
commit_multiple_accounts(
208232
&[1024, 2 * 1024, 5 * 1024, 10 * 1024],
209233
1,
210234
false,
211-
expect_strategies(&[(CommitStrategy::FromBuffer, 4)]),
235+
expect_strategies(&[(CommitStrategy::Args, 4)]),
212236
)
213237
.await;
214238
}
@@ -217,83 +241,91 @@ async fn test_ix_commit_four_accounts_1kb_2kb_5kb_10kb_single_bundle() {
217241
// # see the PR #575 for more context.
218242
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
219243
async fn test_commit_20_accounts_1kb_bundle_size_2() {
220-
commit_20_accounts_1kb(
221-
2,
222-
expect_strategies(&[(CommitStrategy::FromBuffer, 20)]),
223-
)
224-
.await;
244+
commit_20_accounts_1kb(2, expect_strategies(&[(CommitStrategy::Args, 20)]))
245+
.await;
225246
}
226247

227-
#[tokio::test]
248+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
249+
// # see the PR #575 for more context.
250+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
228251
async fn test_commit_5_accounts_1kb_bundle_size_3() {
229252
commit_5_accounts_1kb(
230253
3,
231-
expect_strategies(&[(CommitStrategy::FromBuffer, 5)]),
254+
expect_strategies(&[(CommitStrategy::Args, 5)]),
232255
false,
233256
)
234257
.await;
235258
}
236259

237-
#[tokio::test]
260+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
261+
// # see the PR #575 for more context.
262+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
238263
async fn test_commit_5_accounts_1kb_bundle_size_3_undelegate_all() {
239264
commit_5_accounts_1kb(
240265
3,
241266
expect_strategies(&[
242267
// Intent fits in 1 TX only with ALT, see IntentExecutorImpl::try_unite_tasks
243-
(CommitStrategy::FromBufferWithLookupTable, 3),
244-
(CommitStrategy::FromBuffer, 2),
268+
(CommitStrategy::ArgsWithLookupTable, 3),
269+
(CommitStrategy::Args, 2),
245270
]),
246271
true,
247272
)
248273
.await;
249274
}
250275

251-
#[tokio::test]
276+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
277+
// # see the PR #575 for more context.
278+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
252279
async fn test_commit_5_accounts_1kb_bundle_size_4() {
253280
commit_5_accounts_1kb(
254281
4,
255282
expect_strategies(&[
256-
(CommitStrategy::FromBuffer, 1),
283+
(CommitStrategy::Args, 1),
257284
(CommitStrategy::FromBufferWithLookupTable, 4),
258285
]),
259286
false,
260287
)
261288
.await;
262289
}
263290

264-
#[tokio::test]
291+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
292+
// # see the PR #575 for more context.
293+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
265294
async fn test_commit_5_accounts_1kb_bundle_size_4_undelegate_all() {
266295
commit_5_accounts_1kb(
267296
4,
268297
expect_strategies(&[
269-
(CommitStrategy::FromBuffer, 1),
298+
(CommitStrategy::Args, 1),
270299
(CommitStrategy::FromBufferWithLookupTable, 4),
271300
]),
272301
true,
273302
)
274303
.await;
275304
}
276305

277-
#[tokio::test]
306+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
307+
// # see the PR #575 for more context.
308+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
278309
async fn test_commit_5_accounts_1kb_bundle_size_5_undelegate_all() {
279310
commit_5_accounts_1kb(
280311
5,
281-
expect_strategies(&[(CommitStrategy::FromBufferWithLookupTable, 5)]),
312+
expect_strategies(&[(CommitStrategy::ArgsWithLookupTable, 5)]),
282313
true,
283314
)
284315
.await;
285316
}
286317

287-
#[tokio::test]
318+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
319+
// # see the PR #575 for more context.
320+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
288321
async fn test_commit_20_accounts_1kb_bundle_size_3() {
289-
commit_20_accounts_1kb(
290-
3,
291-
expect_strategies(&[(CommitStrategy::FromBuffer, 20)]),
292-
)
293-
.await;
322+
commit_20_accounts_1kb(3, expect_strategies(&[(CommitStrategy::Args, 20)]))
323+
.await;
294324
}
295325

296-
#[tokio::test]
326+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
327+
// # see the PR #575 for more context.
328+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
297329
async fn test_commit_20_accounts_1kb_bundle_size_4() {
298330
commit_20_accounts_1kb(
299331
4,
@@ -302,20 +334,24 @@ async fn test_commit_20_accounts_1kb_bundle_size_4() {
302334
.await;
303335
}
304336

305-
#[tokio::test]
337+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
338+
// # see the PR #575 for more context.
339+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
306340
async fn test_commit_20_accounts_1kb_bundle_size_6() {
307341
commit_20_accounts_1kb(
308342
6,
309343
expect_strategies(&[
310344
(CommitStrategy::FromBufferWithLookupTable, 18),
311345
// Two accounts don't make it into the bundles of size 6
312-
(CommitStrategy::FromBuffer, 2),
346+
(CommitStrategy::Args, 2),
313347
]),
314348
)
315349
.await;
316350
}
317351

318-
#[tokio::test]
352+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
353+
// # see the PR #575 for more context.
354+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
319355
async fn test_commit_20_accounts_1kb_bundle_size_20() {
320356
commit_20_accounts_1kb(
321357
20,
@@ -324,7 +360,9 @@ async fn test_commit_20_accounts_1kb_bundle_size_20() {
324360
.await;
325361
}
326362

327-
#[tokio::test]
363+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
364+
// # see the PR #575 for more context.
365+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
328366
async fn test_commit_8_accounts_1kb_bundle_size_8() {
329367
commit_8_accounts_1kb(
330368
8,
@@ -337,7 +375,9 @@ async fn test_commit_8_accounts_1kb_bundle_size_8() {
337375
.await;
338376
}
339377

340-
#[tokio::test]
378+
// TODO (snawaz): use #[tokio::test] once CommitTask::new() stops using blocking RpcClient
379+
// # see the PR #575 for more context.
380+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
341381
async fn test_commit_20_accounts_1kb_bundle_size_8() {
342382
commit_20_accounts_1kb(
343383
8,
@@ -468,7 +508,7 @@ async fn commit_multiple_accounts(
468508
ix_commit_local(service, intents, expected_strategies).await;
469509
}
470510

471-
// TODO(thlorenz): once delegation program supports larger commits add the following
511+
// TODO(thlorenz/snawaz): once delegation program supports larger commits add the following
472512
// tests
473513
//
474514
// ## Scenario 1

0 commit comments

Comments
 (0)