assert!(is_long_prefix(&block_hashes_from_logs, &blocks_hashes));
-
// L1014 PullBlocksToTip incorrect hash
+
// Disable until the error returned from gRPC methods is stabilized
-
pub async fn pull_blocks_to_tip_incorrect_hash() {
+
pub async fn pull_range_invalid_params() {
let setup = setup::client::default().await;
sleep(Duration::from_secs(10)).await; // wait for the server to produce some blocks
-
.pull_blocks_to_tip(TestGen::hash())
-
let blocks_hashes: Vec<Hash> = blocks.iter().map(|x| x.header.hash()).collect();
-
let hashes_from_logs = setup.server.logger.get_created_blocks_hashes();
-
is_long_prefix(&hashes_from_logs, &blocks_hashes),
-
"If requested hash doesn't point to any block, all blocks should be returned"
+
let gen_hash = Hash::from_str(setup.config.genesis_block_hash()).unwrap();
+
let client = setup.client;
+
let tip_hash = client.tip().await.hash();
+
let fake_hash = TestGen::hash();
+
let error = MockClientError::InvalidRequest("not found (block not found)".into());
+
let invalid_params: [(&[Hash], Hash); 3] = [
+
(&[fake_hash], tip_hash),
+
(&[gen_hash], fake_hash),
+
for (from, to) in invalid_params.iter() {
+
assert_eq!(error, client.pull_headers(from, *to).await.err().unwrap());
+
assert_eq!(error, client.pull_blocks(from, *to).await.err().unwrap());
+
client.pull_blocks_to_tip(fake_hash).await.err().unwrap()
assert!(is_long_prefix(&hashes_from_logs, &hashes));
-
// L1019 Pull headers incorrect hash
-
pub async fn pull_headers_incorrect_hash() {
-
let setup = setup::client::default().await;
-
MockClientError::InvalidRequest(
-
"not found (Could not find a known block in `from`)".into()
-
.pull_headers(&[], TestGen::hash().into())
-
// L1019A Pull headers empty hash
-
pub async fn pull_headers_empty_start_hash() {
-
let setup = setup::client::default().await;
-
sleep(Duration::from_secs(10)).await; // wait for the server to produce some blocks
-
let tip_header = setup.client.tip().await;
-
.pull_headers(&[], tip_header.hash())
-
let hashes: Vec<Hash> = headers.iter().map(|x| x.hash()).collect();
-
let hashes_from_logs = setup.server.logger.get_created_blocks_hashes();
-
assert!(is_long_prefix(&hashes_from_logs, &hashes));
// L1020 Push headers incorrect header
pub async fn push_headers() {
assert!(result.is_err());
-
// L1024 PullBlocks incorrect hashes
-
pub async fn pull_blocks_incorrect_hashes() {
-
let setup = setup::client::default().await;
-
let from = TestGen::hash();
-
let to = TestGen::hash();
-
let result = setup.client.pull_blocks(&[from], to).await;
-
assert!(result.is_err());