graphql-engine/server/tests-dc-api/Test/HealthSpec.hs
Daniel Chambers 3f405915e9 Added a healthcheck endpoint to the Data Connector Agent API spec
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4890
GitOrigin-RevId: 605408bddf03bef66eb03be8c242797e8fcf89bb
2022-06-30 08:37:53 +00:00

19 lines
766 B
Haskell

module Test.HealthSpec (spec) where
import Hasura.Backends.DataConnector.API (Config, Routes (..), SourceName)
import Servant.API (NamedRoutes, NoContent (..))
import Servant.Client (Client, (//))
import Test.Hspec (Spec, describe, it)
import Test.Hspec.Expectations.Pretty (shouldBe)
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