Add big test
This commit is contained in:
parent
5e72c8ad61
commit
0038e4163c
2 changed files with 14 additions and 0 deletions
|
@ -67,6 +67,7 @@ test-suite test
|
||||||
-- now. It's too difficult to support old versions of GHC and
|
-- now. It's too difficult to support old versions of GHC and
|
||||||
-- the new version of time.
|
-- the new version of time.
|
||||||
, old-locale
|
, old-locale
|
||||||
|
, text
|
||||||
, time
|
, time
|
||||||
|
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
|
@ -5,6 +5,8 @@ module QuerySpec (spec) where
|
||||||
import TestImport
|
import TestImport
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
|
|
||||||
|
import qualified Data.Text as T
|
||||||
|
|
||||||
testDBName :: Database
|
testDBName :: Database
|
||||||
testDBName = "mongodb-haskell-test"
|
testDBName = "mongodb-haskell-test"
|
||||||
|
|
||||||
|
@ -122,6 +124,17 @@ spec = around withCleanDatabase $ do
|
||||||
it "raises exception" $
|
it "raises exception" $
|
||||||
insertDuplicateWith insertAll_ `shouldThrow` anyException
|
insertDuplicateWith insertAll_ `shouldThrow` anyException
|
||||||
|
|
||||||
|
describe "insertAll_" $ do
|
||||||
|
it "inserts documents and receives 100 000 of them" $ do
|
||||||
|
let docs = (flip map) [0..200000] $ \i ->
|
||||||
|
["name" =: (T.pack $ "name " ++ (show i))]
|
||||||
|
db $ insertAll_ "bigCollection" docs
|
||||||
|
db $ do
|
||||||
|
cur <- find $ (select [] "bigCollection") {limit = 100000, batchSize = 100000}
|
||||||
|
returnedDocs <- rest cur
|
||||||
|
|
||||||
|
liftIO $ (length returnedDocs) `shouldBe` 100000
|
||||||
|
|
||||||
describe "aggregate" $ do
|
describe "aggregate" $ do
|
||||||
it "aggregates to normalize and sort documents" $ do
|
it "aggregates to normalize and sort documents" $ do
|
||||||
db $ insertAll_ "users" [ ["_id" =: "jane", "joined" =: parseDate "2011-03-02", "likes" =: ["golf", "racquetball"]]
|
db $ insertAll_ "users" [ ["_id" =: "jane", "joined" =: parseDate "2011-03-02", "likes" =: ["golf", "racquetball"]]
|
||||||
|
|
Loading…
Reference in a new issue