Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Christian Merten
haskell-gargantext
Commits
c2531060
Commit
c2531060
authored
Sep 30, 2024
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Increase timeout (and better error reporting) in testMarkProgress
parent
45eff945
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
Jobs.hs
test/Test/Utils/Jobs.hs
+14
-5
No files found.
test/Test/Utils/Jobs.hs
View file @
c2531060
...
@@ -363,6 +363,7 @@ testMarkProgress = do
...
@@ -363,6 +363,7 @@ testMarkProgress = do
myEnv
<-
newTestEnv
myEnv
<-
newTestEnv
-- evts <- newTBQueueIO 7
-- evts <- newTBQueueIO 7
evts
<-
newTVarIO
[]
evts
<-
newTVarIO
[]
let
expectedEvents
=
7
let
getStatus
hdl
=
do
let
getStatus
hdl
=
do
liftIO
$
threadDelay
100
_000
liftIO
$
threadDelay
100
_000
st
<-
getLatestJobStatus
hdl
st
<-
getLatestJobStatus
hdl
...
@@ -371,15 +372,21 @@ testMarkProgress = do
...
@@ -371,15 +372,21 @@ testMarkProgress = do
readAllEvents
=
do
readAllEvents
=
do
-- We will get thread blocking if there is ANY error in the job
-- We will get thread blocking if there is ANY error in the job
-- Hence we assert the `readAllEvents` test doesn't take too long
-- Hence we assert the `readAllEvents` test doesn't take too long
mRet
<-
timeout
1
_000_000
$
atomically
$
do
mRet
<-
timeout
5
_000_000
$
atomically
$
do
-- allEventsArrived <- isFullTBQueue evts
-- allEventsArrived <- isFullTBQueue evts
evts'
<-
readTVar
evts
evts'
<-
readTVar
evts
-- STM retry if things failed
-- STM retry if things failed
-- check allEventsArrived
-- check allEventsArrived
check
(
length
evts'
==
7
)
check
(
length
evts'
==
expectedEvents
)
-- flushTBQueue evts
-- flushTBQueue evts
return
evts'
pure
evts'
return
$
fromMaybe
[]
mRet
case
mRet
of
Nothing
->
Prelude
.
fail
$
"testMarkProgress: timeout exceeded, but didn't receive all 7 required events."
Just
xs
|
length
xs
==
expectedEvents
->
pure
xs
|
otherwise
->
Prelude
.
fail
$
"testMarkProgress: received some events, but they were not of the expected number ("
<>
show
expectedEvents
<>
"): "
<>
show
xs
withJob_
myEnv
$
\
hdl
_input
->
do
withJob_
myEnv
$
\
hdl
_input
->
do
markStarted
10
hdl
markStarted
10
hdl
...
@@ -406,6 +413,8 @@ testMarkProgress = do
...
@@ -406,6 +413,8 @@ testMarkProgress = do
getStatus
hdl
getStatus
hdl
evts'
<-
readAllEvents
evts'
<-
readAllEvents
-- This pattern match should never fail, because the precondition is
-- checked in 'readAllEvents'.
let
[
jl0
,
jl1
,
jl2
,
jl3
,
jl4
,
jl5
,
jl6
]
=
evts'
let
[
jl0
,
jl1
,
jl2
,
jl3
,
jl4
,
jl5
,
jl6
]
=
evts'
-- Check the events are what we expect
-- Check the events are what we expect
...
...
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