Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
}))
.build()
.await
.expect(REMOTE_INACCESSIBLE)
.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
.expect(REMOTE_INACCESSIBLE)
.execute_with(|| {});
Builder::<Block>::new()
.mode(Mode::Online(OnlineConfig {
transport: "wss://rpc.polkadot.io:443".to_owned().into(),
pallets: vec!["Council".to_owned()],
.expect(REMOTE_INACCESSIBLE)
.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
.expect(REMOTE_INACCESSIBLE)
.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
.expect(REMOTE_INACCESSIBLE)
.execute_with(|| {});
}
#[tokio::test]
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
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
.expect(REMOTE_INACCESSIBLE)
.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()
.expect(REMOTE_INACCESSIBLE)
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()
}))
.expect(REMOTE_INACCESSIBLE)
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
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
.expect(REMOTE_INACCESSIBLE)
.execute_with(|| {});
}