mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-04-25 16:17:59 +00:00
Delete the node's db on shutdown but persist logs
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs::{File, OpenOptions, create_dir_all},
|
||||
fs::{File, OpenOptions, create_dir_all, remove_dir_all},
|
||||
io::{BufRead, BufReader, Read, Write},
|
||||
path::PathBuf,
|
||||
process::{Command, Stdio},
|
||||
@@ -273,6 +273,7 @@ impl Node for Instance {
|
||||
|
||||
#[tracing::instrument(skip_all, fields(geth_node_id = self.id))]
|
||||
fn shutdown(&mut self) -> anyhow::Result<()> {
|
||||
// Terminate the processes in a graceful manner to allow for the output to be flushed.
|
||||
if let Some(mut child) = self.handle.take() {
|
||||
child.terminate().map_err(|error| {
|
||||
anyhow::anyhow!("Failed to terminate the geth process: {error:?}")
|
||||
@@ -281,6 +282,10 @@ impl Node for Instance {
|
||||
anyhow::anyhow!("Failed to wait for the termination of the geth process: {error:?}")
|
||||
})?;
|
||||
}
|
||||
|
||||
// Remove the node's database so that subsequent runs do not run on the same database.
|
||||
remove_dir_all(self.base_directory.join("data"))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs::{OpenOptions, create_dir_all},
|
||||
fs::{OpenOptions, create_dir_all, remove_dir_all},
|
||||
io::BufRead,
|
||||
path::{Path, PathBuf},
|
||||
process::{Command, Stdio},
|
||||
@@ -390,6 +390,7 @@ impl Node for KitchensinkNode {
|
||||
|
||||
#[tracing::instrument(skip_all, fields(kitchensink_node_id = self.id))]
|
||||
fn shutdown(&mut self) -> anyhow::Result<()> {
|
||||
// Terminate the processes in a graceful manner to allow for the output to be flushed.
|
||||
if let Some(mut child) = self.process_proxy.take() {
|
||||
child.terminate().map_err(|error| {
|
||||
anyhow::anyhow!("Failed to terminate the proxy process: {error:?}")
|
||||
@@ -410,6 +411,10 @@ impl Node for KitchensinkNode {
|
||||
)
|
||||
})?;
|
||||
}
|
||||
|
||||
// Remove the node's database so that subsequent runs do not run on the same database.
|
||||
remove_dir_all(self.base_directory.join("chains"))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user