Newer
Older
.into_iter()
.map(|d| d.unwrap())
.filter(|p| {
p.path().file_name().unwrap_or_default() == "offline_else_online_works_data" ||
p.path().extension().unwrap_or_default() == "top" ||
p.path().extension().unwrap_or_default() == "child"
})
.collect::<Vec<_>>();
assert!(to_delete.len() > 0);
for d in to_delete {
std::fs::remove_file(d.path()).unwrap();
}
#[ignore = "too slow"]
async fn can_build_one_big_pallet() {
Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
pallets: vec!["System".to_owned()],
..Default::default()
}))
.build()
.await
.execute_with(|| {});
}
#[tokio::test]
async fn can_build_one_small_pallet() {
init_logger();
Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
transport: "wss://kusama-rpc.polkadot.io:443".to_owned().into(),
pallets: vec!["Council".to_owned()],
..Default::default()
}))
.build()
.await
.execute_with(|| {});
Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
transport: "wss://rpc.polkadot.io:443".to_owned().into(),
pallets: vec!["Council".to_owned()],
.execute_with(|| {});
}
#[tokio::test]
async fn can_build_few_pallet() {
init_logger();
Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
transport: "wss://kusama-rpc.polkadot.io:443".to_owned().into(),
pallets: vec!["Proxy".to_owned(), "Multisig".to_owned()],
..Default::default()
}))
.build()
.await
.execute_with(|| {});
Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
transport: "wss://rpc.polkadot.io:443".to_owned().into(),
pallets: vec!["Proxy".to_owned(), "Multisig".to_owned()],
..Default::default()
}))
.build()
.await
.execute_with(|| {});
}
#[tokio::test]
async fn can_create_top_snapshot() {
init_logger();
Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
state_snapshot: Some(SnapshotConfig::new("can_create_top_snapshot_data")),
pallets: vec!["Proxy".to_owned()],
..Default::default()
}))
.build()
.await
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
.execute_with(|| {});
let to_delete = std::fs::read_dir(Path::new("."))
.unwrap()
.into_iter()
.map(|d| d.unwrap())
.filter(|p| {
p.path().file_name().unwrap_or_default() == "can_create_top_snapshot_data" ||
p.path().extension().unwrap_or_default() == "top" ||
p.path().extension().unwrap_or_default() == "child"
})
.collect::<Vec<_>>();
assert!(to_delete.len() > 0);
for d in to_delete {
use std::os::unix::fs::MetadataExt;
if d.path().extension().unwrap_or_default() == "top" {
// if this is the top snapshot it must not be empty.
assert!(std::fs::metadata(d.path()).unwrap().size() > 1);
} else {
// the child is empty for this pallet.
assert!(std::fs::metadata(d.path()).unwrap().size() == 1);
}
std::fs::remove_file(d.path()).unwrap();
}
}
async fn can_create_child_snapshot() {
.mode(Mode::Online(OnlineConfig {
state_snapshot: Some(SnapshotConfig::new("can_create_child_snapshot_data")),
pallets: vec!["Crowdloan".to_owned()],
.inject_default_child_tree_prefix()
let to_delete = std::fs::read_dir(Path::new("."))
.unwrap()
.into_iter()
.map(|d| d.unwrap())
.filter(|p| {
p.path().file_name().unwrap_or_default() == "can_create_child_snapshot_data" ||
p.path().extension().unwrap_or_default() == "top" ||
p.path().extension().unwrap_or_default() == "child"
})
.collect::<Vec<_>>();
assert!(to_delete.len() > 0);
for d in to_delete {
use std::os::unix::fs::MetadataExt;
// if this is the top snapshot it must not be empty
if d.path().extension().unwrap_or_default() == "child" {
assert!(std::fs::metadata(d.path()).unwrap().size() > 1);
} else {
assert!(std::fs::metadata(d.path()).unwrap().size() > 1);
}
std::fs::remove_file(d.path()).unwrap();
}
}
async fn can_fetch_all() {
.mode(Mode::Online(OnlineConfig {
state_snapshot: Some(SnapshotConfig::new("can_fetch_all_data")),
..Default::default()
}))
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
let to_delete = std::fs::read_dir(Path::new("."))
.unwrap()
.into_iter()
.map(|d| d.unwrap())
.filter(|p| {
p.path().file_name().unwrap_or_default() == "can_fetch_all_data" ||
p.path().extension().unwrap_or_default() == "top" ||
p.path().extension().unwrap_or_default() == "child"
})
.collect::<Vec<_>>();
assert!(to_delete.len() > 0);
for d in to_delete {
use std::os::unix::fs::MetadataExt;
// if we download everything, child tree must also be filled.
if d.path().extension().unwrap_or_default() == "child" {
assert!(std::fs::metadata(d.path()).unwrap().size() > 1);
} else {
assert!(std::fs::metadata(d.path()).unwrap().size() > 1);
}
std::fs::remove_file(d.path()).unwrap();
}
#[tokio::test]
async fn can_build_child_tree() {
init_logger();
Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
transport: "wss://rpc.polkadot.io:443".to_owned().into(),
pallets: vec!["Crowdloan".to_owned()],
..Default::default()
}))
.build()
.await