ci nonsense
This commit is contained in:
parent
56e0d7afe7
commit
776d15a8fb
2
.github/workflows/haskell.yml
vendored
2
.github/workflows/haskell.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
MYSQL_DATABASE: esqutest
|
MYSQL_DATABASE: esqutest
|
||||||
## map the "external" 33306 port with the "internal" 3306
|
## map the "external" 33306 port with the "internal" 3306
|
||||||
ports:
|
ports:
|
||||||
- 3306:3306
|
- 33306:3306
|
||||||
# Set health checks to wait until mysql database has started (it takes some seconds to start)
|
# Set health checks to wait until mysql database has started (it takes some seconds to start)
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd="mysqladmin ping"
|
--health-cmd="mysqladmin ping"
|
||||||
|
|||||||
@ -237,12 +237,39 @@ migrateIt = do
|
|||||||
|
|
||||||
|
|
||||||
withConn :: RunDbMonad m => (SqlBackend -> R.ResourceT m a) -> m a
|
withConn :: RunDbMonad m => (SqlBackend -> R.ResourceT m a) -> m a
|
||||||
withConn =
|
withConn f = do
|
||||||
R.runResourceT .
|
ci <- isCI
|
||||||
withMySQLConn defaultConnectInfo
|
let connInfo
|
||||||
{ connectHost = "localhost"
|
| ci =
|
||||||
, connectUser = "travis"
|
defaultConnectInfo
|
||||||
, connectPassword = "esqutest"
|
{ connectHost = "localhost"
|
||||||
, connectDatabase = "esqutest"
|
, connectUser = "travis"
|
||||||
, connectPort = 3306
|
, connectPassword = "esqutest"
|
||||||
}
|
, connectDatabase = "esqutest"
|
||||||
|
, connectPort = 33306
|
||||||
|
}
|
||||||
|
| otherwise =
|
||||||
|
defaultConnectInfo
|
||||||
|
{ connectHost = "localhost"
|
||||||
|
, connectUser = "travis"
|
||||||
|
, connectPassword = "esqutest"
|
||||||
|
, connectDatabase = "esqutest"
|
||||||
|
, connectPort = 3306
|
||||||
|
}
|
||||||
|
R.runResourceT $
|
||||||
|
withMySQLConn defaultConnectInfo
|
||||||
|
{ connectHost = "localhost"
|
||||||
|
, connectUser = "travis"
|
||||||
|
, connectPassword = "esqutest"
|
||||||
|
, connectDatabase = "esqutest"
|
||||||
|
, connectPort = 3306
|
||||||
|
}
|
||||||
|
f
|
||||||
|
|
||||||
|
isCI :: IO Bool
|
||||||
|
isCI = do
|
||||||
|
env <- liftIO getEnvironment
|
||||||
|
return $ case lookup "TRAVIS" env <|> lookup "CI" env of
|
||||||
|
Just "true" -> True
|
||||||
|
_ -> False
|
||||||
|
|
||||||
|
|||||||
@ -898,7 +898,7 @@ testConcatenationOperator =
|
|||||||
|
|
||||||
testMinusOperator :: Spec
|
testMinusOperator :: Spec
|
||||||
testMinusOperator =
|
testMinusOperator =
|
||||||
fdescribe "Minus Operator" $ do
|
describe "Minus Operator" $ do
|
||||||
it "creates sane SQL" $ do
|
it "creates sane SQL" $ do
|
||||||
let obj = object ["a" .= False, "b" .= True]
|
let obj = object ["a" .= False, "b" .= True]
|
||||||
encoded = BSL.toStrict $ encode obj
|
encoded = BSL.toStrict $ encode obj
|
||||||
@ -919,21 +919,21 @@ testMinusOperator =
|
|||||||
, PersistInt64 0
|
, PersistInt64 0
|
||||||
]
|
]
|
||||||
it "works as expected" $ run $ do
|
it "works as expected" $ run $ do
|
||||||
x <- selectJSON $ \v -> do
|
x <- selectJSON $ \v -> do
|
||||||
where_ $ v @>. jsonbVal (toJSON ([] :: [Int]))
|
where_ $ v @>. jsonbVal (toJSON ([] :: [Int]))
|
||||||
where_ $ v JSON.-. 0 @>. jsonbVal (toJSON [Bool True])
|
where_ $ v JSON.-. 0 @>. jsonbVal (toJSON [Bool True])
|
||||||
y <- selectJSON $ \v -> do
|
y <- selectJSON $ \v -> do
|
||||||
where_ $ v @>. jsonbVal (toJSON ([] :: [Int]))
|
where_ $ v @>. jsonbVal (toJSON ([] :: [Int]))
|
||||||
where_ $ v JSON.-. (-1) @>. jsonbVal (toJSON [Null])
|
where_ $ v JSON.-. (-1) @>. jsonbVal (toJSON [Null])
|
||||||
z <- selectJSON_ $ \v -> v JSON.-. "b" ?&. ["a", "b"]
|
z <- selectJSON_ $ \v -> v JSON.-. "b" ?&. ["a", "b"]
|
||||||
w <- selectJSON_ $ \v -> do
|
w <- selectJSON_ $ \v -> do
|
||||||
v JSON.-. "test" @>. jsonbVal (toJSON [String "test"])
|
v JSON.-. "test" @>. jsonbVal (toJSON [String "test"])
|
||||||
liftIO $ length x `shouldBe` 2
|
liftIO $ length x `shouldBe` 2
|
||||||
liftIO $ length y `shouldBe` 1
|
liftIO $ length y `shouldBe` 1
|
||||||
liftIO $ length z `shouldBe` 0
|
liftIO $ length z `shouldBe` 0
|
||||||
liftIO $ length w `shouldBe` 0
|
liftIO $ length w `shouldBe` 0
|
||||||
sqlFailWith "22023" $ selectJSONwhere $ \v ->
|
sqlFailWith "22023" $ selectJSONwhere $ \v ->
|
||||||
v JSON.-. 0 @>. jsonbVal (toJSON ([] :: [Int]))
|
v JSON.-. 0 @>. jsonbVal (toJSON ([] :: [Int]))
|
||||||
where
|
where
|
||||||
selectJSON_ f = selectJSON $ \v -> do
|
selectJSON_ f = selectJSON $ \v -> do
|
||||||
where_
|
where_
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user