Fixed clean up blocked test
This commit is contained in:
parent
9c2b7703a8
commit
6191970d9a
|
@ -599,13 +599,7 @@ fn test_clean_up_blocked() {
|
||||||
let mut th = TestHarness::new_buckets(50, 50);
|
let mut th = TestHarness::new_buckets(50, 50);
|
||||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||||
// Users
|
// Users
|
||||||
for _ in 0..100 {
|
for _ in 0..25 {
|
||||||
let h: NaiveTime = DateTime::time(&Utc::now());
|
|
||||||
if h.hour() == 23 && h.minute() == 59 {
|
|
||||||
println!("Wait for UTC 00:00");
|
|
||||||
thread::sleep(Duration::new(60, 0));
|
|
||||||
println!("Ready to work again");
|
|
||||||
}
|
|
||||||
let cred = th.open_invite().1 .0;
|
let cred = th.open_invite().1 .0;
|
||||||
th.advance_days(30);
|
th.advance_days(30);
|
||||||
let (_, migcred) = th.trust_promotion(&cred);
|
let (_, migcred) = th.trust_promotion(&cred);
|
||||||
|
@ -682,7 +676,7 @@ fn test_clean_up_open_entry() {
|
||||||
let mut credentials: Vec<cred::Lox> = Vec::new();
|
let mut credentials: Vec<cred::Lox> = Vec::new();
|
||||||
let mut level_1_credentials: Vec<cred::Lox> = Vec::new();
|
let mut level_1_credentials: Vec<cred::Lox> = Vec::new();
|
||||||
// Users
|
// Users
|
||||||
for _ in 0..100 {
|
for _ in 0..25 {
|
||||||
let cred = th.open_invite().1 .0;
|
let cred = th.open_invite().1 .0;
|
||||||
credentials.push(cred);
|
credentials.push(cred);
|
||||||
}
|
}
|
||||||
|
@ -748,7 +742,6 @@ fn test_clean_up_open_entry() {
|
||||||
|
|
||||||
// Let's also make sure that open invitation works again
|
// Let's also make sure that open invitation works again
|
||||||
let cred = th.open_invite().1 .0;
|
let cred = th.open_invite().1 .0;
|
||||||
println!("Yep, worked!");
|
|
||||||
th.advance_days(30);
|
th.advance_days(30);
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
|
@ -776,13 +769,13 @@ fn find_next_available_key() {}
|
||||||
fn block_bridges(th: &mut TestHarness, percentage: usize, credentials: Vec<cred::Lox>) -> usize {
|
fn block_bridges(th: &mut TestHarness, percentage: usize, credentials: Vec<cred::Lox>) -> usize {
|
||||||
let blockable_num = th.ba.bridge_table.buckets.len()
|
let blockable_num = th.ba.bridge_table.buckets.len()
|
||||||
- th.ba.bridge_table.spares.len()
|
- th.ba.bridge_table.spares.len()
|
||||||
- th.bdb.openinv_buckets.len();
|
- (th.bdb.openinv_buckets.len() / 3);
|
||||||
let blockable_range = th.ba.bridge_table.buckets.len() - th.ba.bridge_table.spares.len();
|
let blockable_range = th.ba.bridge_table.buckets.len() - th.ba.bridge_table.spares.len();
|
||||||
let to_block: usize = blockable_num * percentage / 100;
|
let to_block: usize = blockable_num * percentage / 100;
|
||||||
let mut block_index: HashSet<usize> = HashSet::new();
|
let mut block_index: HashSet<usize> = HashSet::new();
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
|
|
||||||
while block_index.len() < to_block {
|
while block_index.len() < to_block + 1 {
|
||||||
let rand_num = rng.gen_range(0, blockable_range);
|
let rand_num = rng.gen_range(0, blockable_range);
|
||||||
if !th.bdb.openinv_buckets.contains(&(rand_num as u32)) {
|
if !th.bdb.openinv_buckets.contains(&(rand_num as u32)) {
|
||||||
block_index.insert(rand_num);
|
block_index.insert(rand_num);
|
||||||
|
|
Loading…
Reference in New Issue