chore: basic traits for test case, cluster, node

This commit is contained in:
Roman 2024-12-12 19:33:53 +08:00
parent 8a9ee5e37f
commit f247140f9b
No known key found for this signature in database
GPG Key ID: B8FE070B54E11B75
7 changed files with 44 additions and 3 deletions

View File

@ -11,4 +11,5 @@ nomos-tracing = { path = "../nomos-tracing" }
nomos-tracing-service = { path = "../nomos-services/tracing" } nomos-tracing-service = { path = "../nomos-services/tracing" }
overwatch-rs = { git = "https://github.com/logos-co/Overwatch", rev = "2f70806" } overwatch-rs = { git = "https://github.com/logos-co/Overwatch", rev = "2f70806" }
color-eyre = "0.6.0" color-eyre = "0.6.0"
tracing = "0.1" tracing = "0.1"
anyhow = "1.0.93"

View File

@ -0,0 +1,8 @@
use crate::node::NomosNode;
pub trait Cluster {
fn members(&self) -> Vec<Box<dyn NomosNode>>;
}

View File

@ -0,0 +1,10 @@
mod cluster;
mod node;
pub mod config;
pub mod test_case;
pub trait TestCase {
fn name(&self) -> &'static str;
fn run(&self) -> Result<(), anyhow::Error>;
}

View File

@ -1,6 +1,6 @@
mod config;
use crate::config::{Config, LogArgs};
use nomos_cluster_tests::{config::{Config, LogArgs}, test_case::data_integrity_nodes_join_leave::DataIntegrityNodesJoinLeave, TestCase};
use clap::Parser; use clap::Parser;
use color_eyre::eyre::Result; use color_eyre::eyre::Result;
@ -21,6 +21,8 @@ fn main() -> Result<()> {
.update_from_args(log_args)?; .update_from_args(log_args)?;
// Run the test suite // Run the test suite
let tc1 = DataIntegrityNodesJoinLeave {};
println!("Running test: {}", tc1.name());
Ok(()) Ok(())
} }

View File

@ -0,0 +1,5 @@
pub trait NomosNode {
fn start(&self) -> String;
fn stop(&self) -> String;
}

View File

@ -0,0 +1,14 @@
use anyhow::Error;
use crate::TestCase;
pub struct DataIntegrityNodesJoinLeave;
impl TestCase for DataIntegrityNodesJoinLeave {
fn name(&self) -> &'static str {
module_path!().split("::").last().unwrap()
}
fn run(&self) -> Result<(), Error> {
todo!()
}
}

View File

@ -0,0 +1 @@
pub mod data_integrity_nodes_join_leave;