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
153
Issues
153
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
3d3e0122
Commit
3d3e0122
authored
Jul 17, 2023
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to make testExceptions more predictable
parent
01994dee
Pipeline
#4398
passed with stages
in 10 minutes and 48 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
10 deletions
+14
-10
cabal.project.freeze
cabal.project.freeze
+1
-0
gargantext.cabal
gargantext.cabal
+1
-0
stack.yaml
stack.yaml
+1
-0
Jobs.hs
test/Utils/Jobs.hs
+11
-10
No files found.
cabal.project.freeze
View file @
3d3e0122
...
...
@@ -2019,6 +2019,7 @@ constraints: any.AC-Angle ==1.0,
any.record-hasfield ==1.0,
any.record-wrangler ==0.1.1.0,
any.records-sop ==0.1.1.0,
any.recover-rtti ==0.4.3,
any.recursion-schemes ==5.2.2.2,
any.reducers ==3.12.4,
any.ref-fd ==0.5,
...
...
gargantext.cabal
View file @
3d3e0122
...
...
@@ -922,6 +922,7 @@ test-suite garg-test
, patches-map
, quickcheck-instances
, raw-strings-qq
, recover-rtti
, servant-job
, stm
, tasty
...
...
stack.yaml
View file @
3d3e0122
...
...
@@ -124,6 +124,7 @@ extra-deps:
-
monoid-extras-0.5.1@sha256:438dbfd7b4dce47d8f0ca577f56caf94bd1e21391afa545cad09fe7cf2e5793d,2333
-
rake-0.0.1@sha256:3380f6567fb17505d1095b7f32222c0b631fa04126ad39726c84262da99c08b3,2025
-
random-1.2.1
-
recover-rtti-0.4.3
-
servant-cassava-0.10.1@sha256:07e7b6ca67cf57dcb4a0041a399a25d058844505837c6479e01d62be59d01fdf,1665
-
servant-ekg-0.3.1@sha256:19bd9dc3943983da8e79d6f607614c68faea4054fb889d508c8a2b67b6bdd448,2203
-
servant-flatten-0.2@sha256:276896f7c5cdec5b8f8493f6205fded0cc602d050b58fdb09a6d7c85c3bb0837,1234
...
...
test/Utils/Jobs.hs
View file @
3d3e0122
...
...
@@ -17,6 +17,7 @@ import Data.Either
import
Data.List
import
Data.Sequence
(
Seq
,
(
|>
),
fromList
)
import
Data.Time
import
Debug.RecoverRTTI
(
anythingToString
)
import
Prelude
import
System.IO.Unsafe
import
Network.HTTP.Client.TLS
(
newTlsManager
)
...
...
@@ -55,9 +56,8 @@ addJobToSchedule jobt mvar = do
data
Counts
=
Counts
{
countAs
::
Int
,
countBs
::
Int
}
deriving
(
Eq
,
Show
)
jobDuration
,
initialDelay
::
Int
jobDuration
::
Int
jobDuration
=
100000
initialDelay
=
20000
type
Timer
=
TVar
Bool
...
...
@@ -131,10 +131,10 @@ testMaxRunners = do
allSamples
<-
atomically
$
flushTQueue
samples
length
allSamples
`
shouldSatisfy
`
(
>
0
)
forM_
allSamples
$
\
runLog
->
annotate
"predicate to satisfy: (x
== [
\"
Job #1
\"
,
\"
Job #2
\"
] || x ==
[
\"
Job #3
\"
,
\"
Job #4
\"
]"
$
forM_
allSamples
$
\
runLog
->
do
annotate
"predicate to satisfy: (x
`isInfixOf` [
\"
Job #1
\"
,
\"
Job #2
\"
] || x `isInfixOf`
[
\"
Job #3
\"
,
\"
Job #4
\"
]"
$
shouldSatisfy
(
sort
runLog
)
(
\
x
->
x
==
[
"Job #1"
,
"Job #2"
]
||
x
==
[
"Job #3"
,
"Job #4"
])
(
\
x
->
x
`
isInfixOf
`
[
"Job #1"
,
"Job #2"
]
||
x
`
isInfixOf
`
[
"Job #3"
,
"Job #4"
])
testPrios
::
IO
()
testPrios
=
do
...
...
@@ -167,18 +167,19 @@ testPrios = do
testExceptions
::
IO
()
testExceptions
=
do
k
<-
genSecret
let
settings
=
defaultJobSettings
2
k
let
settings
=
defaultJobSettings
1
k
st
::
JobsState
JobT
[
String
]
()
<-
newJobsState
settings
defaultPrios
jid
<-
pushJob
A
()
(
\
_jHandle
_inp
_log
->
readFile
"/doesntexist.txt"
>>=
putStrLn
)
settings
st
threadDelay
initialDelay
-- Wait 1 second to make sure the job is finished.
threadDelay
$
1
_000_000
mjob
<-
lookupJob
jid
(
jobsData
st
)
case
mjob
of
Nothing
->
error
"boo
"
Nothing
->
fail
"lookupJob failed, job not found!
"
Just
je
->
case
jTask
je
of
DoneJ
_
r
->
isLeft
r
`
shouldBe
`
True
_
->
error
"boo2"
DoneJ
_
r
->
isLeft
r
`
shouldBe
`
True
unexpected
->
fail
$
"Expected job to be done, but got: "
<>
anythingToString
unexpected
return
()
testFairness
::
IO
()
...
...
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