mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Disable mdns polkadot (#58)
Deactivate mdns for polkadot node as it prevents the process to exit properly Fixes #57
This commit is contained in:
@@ -15,10 +15,9 @@
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use assert_cmd::cargo::cargo_bin;
|
||||
use std::convert::TryInto;
|
||||
use std::process::{Child, Command, ExitStatus};
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use std::{convert::TryInto, process::Command, thread, time::Duration, fs};
|
||||
|
||||
mod common;
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
@@ -26,29 +25,20 @@ fn running_the_node_works_and_can_be_interrupted() {
|
||||
use nix::sys::signal::{kill, Signal::{self, SIGINT, SIGTERM}};
|
||||
use nix::unistd::Pid;
|
||||
|
||||
fn wait_for(child: &mut Child, secs: usize) -> Option<ExitStatus> {
|
||||
for _ in 0..secs {
|
||||
match child.try_wait().unwrap() {
|
||||
Some(status) => return Some(status),
|
||||
None => sleep(Duration::from_secs(1)),
|
||||
}
|
||||
}
|
||||
eprintln!("Took to long to exit. Killing...");
|
||||
let _ = child.kill();
|
||||
child.wait().unwrap();
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
fn run_command_and_kill(signal: Signal) {
|
||||
let mut cmd = Command::new(cargo_bin("cumulus-test-parachain-collator")).args(&["--dev", "-d", "interrupt_test"]).spawn().unwrap();
|
||||
sleep(Duration::from_secs(30));
|
||||
let _ = fs::remove_dir_all("interrupt_test");
|
||||
let mut cmd = Command::new(cargo_bin("cumulus-test-parachain-collator"))
|
||||
.args(&["--dev", "-d", "interrupt_test"])
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
thread::sleep(Duration::from_secs(30));
|
||||
assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running");
|
||||
kill(Pid::from_raw(cmd.id().try_into().unwrap()), signal).unwrap();
|
||||
assert_eq!(
|
||||
wait_for(&mut cmd, 30).map(|x| x.success()),
|
||||
common::wait_for(&mut cmd, 30).map(|x| x.success()),
|
||||
Some(true),
|
||||
"the pocess must exit gracefully after signal {}",
|
||||
"the process must exit gracefully after signal {}",
|
||||
signal,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user