Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
forks
lager
Commits
d6625df6
Commit
d6625df6
authored
8 years ago
by
Ted Burghart
Browse files
Options
Download
Email Patches
Plain Diff
Fixes another flappy test, this time lager_file_backend:trace_files_test_.
parent
48005453
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lager_file_backend.erl
+17
-3
src/lager_file_backend.erl
with
17 additions
and
3 deletions
+17
-3
src/lager_file_backend.erl
View file @
d6625df6
...
...
@@ -971,13 +971,27 @@ trace_files_test_() ->
re
:
split
(
BinInfo2
,
"
\n
"
,
[{
return
,
list
},
{
parts
,
2
}])),
?
assert
(
filelib
:
is_regular
(
Debug
)),
%% XXX Aughhhh, wish I could force this to flush somehow...
timer
:
sleep
(
1000
),
{
ok
,
BinInfo3
}
=
file
:
read_file
(
Debug
),
?
assertEqual
(
2
,
length
(
re
:
split
(
BinInfo3
,
"
\n
"
,
[{
return
,
list
},
trim
])))
% should take about 1 second, try for 3 ...
?
assertEqual
(
2
,
count_lines_until
(
2
,
add_secs
(
os
:
timestamp
(),
3
),
Debug
,
0
))
end
}
end
]}.
count_lines_until
(
Lines
,
Timeout
,
File
,
Last
)
->
case
timer
:
now_diff
(
Timeout
,
os
:
timestamp
())
>
0
of
true
->
timer
:
sleep
(
333
),
{
ok
,
Bin
}
=
file
:
read_file
(
File
),
case
erlang
:
length
(
re
:
split
(
Bin
,
"
\n
"
,
[{
return
,
list
},
trim
]))
of
Count
when
Count
<
Lines
->
count_lines_until
(
Lines
,
Timeout
,
File
,
Count
);
Count
->
Count
end
;
_
->
Last
end
.
formatting_test_
()
->
{
foreach
,
fun
()
->
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help