Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI #648

Merged
merged 12 commits into from
May 11, 2022
26 changes: 13 additions & 13 deletions client/rpc/src/eth/cache/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ mod tests {
executor::block_on(client.import(BlockOrigin::Own, a2)).unwrap();

// Give some time to consume and process the import notification stream.
thread::sleep(time::Duration::from_millis(1));
thread::sleep(time::Duration::from_millis(100));

// Expect: genesis with schema V1, A2 with schema V2.
assert_eq!(
Expand Down Expand Up @@ -203,7 +203,7 @@ mod tests {
executor::block_on(client.import(BlockOrigin::Own, b3)).unwrap();

// Give some time to consume and process the import notification stream.
thread::sleep(time::Duration::from_millis(1));
thread::sleep(time::Duration::from_millis(100));

// Expect: A2 to be retracted, genesis with schema V1, B3 with schema V2.
assert_eq!(
Expand All @@ -230,7 +230,7 @@ mod tests {
executor::block_on(client.import(BlockOrigin::Own, c2)).unwrap();

// Give some time to consume and process the import notification stream.
thread::sleep(time::Duration::from_millis(1));
thread::sleep(time::Duration::from_millis(100));

// Expect: genesis with schema V1, B3 still with schema V2.
// C2 still not best block and not cached.
Expand All @@ -243,28 +243,28 @@ mod tests {
);

// Make C2 branch the longest chain.
// C2 -> D2
// C2 -> C3
let mut builder = client
.new_block_at(&BlockId::Hash(c2_hash), Default::default(), false)
.unwrap();
builder.push_storage_change(vec![2], None).unwrap();
let d2 = builder.build().unwrap().block;
let d2_hash = d2.header.hash();
executor::block_on(client.import(BlockOrigin::Own, d2)).unwrap();
let c3 = builder.build().unwrap().block;
let c3_hash = c3.header.hash();
executor::block_on(client.import(BlockOrigin::Own, c3)).unwrap();

// D2 -> E2
// C3 -> C4
let mut builder = client
.new_block_at(&BlockId::Hash(d2_hash), Default::default(), false)
.new_block_at(&BlockId::Hash(c3_hash), Default::default(), false)
.unwrap();
builder.push_storage_change(vec![3], None).unwrap();
let e2 = builder.build().unwrap().block;
executor::block_on(client.import(BlockOrigin::Own, e2)).unwrap();
let c4 = builder.build().unwrap().block;
executor::block_on(client.import(BlockOrigin::Own, c4)).unwrap();

// Give some time to consume and process the import notification stream.
thread::sleep(time::Duration::from_millis(1));
thread::sleep(time::Duration::from_millis(100));

// Expect: B2 branch to be retracted, genesis with schema V1, C2 with schema V2.
// E2 became new best, chain reorged, we expect the C2 ancestor to be cached.
// C4 became new best, chain reorged, we expect the C2 ancestor to be cached.
assert_eq!(
frontier_backend_client::load_cached_schema::<_>(frontier_backend.as_ref()),
Ok(Some(vec![
Expand Down