|
|
@@ -60,37 +60,6 @@ impl TestHarness {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// Blocks a percentage of the bridges for the passed Test Harness
|
|
|
- /// excluding the hot spare buckets as they will not have been handed out.
|
|
|
- /// The logic assumes hot spare buckets are appended to the end of the bridge_table
|
|
|
- /// bucket list.
|
|
|
-
|
|
|
- fn block_percent_bridges(&mut self, percent_blockage: usize) {
|
|
|
- let blockable_range =
|
|
|
- self.ba.bridge_table.buckets.len() - self.ba.bridge_table.spares.len();
|
|
|
- let mut block_index: HashSet<usize> = HashSet::new();
|
|
|
- let mut rng = rand::rngs::OsRng;
|
|
|
-
|
|
|
- while block_index.len() < percent_blockage {
|
|
|
- let rand_num = rng.gen_range(1..blockable_range);
|
|
|
- if !self.bdb.openinv_buckets.contains(&(rand_num as u32))
|
|
|
- && !self.bdb.distributed_buckets.contains(&(rand_num as u32))
|
|
|
- && !block_index.contains(&rand_num)
|
|
|
- {
|
|
|
- block_index.insert(rand_num);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for index in block_index {
|
|
|
- let ba_clone = self.ba.bridge_table.buckets.clone();
|
|
|
- if let Some(bridgelines) = ba_clone.get(&u32::try_from(index).unwrap()) {
|
|
|
- for bridgeline in bridgelines {
|
|
|
- self.ba.bridge_blocked(bridgeline, &mut self.bdb);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/// Verify the two MACs on a Lox credential
|
|
|
pub fn verify_lox(&self, cred: &lox_creds::Lox) {
|
|
|
assert!(
|