Skip to content

Commit

Permalink
test(hardano): fix failing tests on CI context (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Apr 2, 2024
1 parent b6f537a commit 1d29798
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 9 additions & 2 deletions pallas-hardano/src/storage/immutable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ mod tests {

use pallas_network::miniprotocols::Point;
use pallas_traverse::MultiEraBlock;
use tracing::trace;
use tracing::{trace, warn};

#[test]
fn chunk_binary_search_test() {
Expand Down Expand Up @@ -581,7 +581,14 @@ mod tests {

let path = Path::new("../test_data/full_snapshots");

let dir = std::fs::read_dir(path).expect("can't access full_snapshots dir");
let dir = match std::fs::read_dir(path) {
Ok(x) => x,
Err(_) => {
warn!("full_snapshot folder not available");
return;
}
};

for snapshot in dir {
let snapshot = snapshot.unwrap();
let immutable = snapshot.path().join("immutable");
Expand Down
4 changes: 1 addition & 3 deletions pallas-hardano/src/storage/immutable/primary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ use std::{
io::{BufReader, Read},
};

use binary_layout::prelude::*;

// See https://input-output-hk.github.io/ouroboros-consensus/pdfs/report.pdf, section 8.2.2
define_layout!(layout, BigEndian, {
binary_layout::define_layout!(layout, BigEndian, {
secondary_offset: u32,
});

Expand Down
4 changes: 1 addition & 3 deletions pallas-hardano/src/storage/immutable/secondary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ use std::{

pub type PrimaryIndex = super::primary::Reader;

use binary_layout::prelude::*;

use crate::storage::immutable::{primary, secondary};

// See https://input-output-hk.github.io/ouroboros-consensus/pdfs/report.pdf, section 8.2.2
define_layout!(layout, BigEndian, {
binary_layout::define_layout!(layout, BigEndian, {
block_offset: u64,
header_offset: u16,
header_size: u16,
Expand Down

0 comments on commit 1d29798

Please sign in to comment.