Skip to content

Commit

Permalink
chore: remove/ignore tests which download from a remote server (#1547)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Carver <[email protected]>
  • Loading branch information
KolbyML and carver authored Oct 24, 2024
1 parent e3243a6 commit 96a2152
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
29 changes: 8 additions & 21 deletions e2store/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@ pub async fn download_era_links(
pub async fn get_era_files(http_client: &Client) -> anyhow::Result<HashMap<u64, String>> {
let era_files = download_era_links(http_client, ERA_DIR_URL).await?;
ensure!(!era_files.is_empty(), "No era files found at {ERA_DIR_URL}");
let missing_epochs: Vec<String> = (0..era_files.len())
.filter(|&epoch_num| !era_files.contains_key(&(epoch_num as u64)))
.map(|epoch_num| epoch_num.to_string())
.collect();

ensure!(
(0..era_files.len()).all(|epoch| era_files.contains_key(&(epoch as u64))),
"Epoch indices are not starting from zero or not consecutive",
missing_epochs.is_empty(),
"Epoch indices are not starting from zero or not consecutive: missing epochs [{}]",
missing_epochs.join(", ")
);
Ok(era_files)
}
Expand Down Expand Up @@ -78,22 +84,3 @@ pub async fn get_shuffled_era1_files(http_client: &Client) -> anyhow::Result<Vec
era1_files.shuffle(&mut thread_rng());
Ok(era1_files)
}

#[cfg(test)]
mod tests {
use super::*;

#[tokio::test]
async fn test_get_shuffled_era1_files() {
let http_client = Client::new();
let era1_files = get_shuffled_era1_files(&http_client).await.unwrap();
assert_eq!(era1_files.len(), ERA1_FILE_COUNT);
}

#[tokio::test]
async fn test_get_era_file_download_links() {
let http_client = Client::new();
let era_files = get_era_files(&http_client).await.unwrap();
assert!(!era_files.is_empty());
}
}
1 change: 1 addition & 0 deletions trin-execution/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ mod tests {
use super::*;

#[tokio::test]
#[ignore = "This test downloads data from a remote server"]
async fn test_we_generate_the_correct_state_root_for_the_first_8192_blocks() {
let temp_directory = create_temp_test_dir().unwrap();
let mut trin_execution = TrinExecution::new(temp_directory.path(), StateConfig::default())
Expand Down
1 change: 1 addition & 0 deletions trin-execution/src/trie_walker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ mod tests {
use crate::{config::StateConfig, execution::TrinExecution, trie_walker::TrieWalker};

#[tokio::test]
#[ignore = "This test downloads data from a remote server"]
async fn test_trie_walker_builds_valid_proof() {
let temp_directory = create_temp_test_dir().unwrap();
let mut trin_execution = TrinExecution::new(temp_directory.path(), StateConfig::default())
Expand Down
1 change: 1 addition & 0 deletions trin-execution/tests/export_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use trin_utils::dir::create_temp_test_dir;
/// ```
#[tokio::test]
#[traced_test]
#[ignore = "This test downloads data from a remote server"]
async fn execute_export_import_execute() -> anyhow::Result<()> {
let blocks = std::env::var("BLOCKS")
.ok()
Expand Down

0 comments on commit 96a2152

Please sign in to comment.