Skip to content

Commit d8c98a3

Browse files
benthecarmanclaude
andcommitted
Extract build_vss_store test helper
Move repeated VssStore construction logic into a shared build_vss_store() helper and have existing tests use it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0a9be64 commit d8c98a3

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

src/io/vss_store.rs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -941,34 +941,27 @@ mod tests {
941941
use super::*;
942942
use crate::io::test_utils::do_read_write_remove_list_persist;
943943

944-
#[tokio::test]
945-
async fn vss_read_write_remove_list_persist() {
944+
fn build_vss_store() -> VssStore {
946945
let vss_base_url = std::env::var("TEST_VSS_BASE_URL").unwrap();
947946
let mut rng = rng();
948947
let rand_store_id: String = (0..7).map(|_| rng.sample(Alphanumeric) as char).collect();
949948
let mut node_seed = [0u8; 64];
950949
rng.fill_bytes(&mut node_seed);
951950
let entropy = NodeEntropy::from_seed_bytes(node_seed);
952-
let vss_store =
953-
VssStoreBuilder::new(entropy, vss_base_url, rand_store_id, Network::Testnet)
954-
.build_with_sigs_auth(HashMap::new())
955-
.unwrap();
951+
VssStoreBuilder::new(entropy, vss_base_url, rand_store_id, Network::Testnet)
952+
.build_with_sigs_auth(HashMap::new())
953+
.unwrap()
954+
}
955+
956+
#[tokio::test]
957+
async fn vss_read_write_remove_list_persist() {
958+
let vss_store = build_vss_store();
956959
do_read_write_remove_list_persist(&vss_store).await;
957960
}
958961

959962
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
960963
async fn vss_read_write_remove_list_persist_in_runtime_context() {
961-
let vss_base_url = std::env::var("TEST_VSS_BASE_URL").unwrap();
962-
let mut rng = rng();
963-
let rand_store_id: String = (0..7).map(|_| rng.sample(Alphanumeric) as char).collect();
964-
let mut node_seed = [0u8; 64];
965-
rng.fill_bytes(&mut node_seed);
966-
let entropy = NodeEntropy::from_seed_bytes(node_seed);
967-
let vss_store =
968-
VssStoreBuilder::new(entropy, vss_base_url, rand_store_id, Network::Testnet)
969-
.build_with_sigs_auth(HashMap::new())
970-
.unwrap();
971-
964+
let vss_store = build_vss_store();
972965
do_read_write_remove_list_persist(&vss_store).await;
973966
drop(vss_store)
974967
}

0 commit comments

Comments
 (0)