cleaned up deps, bad test config, improved Makefile

This commit is contained in:
Chris Allen 2014-05-15 08:43:46 -07:00
parent 7e4c91b2a3
commit 30028fc5aa
3 changed files with 8 additions and 17 deletions

View File

@ -5,6 +5,7 @@ install-with-test-support:
test:
echo "Make certain you have an elasticsearch instance on localhost:9200 !"
cabal clean
cabal test
build:

View File

@ -30,15 +30,11 @@ library
build-depends: base >= 4.3 && <5,
bytestring >= 0.10.2,
aeson >= 0.7,
aeson-pretty >= 0.7,
conduit >= 1.0,
http-conduit >= 2.0,
time >= 1.4,
text >= 0.11,
http-types >= 0.8,
blaze-builder >= 0.3,
unix >= 2.6,
scientific
http-types >= 0.8
default-language: Haskell2010
test-suite tests
@ -46,17 +42,13 @@ test-suite tests
default-extensions: OverloadedStrings
type: exitcode-stdio-1.0
main-is: tests.hs
-- ghc-options: -w -threaded -rtsopts -with-rtsopts=-N
hs-source-dirs: tests
build-depends: base,
bloodhound,
http-conduit,
http-types,
bytestring >= 0.10.2,
hspec >= 1.8,
text >= 0.11,
time >= 1.4,
aeson >= 0.7,
aeson-pretty >= 0.7,
random >= 1.0
aeson >= 0.7
default-language: Haskell2010

View File

@ -4,8 +4,6 @@ module Main where
import Database.Bloodhound
import Data.Aeson
-- import Data.Aeson.Encode.Pretty
-- import Data.ByteString.Lazy.Char8 (putStrLn)
import Data.Time.Calendar (Day(..))
import Data.Time.Clock (secondsToDiffTime, UTCTime(..))
import Data.Text (Text)
@ -18,7 +16,7 @@ import Test.Hspec
testServer :: Server
testServer = Server "http://localhost:9200"
testIndex :: IndexName
testIndex = IndexName "twitter"
testIndex = IndexName "bloodhound-tests-twitter-1"
testMapping :: MappingName
testMapping = MappingName "tweet"
@ -133,10 +131,10 @@ main = hspec $ do
_ <- insertData
let firstTest = BulkTest "blah"
let secondTest = BulkTest "bloo"
let firstDoc = BulkIndex (IndexName "twitter")
(MappingName "tweet") (DocId "2") (object ["name" .= String "blah"])
let secondDoc = BulkCreate (IndexName "twitter")
(MappingName "tweet") (DocId "3") (object ["name" .= String "bloo"])
let firstDoc = BulkIndex testIndex
testMapping (DocId "2") (object ["name" .= String "blah"])
let secondDoc = BulkCreate testIndex
testMapping (DocId "3") (object ["name" .= String "bloo"])
let stream = [firstDoc, secondDoc]
_ <- bulk testServer stream
_ <- refreshIndex testServer testIndex