Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jules committed Aug 24, 2021
1 parent bdb30cd commit 7b71127
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions phase1-coordinator/src/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2786,7 +2786,7 @@ mod tests {
use std::{collections::HashMap, sync::Arc};

fn initialize_to_round_1(
coordinator: &mut Coordinator<Disk>,
coordinator: &mut Coordinator,
contributors: &[Participant],
verifiers: &[Participant],
) -> anyhow::Result<()> {
Expand Down Expand Up @@ -2838,7 +2838,7 @@ mod tests {
Ok(())
}

fn initialize_coordinator(coordinator: &mut Coordinator<Disk>) -> anyhow::Result<()> {
fn initialize_coordinator(coordinator: &mut Coordinator) -> anyhow::Result<()> {
// Load the contributors and verifiers.
let contributors = vec![
Lazy::force(&TEST_CONTRIBUTOR_ID).clone(),
Expand All @@ -2849,7 +2849,7 @@ mod tests {
initialize_to_round_1(coordinator, &contributors, &verifiers)
}

fn initialize_coordinator_single_contributor(coordinator: &mut Coordinator<Disk>) -> anyhow::Result<()> {
fn initialize_coordinator_single_contributor(coordinator: &mut Coordinator) -> anyhow::Result<()> {
// Load the contributors and verifiers.
let contributors = vec![Lazy::force(&TEST_CONTRIBUTOR_ID).clone()];
let verifiers = vec![Lazy::force(&TEST_VERIFIER_ID).clone()];
Expand Down
8 changes: 4 additions & 4 deletions phase1-coordinator/src/objects/round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,9 @@ impl Round {
chunk.set_lock_holder_unsafe(None);

for (id, _) in chunk.clone().get_contributions() {
chunk.remove_contribution_unsafe(*id);
if *id != 0 {
chunk.remove_contribution_unsafe(*id);
}
}
});

Expand Down Expand Up @@ -1233,10 +1235,8 @@ mod tests {
let n_verifications = 30;
let n_locked_chunks = 1;
let n_files = 2 * n_contributions + 2 * n_verifications + 2 * n_locked_chunks;
let n_actions = n_files + 1; // include action to update round

let actions = round_1.reset(&[TEST_CONTRIBUTOR_ID_2.clone()]);
assert_eq!(n_actions, actions.len());
let action = round_1.reset(&[TEST_CONTRIBUTOR_ID_2.clone()]);

assert_eq!(64, round_1.chunks().len());

Expand Down
10 changes: 5 additions & 5 deletions phase1-coordinator/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
commands::{Seed, SigningKey, SEED_LENGTH},
environment::{Environment, Parameters, Settings, Testing},
objects::Task,
storage::{Disk, Storage},
storage::{Disk, StorageLocator, StorageObject},
testing::prelude::*,
Coordinator,
CoordinatorError,
Expand Down Expand Up @@ -53,7 +53,7 @@ struct ContributorTestDetails {
}

impl ContributorTestDetails {
fn contribute_to(&self, coordinator: &mut Coordinator<Disk>) -> Result<(), CoordinatorError> {
fn contribute_to(&self, coordinator: &mut Coordinator) -> Result<(), CoordinatorError> {
coordinator.contribute(&self.participant, &self.signing_key, &self.seed)
}
}
Expand All @@ -73,7 +73,7 @@ struct VerifierTestDetails {
}

impl VerifierTestDetails {
fn verify(&self, coordinator: &mut Coordinator<Disk>) -> anyhow::Result<()> {
fn verify(&self, coordinator: &mut Coordinator) -> anyhow::Result<()> {
coordinator.verify(&self.participant, &self.signing_key)
}
}
Expand Down Expand Up @@ -1315,7 +1315,7 @@ fn coordinator_drop_several_contributors() {
fn contribute_verify_until_no_tasks(
contributor: &ContributorTestDetails,
verifier: &VerifierTestDetails,
coordinator: &mut Coordinator<Disk>,
coordinator: &mut Coordinator,
) -> anyhow::Result<bool> {
match contributor.contribute_to(coordinator) {
Err(CoordinatorError::ParticipantHasNoRemainingTasks) => Ok(true),
Expand Down Expand Up @@ -1366,7 +1366,7 @@ fn coordinator_drop_several_contributors() {
assert_eq!(0, coordinator.number_of_queue_verifiers());
}

fn check_round_matches_storage_files(storage: &impl Storage, round: &Round) {
fn check_round_matches_storage_files(storage: &Disk, round: &Round) {
debug!("Checking round {}", round.round_height());
for chunk in round.chunks() {
debug!("Checking chunk {}", chunk.chunk_id());
Expand Down

0 comments on commit 7b71127

Please sign in to comment.