Skip to content

Commit

Permalink
test: remove redundent mempool node config tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed May 26, 2024
1 parent af7eab1 commit ffca060
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 99 deletions.
31 changes: 4 additions & 27 deletions crates/mempool_node/src/config/config_test.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#![allow(unused_imports)]
use std::env::{self, args};
use std::fs::File;
use std::ops::IndexMut;
use std::path::{Path, PathBuf};

use assert_matches::assert_matches;
use papyrus_config::dumping::SerializeConfig;
use papyrus_config::loading::load_and_process_config;
use papyrus_config::presentation::get_config_presentation;
use papyrus_config::validators::ParsedValidationErrors;
use papyrus_config::{SerializationType, SerializedContent, SerializedParam};
Expand All @@ -15,22 +12,12 @@ use starknet_gateway::config::{
};
use validator::Validate;

use crate::config::{
node_command, ComponentConfig, ComponentExecutionConfig, GatewayConfig, MempoolNodeConfig,
};

const TEST_FILES_FOLDER: &str = "./src/test_files";
const CONFIG_FILE: &str = "mempool_node_config.json";

fn get_config_file(file_name: &str) -> Result<MempoolNodeConfig, papyrus_config::ConfigError> {
let config_file = File::open(Path::new(TEST_FILES_FOLDER).join(file_name)).unwrap();
load_and_process_config::<MempoolNodeConfig>(config_file, node_command(), vec![])
}
use crate::config::{ComponentConfig, ComponentExecutionConfig, GatewayConfig, MempoolNodeConfig};

#[test]
fn test_valid_config() {
// Read the valid config file and validate its content.
let expected_config = MempoolNodeConfig {
fn test_components_config() {
// Initialize the config file and check that the validator finds no errors.
let mut config = MempoolNodeConfig {
components: ComponentConfig {
gateway_component: ComponentExecutionConfig { execute: true },
mempool_component: ComponentExecutionConfig { execute: false },
Expand All @@ -47,16 +34,6 @@ fn test_valid_config() {
StatefulTransactionValidatorConfig::create_for_testing(),
},
};
let loaded_config = get_config_file(CONFIG_FILE).unwrap();

assert!(loaded_config.validate().is_ok());
assert_eq!(loaded_config, expected_config);
}

#[test]
fn test_components_config() {
// Read the valid config file and check that the validator finds no errors.
let mut config = get_config_file(CONFIG_FILE).unwrap();
assert!(config.validate().is_ok());

// Invalidate the gateway component and check that the validator finds an error.
Expand Down
72 changes: 0 additions & 72 deletions crates/mempool_node/src/test_files/mempool_node_config.json

This file was deleted.

0 comments on commit ffca060

Please sign in to comment.