2022-06-30 11:36:54 +03:00
|
|
|
module Test.HealthSpec (spec) where
|
|
|
|
|
|
|
|
import Hasura.Backends.DataConnector.API (Config, Routes (..), SourceName)
|
|
|
|
import Servant.API (NamedRoutes, NoContent (..))
|
|
|
|
import Servant.Client (Client, (//))
|
2022-08-04 04:00:48 +03:00
|
|
|
import Test.Hspec (Spec, describe, it, shouldBe)
|
2022-06-30 11:36:54 +03:00
|
|
|
import Prelude
|
|
|
|
|
|
|
|
spec :: Client IO (NamedRoutes Routes) -> SourceName -> Config -> Spec
|
|
|
|
spec api sourceName config = describe "health API" $ do
|
|
|
|
it "returns a successful HTTP status code for a plain healthcheck" $ do
|
|
|
|
response <- (api // _health) Nothing Nothing
|
|
|
|
response `shouldBe` NoContent
|
|
|
|
|
|
|
|
it "returns a successful HTTP status code for a data source healthcheck" $ do
|
|
|
|
response <- (api // _health) (Just sourceName) (Just config)
|
|
|
|
response `shouldBe` NoContent
|