Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-pgmq
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
gargantext
haskell-pgmq
Commits
175e4b7d
Verified
Commit
175e4b7d
authored
Jul 09, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tests] integration tests work now
parent
cbde147c
Pipeline
#6357
failed with stages
in 13 minutes and 3 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
+21
-15
haskell-pgmq.cabal
haskell-pgmq.cabal
+2
-1
Broker.hs
tests/Test/Integration/Broker.hs
+4
-0
Simple.hs
tests/Test/Integration/PGMQ/Simple.hs
+15
-14
No files found.
haskell-pgmq.cabal
View file @
175e4b7d
...
@@ -211,7 +211,8 @@ test-suite test-pgmq-integration
...
@@ -211,7 +211,8 @@ test-suite test-pgmq-integration
type: exitcode-stdio-1.0
type: exitcode-stdio-1.0
other-modules: Test.Integration.PGMQ.Simple
other-modules: Test.Integration.Broker
, Test.Integration.PGMQ.Simple
build-depends: base ^>=4.17.2.0
build-depends: base ^>=4.17.2.0
, aeson >= 1.4 && < 2.3
, aeson >= 1.4 && < 2.3
...
...
tests/Test/Integration/Broker.hs
0 → 100644
View file @
175e4b7d
module
Test.Integration.Broker
-- ( brokerSpec )
where
tests/Test/Integration/PGMQ/Simple.hs
View file @
175e4b7d
...
@@ -45,12 +45,20 @@ withConn :: (TestEnv -> IO ()) -> IO ()
...
@@ -45,12 +45,20 @@ withConn :: (TestEnv -> IO ()) -> IO ()
withConn
=
bracket
setUpConn
dropConn
withConn
=
bracket
setUpConn
dropConn
withPGMQ
::
(
TestEnv
->
IO
()
)
->
IO
()
withPGMQ
::
(
TestEnv
->
IO
()
)
->
IO
()
withPGMQ
f
=
withConn
$
\
testEnv
->
bracket
(
setUpPGMQ
testEnv
)
(
\
_
->
pure
()
)
(
\
_
->
f
testEnv
)
withPGMQ
f
=
withConn
$
\
testEnv
->
bracket
(
setUpPGMQ
testEnv
)
(
tearDownPGMQ
testEnv
)
(
\
_
->
f
testEnv
)
where
where
setUpPGMQ
(
TestEnv
{
conn
,
queue
})
=
do
setUpPGMQ
(
TestEnv
{
conn
,
queue
})
=
do
PGMQ
.
initialize
conn
PGMQ
.
initialize
conn
-- TODO Uncomment when dropping a non-existing queue is safe
-- -- TODO Should be just PGMQ.dropQueue, but it raises errors currently
-- PGMQ.dropQueue conn queue
-- -- https://github.com/tembo-io/pgmq/issues/275
-- -- NOTE createQueue && purgeQueue aren't sufficient because
-- -- purgeQueue doesn't remove archived messages
-- PGMQ.createQueue conn queue
PGMQ
.
dropQueue
conn
queue
PGMQ
.
createQueue
conn
queue
tearDownPGMQ
(
TestEnv
{
conn
,
queue
})
_
=
do
PGMQ
.
dropQueue
conn
queue
pgmqSimpleTests
::
Spec
pgmqSimpleTests
::
Spec
...
@@ -63,18 +71,11 @@ pgmqSimpleTests = sequential $ aroundAll withPGMQ $ describe "PGMQ Simple" $ do
...
@@ -63,18 +71,11 @@ pgmqSimpleTests = sequential $ aroundAll withPGMQ $ describe "PGMQ Simple" $ do
-- metrics `shouldSatisfy` isNothing
-- metrics `shouldSatisfy` isNothing
it
"can get metrics for an empty queue"
$
\
(
TestEnv
{
conn
,
queue
})
->
do
it
"can get metrics for an empty queue"
$
\
(
TestEnv
{
conn
,
queue
})
->
do
-- Create if it doesn't exist
PGMQ
.
createQueue
conn
queue
-- Drop since we're sure it exists now
PGMQ
.
dropQueue
conn
queue
-- Now it's empty
PGMQ
.
createQueue
conn
queue
metrics
<-
PGMQ
.
getMetrics
conn
queue
metrics
<-
PGMQ
.
getMetrics
conn
queue
metrics
`
shouldSatisfy
`
isJust
metrics
`
shouldSatisfy
`
isJust
(
PGMQ
.
queueLength
<$>
metrics
)
`
shouldBe
`
(
Just
0
)
(
PGMQ
.
queueLength
<$>
metrics
)
`
shouldBe
`
(
Just
0
)
-- let (Just (PGMQ.Metrics { .. })) = metrics
-- queueName `shouldBe` queue
-- totalMessages `shouldBe` 0
it
"listQueues properly returns our queue"
$
\
(
TestEnv
{
conn
,
queue
})
->
do
queues
<-
PGMQ
.
listQueues
conn
((
\
(
PGMQ
.
QueueInfo
{
queueName
})
->
queueName
)
<$>
queues
)
`
shouldContain
`
[
queue
]
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