Add cockroach to default and on_conflict tests

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6412
GitOrigin-RevId: 637abad70096a06c39a13b9c8683444e2bebdecf
This commit is contained in:
Gil Mizrahi 2022-10-18 22:47:14 +03:00 committed by hasura-bot
parent bf87246126
commit 666f34d564
5 changed files with 17 additions and 7 deletions

View File

@ -47,6 +47,7 @@ executable api-tests
TypeFamilies TypeFamilies
hs-source-dirs: test hs-source-dirs: test
default-language: Haskell2010
-- Turning off optimizations is intentional; tests aren't -- Turning off optimizations is intentional; tests aren't
-- performance sensitive and waiting for compilation is a problem. -- performance sensitive and waiting for compilation is a problem.

View File

@ -9,6 +9,7 @@ module Test.Postgres.DefaultValuesSpec (spec) where
import Data.Aeson (Value) import Data.Aeson (Value)
import Data.List.NonEmpty qualified as NE import Data.List.NonEmpty qualified as NE
import Harness.Backend.Citus qualified as Citus import Harness.Backend.Citus qualified as Citus
import Harness.Backend.Cockroach qualified as Cockroach
import Harness.Backend.Postgres qualified as Postgres import Harness.Backend.Postgres qualified as Postgres
import Harness.GraphqlEngine (postGraphql) import Harness.GraphqlEngine (postGraphql)
import Harness.Quoter.Graphql (graphql) import Harness.Quoter.Graphql (graphql)
@ -33,6 +34,11 @@ spec =
{ Fixture.setupTeardown = \(testEnv, _) -> { Fixture.setupTeardown = \(testEnv, _) ->
[ Citus.setupTablesAction schema testEnv [ Citus.setupTablesAction schema testEnv
] ]
},
(Fixture.fixture $ Fixture.Backend Fixture.Cockroach)
{ Fixture.setupTeardown = \(testEnv, _) ->
[ Cockroach.setupTablesAction schema testEnv
]
} }
] ]
) )

View File

@ -8,6 +8,7 @@ import Data.Aeson (Value)
import Data.List.NonEmpty qualified as NE import Data.List.NonEmpty qualified as NE
import Data.Text.Encoding (encodeUtf8) import Data.Text.Encoding (encodeUtf8)
import Harness.Backend.Citus qualified as Citus import Harness.Backend.Citus qualified as Citus
import Harness.Backend.Cockroach qualified as Cockroach
import Harness.Backend.Postgres qualified as Postgres import Harness.Backend.Postgres qualified as Postgres
import Harness.GraphqlEngine (postGraphqlWithHeaders) import Harness.GraphqlEngine (postGraphqlWithHeaders)
import Harness.Quoter.Graphql (graphql) import Harness.Quoter.Graphql (graphql)
@ -37,6 +38,12 @@ spec = do
[ Citus.setupTablesAction schema testEnvironment, [ Citus.setupTablesAction schema testEnvironment,
Citus.setupPermissionsAction (permissions "citus") testEnvironment Citus.setupPermissionsAction (permissions "citus") testEnvironment
] ]
},
(Fixture.fixture $ Fixture.Backend BackendType.Cockroach)
{ Fixture.setupTeardown = \(testEnvironment, _) ->
[ Cockroach.setupTablesAction schema testEnvironment,
Cockroach.setupPermissionsAction (permissions "cockroach") testEnvironment
]
} }
] ]
) )

View File

@ -1,6 +0,0 @@
module Harness.Spec where
import Harness.GraphqlEngine (Server)
import Test.Hspec
type Subject = Server

View File

@ -262,7 +262,9 @@ defaultSerialType =
{ bstMysql = Nothing, { bstMysql = Nothing,
bstMssql = Just "INT IDENTITY(1,1)", bstMssql = Just "INT IDENTITY(1,1)",
bstCitus = Just "SERIAL", bstCitus = Just "SERIAL",
bstCockroach = Just "SERIAL", -- cockroachdb's serial behaves differently than postgresql's serial:
-- https://www.cockroachlabs.com/docs/v22.1/serial
bstCockroach = Just "INT4 GENERATED BY DEFAULT AS IDENTITY",
bstPostgres = Just "SERIAL", bstPostgres = Just "SERIAL",
bstBigQuery = Nothing bstBigQuery = Nothing
} }