Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
08993029
Commit
08993029
authored
1 year ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
fix(
!116
): remove notify lib for end2end tests
parent
47256e57
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
end2end-tests/Cargo.toml
+0
-1
0 additions, 1 deletion
end2end-tests/Cargo.toml
end2end-tests/tests/common/mod.rs
+25
-28
25 additions, 28 deletions
end2end-tests/tests/common/mod.rs
end2end-tests/tests/cucumber_tests.rs
+9
-0
9 additions, 0 deletions
end2end-tests/tests/cucumber_tests.rs
with
34 additions
and
29 deletions
end2end-tests/Cargo.toml
+
0
−
1
View file @
08993029
...
...
@@ -16,7 +16,6 @@ ctrlc = "3.2.2"
cucumber
=
"0.11"
env_logger
=
"0.9.0"
hex
=
"0.4"
notify
=
"4.0"
parity-scale-codec
=
"3.1.5"
portpicker
=
"0.1.1"
serde_json
=
"1.0.64"
...
...
This diff is collapsed.
Click to expand it.
end2end-tests/tests/common/mod.rs
+
25
−
28
View file @
08993029
...
...
@@ -33,9 +33,10 @@ use parity_scale_codec::Encode;
use
serde_json
::
Value
;
use
sp_keyring
::
AccountKeyring
;
use
std
::
io
::
prelude
::
*
;
use
std
::
path
::
PathBuf
;
use
std
::
path
::
{
Path
,
PathBuf
}
;
use
std
::
process
::
Command
;
use
std
::
str
::
FromStr
;
use
std
::
time
::{
Duration
,
Instant
};
use
subxt
::
ext
::{
sp_core
,
sp_runtime
};
use
subxt
::
rpc
::
rpc_params
;
use
subxt
::
tx
::
BaseExtrinsicParamsBuilder
;
...
...
@@ -224,36 +225,32 @@ fn spawn_full_node(
}
}
fn
wait_until_log_line
(
expected_log_line
:
&
str
,
log_file_path
:
&
str
,
timeout
:
std
::
time
::
Duration
)
{
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
)
.unwrap
();
let
mut
pos
=
0
;
fn
wait_until_log_line
(
expected_log_line
:
&
str
,
log_file_path
:
&
str
,
timeout
:
Duration
)
{
let
start
=
Instant
::
now
();
loop
{
match
rx
.recv_timeout
(
timeout
)
{
Ok
(
notify
::
DebouncedEvent
::
Write
(
_
))
=>
{
let
mut
file
=
std
::
fs
::
File
::
open
(
log_file_path
)
.unwrap
();
file
.seek
(
std
::
io
::
SeekFrom
::
Start
(
pos
))
.unwrap
();
pos
=
file
.metadata
()
.unwrap
()
.len
();
let
reader
=
std
::
io
::
BufReader
::
new
(
file
);
for
line
in
reader
.lines
()
{
if
line
.expect
(
"fail to read line"
)
.contains
(
expected_log_line
)
{
return
;
}
}
}
Ok
(
_
)
=>
{}
Err
(
err
)
=>
{
eprintln!
(
"Error: {:?}"
,
err
);
std
::
process
::
exit
(
1
);
}
let
now
=
Instant
::
now
();
if
now
.duration_since
(
start
)
>
timeout
{
eprintln!
(
"Timeout starting node"
);
std
::
process
::
exit
(
1
);
}
if
has_log_line
(
log_file_path
,
expected_log_line
)
{
// Ready
return
;
}
std
::
thread
::
sleep
(
Duration
::
from_millis
(
100
));
}
}
fn
has_log_line
(
log_file_path
:
&
str
,
expected_log_line
:
&
str
)
->
bool
{
let
mut
file
=
std
::
fs
::
File
::
open
(
log_file_path
)
.unwrap
();
file
.seek
(
std
::
io
::
SeekFrom
::
Start
(
0
))
.unwrap
();
let
reader
=
std
::
io
::
BufReader
::
new
(
file
);
for
line
in
reader
.lines
()
{
if
line
.expect
(
"fail to read line"
)
.contains
(
expected_log_line
)
{
return
true
;
}
}
false
}
pub
fn
spawn_distance_oracle
(
distance_oracle_binary_path
:
&
str
,
duniter_rpc_port
:
u16
)
{
...
...
This diff is collapsed.
Click to expand it.
end2end-tests/tests/cucumber_tests.rs
+
9
−
0
View file @
08993029
...
...
@@ -559,6 +559,15 @@ struct CustomOpts {
/// Keep running
#[clap(short,
long)]
keep_running
:
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)]
format
:
Option
<
String
>
,
#[clap(short,
long
=
"show-output"
)]
show_output
:
bool
,
#[clap(short
=
'Z'
,
long)]
z
:
Option
<
String
>
,
}
const
DOCKER_FEATURES_PATH
:
&
str
=
"/var/lib/duniter/cucumber-features"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment