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
151
Issues
151
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
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
gargantext
haskell-gargantext
Commits
68dbf45c
Commit
68dbf45c
authored
Mar 10, 2025
by
Alfredo Di Napoli
Committed by
Alfredo Di Napoli
Mar 26, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore timeout value for ping pong test
The bug is elsewhere.
parent
45037f2d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
Notifications.hs
test/Test/API/Notifications.hs
+3
-1
Worker.hs
test/Test/API/Worker.hs
+1
-1
Utils.hs
test/Test/Utils.hs
+5
-3
No files found.
test/Test/API/Notifications.hs
View file @
68dbf45c
...
@@ -211,7 +211,9 @@ checkNotification ctx@(SpecContext testEnv port _app _) act = do
...
@@ -211,7 +211,9 @@ checkNotification ctx@(SpecContext testEnv port _app _) act = do
act
authRes
act
authRes
waitForTChanValue
tchan
(
Just
$
DT
.
NUpdateTree
treeId
)
1
_000
-- Wait /up to/ 5 seconds for the notification value. This makes running the tests
-- a bit less flaky on CI, which might be slower to process the incoming notifications.
waitForTChanValue
tchan
(
Just
$
DT
.
NUpdateTree
treeId
)
5
_000
where
where
log_cfg
=
(
test_config
testEnv
)
^.
gc_logging
log_cfg
=
(
test_config
testEnv
)
^.
gc_logging
...
...
test/Test/API/Worker.hs
View file @
68dbf45c
...
@@ -56,7 +56,7 @@ tests = sequential $ aroundAll withTestDBAndPort $ do
...
@@ -56,7 +56,7 @@ tests = sequential $ aroundAll withTestDBAndPort $ do
withAsync
wsConnect
$
\
_a
->
do
withAsync
wsConnect
$
\
_a
->
do
_
<-
sendJobWithCfg
cfg
Ping
_
<-
sendJobWithCfg
cfg
Ping
mTimeout
<-
Timeout
.
timeout
(
60
*
1
_000_000
)
$
do
mTimeout
<-
Timeout
.
timeout
(
5
*
1
_000_000
)
$
do
md
<-
atomically
$
readTChan
tchan
md
<-
atomically
$
readTChan
tchan
md
`
shouldBe
`
Just
DT
.
NPing
md
`
shouldBe
`
Just
DT
.
NPing
...
...
test/Test/Utils.hs
View file @
68dbf45c
...
@@ -333,15 +333,17 @@ waitUntil pred' timeoutMs = do
...
@@ -333,15 +333,17 @@ waitUntil pred' timeoutMs = do
-- wait for given number of milliseconds for a given tchan value
-- wait for given number of milliseconds for a given tchan value
waitForTChanValue
::
(
HasCallStack
,
Eq
a
,
Show
a
)
=>
TChan
a
->
a
->
Int
->
IO
()
waitForTChanValue
::
(
HasCallStack
,
Eq
a
,
Show
a
)
=>
TChan
a
->
a
->
Int
->
IO
()
waitForTChanValue
tchan
expected
timeoutMs
=
do
waitForTChanValue
tchan
expected
timeoutMs
=
do
mTimeout
<-
Timeout
.
timeout
(
timeoutMs
*
1000
)
$
do
mTimeout
<-
Timeout
.
timeout
total_wait
$
do
v
<-
atomically
$
readTChan
tchan
v
<-
atomically
$
readTChan
tchan
unless
(
v
==
expected
)
$
panicTrace
$
"[waitForTChanValue] v != expected ("
<>
show
v
<>
" != "
<>
show
expected
<>
")"
unless
(
v
==
expected
)
$
panicTrace
$
"[waitForTChanValue] v != expected ("
<>
show
v
<>
" != "
<>
show
expected
<>
")"
-- v `shouldBe` expected
-- v `shouldBe` expected
-- no timeout should have occurred
-- no timeout should have occurred
-- mTimeout `shouldSatisfy` isJust
-- mTimeout `shouldSatisfy` isJust
when
(
isNothing
mTimeout
)
$
when
(
isNothing
mTimeout
)
$
panicTrace
$
"[waitForTChanValue] timeout when waiting for "
<>
show
expected
<>
" on tchan"
panicTrace
$
"[waitForTChanValue] timeout of "
<>
show
total_wait
<>
" milliseconds exhausted when waiting for "
<>
show
expected
<>
" on tchan"
where
total_wait
::
Int
total_wait
=
timeoutMs
*
1
_000
waitForTSem
::
HasCallStack
=>
TSem
->
Int
->
IO
()
waitForTSem
::
HasCallStack
=>
TSem
->
Int
->
IO
()
waitForTSem
tsem
timeoutMs
=
do
waitForTSem
tsem
timeoutMs
=
do
...
...
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