Skip to content

Commit a30f507

Browse files
committed
Use #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
1 parent 4a5d8e2 commit a30f507

File tree

2 files changed

+29
-21
lines changed

2 files changed

+29
-21
lines changed

magicblock-committor-service/src/tasks/mod.rs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,10 @@ use magicblock_program::magic_scheduled_base_intent::{
1919
};
2020
use solana_account::{Account, ReadableAccount};
2121
use solana_pubkey::Pubkey;
22-
use solana_rpc_client::rpc_client::RpcClient;
23-
use solana_sdk::{
24-
commitment_config::CommitmentConfig, instruction::Instruction,
25-
};
22+
use solana_sdk::instruction::Instruction;
2623
use thiserror::Error;
2724

28-
use crate::{
29-
config::ChainConfig, tasks::visitor::Visitor, ComputeBudgetConfig,
30-
};
25+
use crate::tasks::visitor::Visitor;
3126

3227
pub mod args_task;
3328
pub mod buffer_task;
@@ -125,24 +120,33 @@ impl CommitTask {
125120
allow_undelegation: bool,
126121
committed_account: CommittedAccount,
127122
) -> Self {
128-
let chain_config =
129-
ChainConfig::local(ComputeBudgetConfig::new(1_000_000));
130-
131-
let rpc_client = RpcClient::new_with_commitment(
132-
chain_config.rpc_uri.to_string(),
133-
CommitmentConfig {
134-
commitment: chain_config.commitment,
135-
},
136-
);
137-
138123
let fetched_account = if committed_account.account.data.len()
139124
> CommitTask::COMMIT_STATE_SIZE_THRESHOLD
140125
{
141-
rpc_client.get_account(&committed_account.pubkey).ok()
126+
//use solana_rpc_client::rpc_client::RpcClient;
127+
//use solana_sdk::commitment_config::CommitmentConfig;
128+
129+
//use crate::{config::ChainConfig, ComputeBudgetConfig};
130+
131+
//let chain_config =
132+
// ChainConfig::local(ComputeBudgetConfig::new(1_000_000));
133+
134+
// let rpc_client = RpcClient::new_with_commitment(
135+
// chain_config.rpc_uri.to_string(),
136+
// CommitmentConfig {
137+
// commitment: chain_config.commitment,
138+
// },
139+
// );
140+
141+
// rpc_client.get_account(&committed_account.pubkey).ok()
142+
143+
None
142144
} else {
143145
None
144146
};
145147

148+
println!("fetched_account: {:#?}", fetched_account);
149+
146150
Self {
147151
commit_id,
148152
allow_undelegation,

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ use crate::common::{create_commit_task, generate_random_bytes, TestFixture};
1515

1616
mod common;
1717

18-
#[tokio::test]
18+
//#[tokio::test]
19+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
1920
async fn test_prepare_10kb_buffer() {
21+
println!("TestFixture::new()");
2022
let fixture = TestFixture::new().await;
23+
println!("TestFixture::new() done");
2124
let preparator = fixture.create_delivery_preparator();
2225

2326
let data = generate_random_bytes(10 * 1024);
@@ -76,6 +79,7 @@ async fn test_prepare_10kb_buffer() {
7679
);
7780
}
7881

82+
//#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
7983
#[tokio::test]
8084
async fn test_prepare_multiple_buffers() {
8185
let fixture = TestFixture::new().await;
@@ -206,7 +210,7 @@ async fn test_lookup_tables() {
206210
}
207211
}
208212

209-
#[tokio::test]
213+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
210214
async fn test_already_initialized_error_handled() {
211215
let fixture = TestFixture::new().await;
212216
let preparator = fixture.create_delivery_preparator();
@@ -288,7 +292,7 @@ async fn test_already_initialized_error_handled() {
288292
assert_eq!(account.data.as_slice(), data, "Unexpected account data");
289293
}
290294

291-
#[tokio::test]
295+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
292296
async fn test_prepare_cleanup_and_reprepare_mixed_tasks() {
293297
use borsh::BorshDeserialize;
294298

0 commit comments

Comments
 (0)