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
81f4a877
Commit
81f4a877
authored
1 year ago
by
Cédric Moreau
Committed by
Hugo Trentesaux
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(
!116
): rather use different impl for macOS
parent
ff8ac728
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!174
Resolve "Cucumber tests fail on Apple Silicon"
Pipeline
#32884
waiting for manual action
Stage: quality
Stage: build
Stage: tests
Stage: deploy
Changes
2
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
end2end-tests/Cargo.toml
+1
-0
1 addition, 0 deletions
end2end-tests/Cargo.toml
end2end-tests/tests/common/mod.rs
+44
-10
44 additions, 10 deletions
end2end-tests/tests/common/mod.rs
with
45 additions
and
10 deletions
end2end-tests/Cargo.toml
+
1
−
0
View file @
81f4a877
...
@@ -16,6 +16,7 @@ ctrlc = "3.2.2"
...
@@ -16,6 +16,7 @@ ctrlc = "3.2.2"
cucumber
=
"0.11"
cucumber
=
"0.11"
env_logger
=
"0.9.0"
env_logger
=
"0.9.0"
hex
=
"0.4"
hex
=
"0.4"
notify
=
"4.0"
parity-scale-codec
=
"3.1.5"
parity-scale-codec
=
"3.1.5"
portpicker
=
"0.1.1"
portpicker
=
"0.1.1"
serde_json
=
"1.0.64"
serde_json
=
"1.0.64"
...
...
This diff is collapsed.
Click to expand it.
end2end-tests/tests/common/mod.rs
+
44
−
10
View file @
81f4a877
...
@@ -220,18 +220,52 @@ fn spawn_full_node(
...
@@ -220,18 +220,52 @@ fn spawn_full_node(
}
}
fn
wait_until_log_line
(
expected_log_line
:
&
str
,
log_file_path
:
&
str
,
timeout
:
Duration
)
{
fn
wait_until_log_line
(
expected_log_line
:
&
str
,
log_file_path
:
&
str
,
timeout
:
Duration
)
{
let
start
=
Instant
::
now
();
if
cfg!
(
target_os
=
"macos"
)
{
loop
{
// MacOs seems to not be able to use inotify (buggy)
let
now
=
Instant
::
now
();
// So we use a specific implementation for `wait_until_log_line()` here
if
now
.duration_since
(
start
)
>
timeout
{
let
start
=
Instant
::
now
();
eprintln!
(
"Timeout starting node"
);
loop
{
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
));
}
}
if
has_log_line
(
log_file_path
,
expected_log_line
)
{
}
else
{
// Ready
let
(
tx
,
rx
)
=
std
::
sync
::
mpsc
::
channel
();
return
;
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
;
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
);
}
}
}
}
std
::
thread
::
sleep
(
Duration
::
from_millis
(
100
));
}
}
}
}
...
...
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