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
......@@ -9,24 +9,24 @@ repository = 'https://git.duniter.org/nodes/rust/duniter-v2s'
version = '3.0.0'
[dev-dependencies]
anyhow = "1.0"
async-trait = "0.1.74"
clap = { version = "3.2.23", features = ["derive", "cargo"] } # end2end cli refactoring need to upgrade to 4
ctrlc = "3.2.2"
cucumber = "0.11"
anyhow = "1.0.79"
clap = { version = "4.4.18", features = ["derive", "cargo"] }
ctrlc = "3.4.2"
cucumber = { version = "0.20.2", features = ["macros"] }
distance-oracle = { path = "../distance-oracle", default_features = false }
env_logger = "0.9.0"
env_logger = "0.11.1"
hex = "0.4.3"
notify = "4.0"
parity-scale-codec = "3.4.0"
notify = "6.1.1"
notify-debouncer-mini = "0.4.1"
parity-scale-codec = "3.6.9"
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-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-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"] }
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]]
name = "cucumber_tests"
......
......@@ -29,6 +29,7 @@ pub mod oneshot;
pub mod gdev {}
use anyhow::anyhow;
use notify_debouncer_mini::new_debouncer;
use parity_scale_codec::Encode;
use serde_json::Value;
use sp_keyring::AccountKeyring;
......@@ -274,16 +275,19 @@ fn wait_until_log_line(expected_log_line: &str, log_file_path: &str, timeout: Du
}
} else {
let (tx, rx) = std::sync::mpsc::channel();
let mut watcher = notify::watcher(tx, std::time::Duration::from_millis(100)).unwrap();
use notify::Watcher as _;
watcher
.watch(log_file_path, notify::RecursiveMode::NonRecursive)
let mut debouncer = new_debouncer(std::time::Duration::from_millis(100), tx).unwrap();
debouncer
.watcher()
.watch(
Path::new(log_file_path),
notify::RecursiveMode::NonRecursive,
)
.unwrap();
let mut pos = 0;
loop {
match rx.recv_timeout(timeout) {
Ok(notify::DebouncedEvent::Write(_)) => {
Ok(_) => {
let mut file = std::fs::File::open(log_file_path).unwrap();
file.seek(std::io::SeekFrom::Start(pos)).unwrap();
pos = file.metadata().unwrap().len();
......@@ -295,7 +299,6 @@ fn wait_until_log_line(expected_log_line: &str, log_file_path: &str, timeout: Du
}
}
}
Ok(_) => {}
Err(err) => {
eprintln!("Error: {:?}", err);
std::process::exit(1);
......
......@@ -16,11 +16,10 @@
mod common;
use async_trait::async_trait;
use common::*;
use cucumber::{given, then, when, FailureWriter, World, WorldInit};
use cucumber::StatsWriter;
use cucumber::{given, then, when, World};
use sp_keyring::AccountKeyring;
use std::convert::Infallible;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::{
......@@ -31,7 +30,7 @@ use subxt::backend::rpc::RpcClient;
// ===== world =====
#[derive(WorldInit)]
#[derive(cucumber::World, Default)]
pub struct DuniterWorld {
ignore_errors: bool,
inner: Option<DuniterWorldInner>,
......@@ -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 {
client: FullClient,
process: Option<Process>,
......@@ -594,19 +580,19 @@ async fn identity_status_should_be(
#[derive(clap::Args)]
struct CustomOpts {
/// Keep running
#[clap(short, long)]
#[arg(short, long)]
keep_running: bool,
/// Do not spawn a node, reuse expected node on port 9944
#[clap(long)]
#[arg(long)]
no_spawn: bool,
/// 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
#[clap(short, long)]
#[arg(short, long)]
format: Option<String>,
#[clap(short, long = "show-output")]
#[arg(short, long = "show-output")]
show_output: bool,
#[clap(short = 'Z', long)]
#[arg(short = 'Z', long)]
z: Option<String>,
}
......@@ -650,7 +636,7 @@ async fn main() {
world.set_ignore_errors(ignore_errors(&scenario.tags));
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 {
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