mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-12 17:01:06 +00:00
Lighthouse Node (#173)
* Add a lighthouse node implementation * Implement production geth using kurtosis * Connect the lighthouse node with the platforms * Update the ci to include cargo fmt * Add rustfmt to ci * Add formatting component for macos * Fix CI * Add the cargo clippy component * Install kurtosis in cli * fix ci * Skip lighthouse tests in MacOS in CI * Increase the wait duration of kurtosis
This commit is contained in:
@@ -22,6 +22,8 @@ revive-dt-node-interaction = { workspace = true }
|
||||
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
serde_with = { workspace = true }
|
||||
serde_yaml_ng = { workspace = true }
|
||||
|
||||
sp-core = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
|
||||
@@ -6,6 +6,7 @@ use revive_dt_node_interaction::EthereumNode;
|
||||
pub mod common;
|
||||
pub mod constants;
|
||||
pub mod geth;
|
||||
pub mod lighthouse_geth;
|
||||
pub mod process;
|
||||
pub mod substrate;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -68,7 +68,7 @@ impl Process {
|
||||
command_building_callback(&mut command, stdout_logs_file, stderr_logs_file);
|
||||
command
|
||||
};
|
||||
let child = command
|
||||
let mut child = command
|
||||
.spawn()
|
||||
.context("Failed to spawn the built command")?;
|
||||
|
||||
@@ -93,10 +93,22 @@ impl Process {
|
||||
let mut stdout_lines = BufReader::new(stdout_logs_file).lines();
|
||||
let mut stderr_lines = BufReader::new(stderr_logs_file).lines();
|
||||
|
||||
let mut stdout = String::new();
|
||||
let mut stderr = String::new();
|
||||
|
||||
loop {
|
||||
let stdout_line = stdout_lines.next().and_then(Result::ok);
|
||||
let stderr_line = stderr_lines.next().and_then(Result::ok);
|
||||
|
||||
if let Some(stdout_line) = stdout_line.as_ref() {
|
||||
stdout.push_str(stdout_line);
|
||||
stdout.push('\n');
|
||||
}
|
||||
if let Some(stderr_line) = stderr_line.as_ref() {
|
||||
stderr.push_str(stderr_line);
|
||||
stderr.push('\n');
|
||||
}
|
||||
|
||||
let check_result =
|
||||
check_function(stdout_line.as_deref(), stderr_line.as_deref())
|
||||
.context("Failed to wait for the process to be ready")?;
|
||||
@@ -106,10 +118,21 @@ impl Process {
|
||||
}
|
||||
|
||||
if Instant::now().duration_since(spawn_time) > max_wait_duration {
|
||||
bail!("Waited for the process to start but it failed to start in time")
|
||||
bail!(
|
||||
"Waited for the process to start but it failed to start in time. stderr {stderr} - stdout {stdout}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
ProcessReadinessWaitBehavior::WaitForCommandToExit => {
|
||||
if !child
|
||||
.wait()
|
||||
.context("Failed waiting for kurtosis run process to finish")?
|
||||
.success()
|
||||
{
|
||||
anyhow::bail!("Failed to initialize kurtosis network",);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
@@ -137,6 +160,9 @@ pub enum ProcessReadinessWaitBehavior {
|
||||
/// straight away.
|
||||
NoStartupWait,
|
||||
|
||||
/// Waits for the command to exit.
|
||||
WaitForCommandToExit,
|
||||
|
||||
/// The process does require some amount of wait duration after it's been started.
|
||||
WaitDuration(Duration),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user