Skip to content
Snippets Groups Projects
Unverified Commit 2f6c934b authored by bgallois's avatar bgallois
Browse files

upgrade cucumber

parent 1b44330d
No related branches found
No related tags found
1 merge request!236Upgrade Polkadot-v1.6.0
This commit is part of merge request !236. Comments created here will be created in the context of that merge request.
...@@ -9,24 +9,24 @@ repository = 'https://git.duniter.org/nodes/rust/duniter-v2s' ...@@ -9,24 +9,24 @@ repository = 'https://git.duniter.org/nodes/rust/duniter-v2s'
version = '3.0.0' version = '3.0.0'
[dev-dependencies] [dev-dependencies]
anyhow = "1.0" anyhow = "1.0.79"
async-trait = "0.1.74" clap = { version = "4.4.18", features = ["derive", "cargo"] }
clap = { version = "3.2.23", features = ["derive", "cargo"] } # end2end cli refactoring need to upgrade to 4 ctrlc = "3.4.2"
ctrlc = "3.2.2" cucumber = { version = "0.20.2", features = ["macros"] }
cucumber = "0.11"
distance-oracle = { path = "../distance-oracle", default_features = false } distance-oracle = { path = "../distance-oracle", default_features = false }
env_logger = "0.9.0" env_logger = "0.11.1"
hex = "0.4.3" hex = "0.4.3"
notify = "4.0" notify = "6.1.1"
parity-scale-codec = "3.4.0" notify-debouncer-mini = "0.4.1"
parity-scale-codec = "3.6.9"
portpicker = "0.1.1" portpicker = "0.1.1"
serde_json = "1.0.96" serde_json = "1.0.113"
sp-core = { git = "https://github.com/duniter/duniter-polkadot-sdk", branch = "duniter-substrate-v1.6.0", default-features = false } sp-core = { git = "https://github.com/duniter/duniter-polkadot-sdk", branch = "duniter-substrate-v1.6.0", default-features = false }
sp-core-hashing = { git = "https://github.com/duniter/duniter-polkadot-sdk", branch = "duniter-substrate-v1.6.0", default-features = false } sp-core-hashing = { git = "https://github.com/duniter/duniter-polkadot-sdk", branch = "duniter-substrate-v1.6.0", default-features = false }
sp-runtime = { git = "https://github.com/duniter/duniter-polkadot-sdk", branch = "duniter-substrate-v1.6.0" } sp-runtime = { git = "https://github.com/duniter/duniter-polkadot-sdk", branch = "duniter-substrate-v1.6.0" }
sp-keyring = { git = "https://github.com/duniter/duniter-polkadot-sdk", branch = "duniter-substrate-v1.6.0" } sp-keyring = { git = "https://github.com/duniter/duniter-polkadot-sdk", branch = "duniter-substrate-v1.6.0" }
subxt = { git = 'https://github.com/duniter/subxt', branch = 'subxt-v0.34.0-duniter-substrate-v1.6.0', default-features = false, features = ["substrate-compat", "native", "jsonrpsee"] } subxt = { git = 'https://github.com/duniter/subxt', branch = 'subxt-v0.34.0-duniter-substrate-v1.6.0', default-features = false, features = ["substrate-compat", "native", "jsonrpsee"] }
tokio = { version = "1.28", features = ["macros", "time", "rt-multi-thread"], default-features = false } tokio = { version = "1.36.0", features = ["macros", "time", "rt-multi-thread"], default-features = false }
[[test]] [[test]]
name = "cucumber_tests" name = "cucumber_tests"
......
...@@ -29,6 +29,7 @@ pub mod oneshot; ...@@ -29,6 +29,7 @@ pub mod oneshot;
pub mod gdev {} pub mod gdev {}
use anyhow::anyhow; use anyhow::anyhow;
use notify_debouncer_mini::new_debouncer;
use parity_scale_codec::Encode; use parity_scale_codec::Encode;
use serde_json::Value; use serde_json::Value;
use sp_keyring::AccountKeyring; use sp_keyring::AccountKeyring;
...@@ -274,16 +275,19 @@ fn wait_until_log_line(expected_log_line: &str, log_file_path: &str, timeout: Du ...@@ -274,16 +275,19 @@ fn wait_until_log_line(expected_log_line: &str, log_file_path: &str, timeout: Du
} }
} else { } else {
let (tx, rx) = std::sync::mpsc::channel(); let (tx, rx) = std::sync::mpsc::channel();
let mut watcher = notify::watcher(tx, std::time::Duration::from_millis(100)).unwrap(); let mut debouncer = new_debouncer(std::time::Duration::from_millis(100), tx).unwrap();
use notify::Watcher as _; debouncer
watcher .watcher()
.watch(log_file_path, notify::RecursiveMode::NonRecursive) .watch(
Path::new(log_file_path),
notify::RecursiveMode::NonRecursive,
)
.unwrap(); .unwrap();
let mut pos = 0; let mut pos = 0;
loop { loop {
match rx.recv_timeout(timeout) { match rx.recv_timeout(timeout) {
Ok(notify::DebouncedEvent::Write(_)) => { Ok(_) => {
let mut file = std::fs::File::open(log_file_path).unwrap(); let mut file = std::fs::File::open(log_file_path).unwrap();
file.seek(std::io::SeekFrom::Start(pos)).unwrap(); file.seek(std::io::SeekFrom::Start(pos)).unwrap();
pos = file.metadata().unwrap().len(); pos = file.metadata().unwrap().len();
...@@ -295,7 +299,6 @@ fn wait_until_log_line(expected_log_line: &str, log_file_path: &str, timeout: Du ...@@ -295,7 +299,6 @@ fn wait_until_log_line(expected_log_line: &str, log_file_path: &str, timeout: Du
} }
} }
} }
Ok(_) => {}
Err(err) => { Err(err) => {
eprintln!("Error: {:?}", err); eprintln!("Error: {:?}", err);
std::process::exit(1); std::process::exit(1);
......
...@@ -16,11 +16,10 @@ ...@@ -16,11 +16,10 @@
mod common; mod common;
use async_trait::async_trait;
use common::*; use common::*;
use cucumber::{given, then, when, FailureWriter, World, WorldInit}; use cucumber::StatsWriter;
use cucumber::{given, then, when, World};
use sp_keyring::AccountKeyring; use sp_keyring::AccountKeyring;
use std::convert::Infallible;
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
use std::sync::{ use std::sync::{
...@@ -31,7 +30,7 @@ use subxt::backend::rpc::RpcClient; ...@@ -31,7 +30,7 @@ use subxt::backend::rpc::RpcClient;
// ===== world ===== // ===== world =====
#[derive(WorldInit)] #[derive(cucumber::World, Default)]
pub struct DuniterWorld { pub struct DuniterWorld {
ignore_errors: bool, ignore_errors: bool,
inner: Option<DuniterWorldInner>, inner: Option<DuniterWorldInner>,
...@@ -130,19 +129,6 @@ impl std::fmt::Debug for DuniterWorld { ...@@ -130,19 +129,6 @@ impl std::fmt::Debug for DuniterWorld {
} }
} }
#[async_trait(?Send)]
impl World for DuniterWorld {
// We do require some error type.
type Error = Infallible;
async fn new() -> std::result::Result<Self, Infallible> {
Ok(Self {
ignore_errors: false,
inner: None,
})
}
}
struct DuniterWorldInner { struct DuniterWorldInner {
client: FullClient, client: FullClient,
process: Option<Process>, process: Option<Process>,
...@@ -594,19 +580,19 @@ async fn identity_status_should_be( ...@@ -594,19 +580,19 @@ async fn identity_status_should_be(
#[derive(clap::Args)] #[derive(clap::Args)]
struct CustomOpts { struct CustomOpts {
/// Keep running /// Keep running
#[clap(short, long)] #[arg(short, long)]
keep_running: bool, keep_running: bool,
/// Do not spawn a node, reuse expected node on port 9944 /// Do not spawn a node, reuse expected node on port 9944
#[clap(long)] #[arg(long)]
no_spawn: bool, no_spawn: bool,
/// For compliance with Jetbrains IDE which pushes extra args. /// For compliance with Jetbrains IDE which pushes extra args.
/// https://youtrack.jetbrains.com/issue/CPP-33071/cargo-test-adds-extra-options-which-conflict-with-Cucumber /// https://youtrack.jetbrains.com/issue/CPP-33071/cargo-test-adds-extra-options-which-conflict-with-Cucumber
#[clap(short, long)] #[arg(short, long)]
format: Option<String>, format: Option<String>,
#[clap(short, long = "show-output")] #[arg(short, long = "show-output")]
show_output: bool, show_output: bool,
#[clap(short = 'Z', long)] #[arg(short = 'Z', long)]
z: Option<String>, z: Option<String>,
} }
...@@ -650,7 +636,7 @@ async fn main() { ...@@ -650,7 +636,7 @@ async fn main() {
world.set_ignore_errors(ignore_errors(&scenario.tags)); world.set_ignore_errors(ignore_errors(&scenario.tags));
Box::pin(world.init(Some(genesis_conf_file_path), no_spawn)) Box::pin(world.init(Some(genesis_conf_file_path), no_spawn))
}) })
.after(move |_feature, _rule, _scenario, maybe_world| { .after(move |_feature, _rule, _scenario, _ev, maybe_world| {
if keep_running { if keep_running {
while running.load(Ordering::SeqCst) {} while running.load(Ordering::SeqCst) {}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment