graphql-engine/server/tests-hspec/Test/ServiceLivenessSpec.hs
Antoine Leblanc dc4a286c64 Prepare test suite for remote servers tests
## Description

This PR adds all the scaffolding for tests that require remote servers. It is mostly a refactor of `Feature`; where we listed for each test a list of individual backends, we now provide a list of `Context`s, that allows for tests to specify not only how it should be setup, but also what state needs to be carried around throughout the test. This will be useful when launching custom remote servers.

Additionally, this PR:
- cleans the way we generate logs in the engine as part of the tests
- cleans the cabal file
- introduce a few more helpers for sending commands to the engine (such as `postMetadata_`)
- allows for headers in queries sent to the engine (to support permissions tests)
- adds basic code to start / stop a "remote" server

This PR is a pre-requisite of #3567.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3573
Co-authored-by: jkachmar <8461423+jkachmar@users.noreply.github.com>
GitOrigin-RevId: 05f808c6b85729dbb3ea6648c3e10a3c16b641ef
2022-02-14 17:25:28 +00:00

28 lines
1016 B
Haskell

-- | Service liveness tests: Confirm that the harness is working
-- properly. If this passes, the rest of the tests will pass.
module Test.ServiceLivenessSpec (spec) where
import Harness.Backend.Citus qualified as Citus
import Harness.Backend.Mysql qualified as Mysql
import Harness.Backend.Postgres qualified as Postgres
import Harness.Backend.Sqlserver qualified as Sqlserver
import Harness.GraphqlEngine qualified as GraphqlEngine
import Harness.Http qualified as Http
import Harness.State (State (State, server))
import Test.Hspec
import Prelude
spec :: SpecWith State
spec = do
ignoreSubject do
it "PostgreSQL liveness" $ shouldReturn Postgres.livenessCheck ()
it "MySQL liveness" $ shouldReturn Mysql.livenessCheck ()
it "SQLServer liveness" $ shouldReturn Sqlserver.livenessCheck ()
it "Citus liveness" $ shouldReturn Citus.livenessCheck ()
it
"graphql-engine liveness"
\State {server} ->
shouldReturn
(Http.healthCheck (GraphqlEngine.serverUrl server))
()