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
199
Issues
199
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
3735bef1
Commit
3735bef1
authored
Sep 30, 2025
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix loopy-import test
Account for the fact we can now import ngrams terms containing loops.
parent
0426c9f1
Pipeline
#7948
passed with stages
in 53 minutes and 56 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
UpdateList.hs
test/Test/API/UpdateList.hs
+6
-6
Instances.hs
test/Test/Instances.hs
+7
-3
No files found.
test/Test/API/UpdateList.hs
View file @
3735bef1
...
...
@@ -611,8 +611,8 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do
liftIO
$
exportedNgrams
`
shouldBe
`
exportedNgrams2
-- We test that if we try to import terms which, when merged with the existing,
-- would cause a loop
, GGTX is capable of reject
ing the request.
it
"
refuses to import terms which will lead to a loop
"
$
\
(
SpecContext
testEnv
port
app
_
)
->
do
-- would cause a loop
but GGTX is capable of breaking them, serv
ing the request.
it
"
allows importing terms which will lead to a loop (because it can break them)
"
$
\
(
SpecContext
testEnv
port
app
_
)
->
do
cId
<-
newCorpusForUser
testEnv
"alice"
let
log_cfg
=
(
test_config
testEnv
)
^.
gc_logging
withApplication
app
$
do
...
...
@@ -685,14 +685,14 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do
}
ji
<-
checkEither
$
liftIO
$
runClientM
(
add_form_to_list
token
listId
params
)
clientEnv
ji'
<-
pollUntilWorkFinished
log_cfg
port
ji
-- Unfortunately we don't have a better way then to match on the stringified exception, sigh.
case
_scst_events
ji'
of
Just
[
ScraperEvent
{
..
}]
|
Just
msg
<-
_scev_message
->
liftIO
$
msg
`
shouldSatisfy
`
\
txt
->
"Loop detected in terms: foo -> bar -> foo"
`
T
.
isInfixOf
`
txt
,
"Loop detected in terms: foo -> bar -> foo"
`
T
.
isInfixOf
`
msg
->
fail
(
T
.
unpack
msg
)
|
otherwise
->
fail
"No suitable message in ScraperEvent."
_
->
fail
"Expected job to fail, but it didn't"
->
pure
()
-- no loop!
_
->
pure
()
-- no loop!
createDocsList
::
FilePath
->
TestEnv
...
...
test/Test/Instances.hs
View file @
3735bef1
...
...
@@ -13,6 +13,7 @@ Portability : POSIX
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}
module
Test.Instances
where
...
...
@@ -772,9 +773,12 @@ genCorpusWithMatchingElement = do
el
<-
over
ne_children
(
breakLoop
trm
)
.
makeItRoot
<$>
(
resize
depth
arbitrary
)
pure
(
trm
,
el
{
_ne_ngrams
=
trm
})
-- Let's build the map first, so that duplicates will be overwritten.
fullMap
<-
(
Map
.
fromList
<$>
vectorOf
depth
mkEntry
)
`
suchThat
`
(
\
x
->
isRight
(
buildForest
(
BreakLoop
LBA_just_do_it
)
x
))
-- exclude loops
let
(
hd
NE
.:|
_
)
=
NE
.
fromList
$
Map
.
elems
fullMap
pure
$
AcyclicTableMap
fullMap
hd
fullMapE
<-
buildForest
(
BreakLoop
LBA_just_do_it
)
.
Map
.
fromList
<$>
vectorOf
depth
mkEntry
case
fullMapE
of
Left
e
->
panicTrace
(
show
e
)
Right
(
destroyForest
->
fullMap
)
->
do
let
(
hd
NE
.:|
_
)
=
NE
.
fromList
$
map
snd
fullMap
pure
$
AcyclicTableMap
(
Map
.
fromList
fullMap
)
hd
where
breakLoop
::
NgramsTerm
->
MSet
NgramsTerm
->
MSet
NgramsTerm
breakLoop
t
=
mSetFromSet
.
Set
.
delete
t
.
mSetToSet
...
...
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