mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
[server/tests] remove unnecessary cleanup
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7157 GitOrigin-RevId: 93dc285c8629586336e56bb1622d94af0faa3e0e
This commit is contained in:
parent
392ecf72b3
commit
aa9499ee0e
@ -13,6 +13,7 @@ import Harness.Quoter.Yaml (interpolateYaml, yaml)
|
||||
import Harness.Test.Fixture qualified as Fixture
|
||||
import Harness.Test.Schema (SchemaName (..), Table (..), table)
|
||||
import Harness.Test.Schema qualified as Schema
|
||||
import Harness.Test.SetupAction qualified as SetupAction
|
||||
import Harness.TestEnvironment (GlobalTestEnvironment, TestEnvironment)
|
||||
import Harness.Yaml (shouldReturnYaml)
|
||||
import Hasura.Prelude
|
||||
@ -67,64 +68,52 @@ setupFunctions :: TestEnvironment -> [Fixture.SetupAction]
|
||||
setupFunctions testEnv =
|
||||
let schemaName = Schema.getSchemaName testEnv
|
||||
articleTableSQL = unSchemaName schemaName <> ".article"
|
||||
in [ Fixture.SetupAction
|
||||
{ Fixture.setupAction =
|
||||
BigQuery.run_ $
|
||||
T.unpack $
|
||||
T.unwords $
|
||||
[ "CREATE TABLE FUNCTION ",
|
||||
fetch_articles_returns_table schemaName,
|
||||
"(a_id INT64, search STRING)",
|
||||
"RETURNS TABLE<id INT64, title STRING, content STRING>",
|
||||
"AS (",
|
||||
"SELECT t.id, t.title, t.content FROM",
|
||||
articleTableSQL,
|
||||
"AS t WHERE t.author_id = a_id and (t.title LIKE `search` OR t.content LIKE `search`)",
|
||||
");"
|
||||
],
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
},
|
||||
Fixture.SetupAction
|
||||
{ Fixture.setupAction =
|
||||
BigQuery.run_ $
|
||||
T.unpack $
|
||||
T.unwords $
|
||||
[ "CREATE TABLE FUNCTION ",
|
||||
fetch_articles schemaName,
|
||||
"(a_id INT64, search STRING)",
|
||||
"AS (",
|
||||
"SELECT t.* FROM",
|
||||
articleTableSQL,
|
||||
"AS t WHERE t.author_id = a_id and (t.title LIKE `search` OR t.content LIKE `search`)",
|
||||
");"
|
||||
],
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
},
|
||||
Fixture.SetupAction
|
||||
{ Fixture.setupAction =
|
||||
BigQuery.run_ $
|
||||
T.unpack $
|
||||
T.unwords $
|
||||
[ "CREATE TABLE FUNCTION ",
|
||||
function_no_args schemaName <> "()",
|
||||
"AS (",
|
||||
"SELECT t.* FROM",
|
||||
articleTableSQL,
|
||||
"AS t);"
|
||||
],
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
},
|
||||
Fixture.SetupAction
|
||||
{ Fixture.setupAction =
|
||||
BigQuery.run_ $
|
||||
T.unpack $
|
||||
T.unwords $
|
||||
[ "CREATE FUNCTION ",
|
||||
add_int schemaName <> "(a INT64, b INT64)",
|
||||
"RETURNS INT64 AS (a + b);"
|
||||
],
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
in [ SetupAction.noTeardown $
|
||||
BigQuery.run_ $
|
||||
T.unpack $
|
||||
T.unwords $
|
||||
[ "CREATE TABLE FUNCTION ",
|
||||
fetch_articles_returns_table schemaName,
|
||||
"(a_id INT64, search STRING)",
|
||||
"RETURNS TABLE<id INT64, title STRING, content STRING>",
|
||||
"AS (",
|
||||
"SELECT t.id, t.title, t.content FROM",
|
||||
articleTableSQL,
|
||||
"AS t WHERE t.author_id = a_id and (t.title LIKE `search` OR t.content LIKE `search`)",
|
||||
");"
|
||||
],
|
||||
SetupAction.noTeardown $
|
||||
BigQuery.run_ $
|
||||
T.unpack $
|
||||
T.unwords $
|
||||
[ "CREATE TABLE FUNCTION ",
|
||||
fetch_articles schemaName,
|
||||
"(a_id INT64, search STRING)",
|
||||
"AS (",
|
||||
"SELECT t.* FROM",
|
||||
articleTableSQL,
|
||||
"AS t WHERE t.author_id = a_id and (t.title LIKE `search` OR t.content LIKE `search`)",
|
||||
");"
|
||||
],
|
||||
SetupAction.noTeardown $
|
||||
BigQuery.run_ $
|
||||
T.unpack $
|
||||
T.unwords $
|
||||
[ "CREATE TABLE FUNCTION ",
|
||||
function_no_args schemaName <> "()",
|
||||
"AS (",
|
||||
"SELECT t.* FROM",
|
||||
articleTableSQL,
|
||||
"AS t);"
|
||||
],
|
||||
SetupAction.noTeardown $
|
||||
BigQuery.run_ $
|
||||
T.unpack $
|
||||
T.unwords $
|
||||
[ "CREATE FUNCTION ",
|
||||
add_int schemaName <> "(a INT64, b INT64)",
|
||||
"RETURNS INT64 AS (a + b);"
|
||||
]
|
||||
]
|
||||
|
||||
fetch_articles_returns_table :: SchemaName -> T.Text
|
||||
|
@ -7,6 +7,7 @@ import Harness.Backend.Postgres qualified as Postgres
|
||||
import Harness.Test.Fixture qualified as Fixture
|
||||
import Harness.Test.Schema
|
||||
import Harness.Test.Schema qualified as Schema
|
||||
import Harness.Test.SetupAction qualified as SetupAction
|
||||
import Harness.TestEnvironment (GlobalTestEnvironment, TestEnvironment (..))
|
||||
import Hasura.Prelude
|
||||
import Test.Hspec
|
||||
@ -53,24 +54,21 @@ schema =
|
||||
functionSetup :: TestEnvironment -> Fixture.SetupAction
|
||||
functionSetup testEnvironment =
|
||||
let schemaName = T.unpack $ unSchemaName (getSchemaName testEnvironment)
|
||||
in Fixture.SetupAction
|
||||
{ setupAction =
|
||||
Postgres.run_ testEnvironment $
|
||||
"CREATE FUNCTION "
|
||||
++ schemaName
|
||||
++ ".authors(author_row "
|
||||
++ schemaName
|
||||
++ ".author) \
|
||||
\RETURNS SETOF "
|
||||
++ schemaName
|
||||
++ ".author AS $$ \
|
||||
\ SELECT * \
|
||||
\ FROM "
|
||||
++ schemaName
|
||||
++ ".author \
|
||||
\$$ LANGUAGE sql STABLE;",
|
||||
teardownAction = \_ -> Postgres.run_ testEnvironment $ "DROP FUNCTION " ++ schemaName ++ ".authors;"
|
||||
}
|
||||
in SetupAction.noTeardown $
|
||||
Postgres.run_ testEnvironment $
|
||||
"CREATE FUNCTION "
|
||||
++ schemaName
|
||||
++ ".authors(author_row "
|
||||
++ schemaName
|
||||
++ ".author) \
|
||||
\RETURNS SETOF "
|
||||
++ schemaName
|
||||
++ ".author AS $$ \
|
||||
\ SELECT * \
|
||||
\ FROM "
|
||||
++ schemaName
|
||||
++ ".author \
|
||||
\$$ LANGUAGE sql STABLE;"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Tests
|
||||
|
@ -48,6 +48,7 @@ import Harness.RemoteServer qualified as RemoteServer
|
||||
import Harness.Test.Fixture qualified as Fixture
|
||||
import Harness.Test.Schema (Table (..), table)
|
||||
import Harness.Test.Schema qualified as Schema
|
||||
import Harness.Test.SetupAction qualified as SetupAction
|
||||
import Harness.Test.TestResource (Managed)
|
||||
import Harness.TestEnvironment (Server, TestEnvironment, stopServer)
|
||||
import Hasura.Prelude
|
||||
@ -75,14 +76,8 @@ dbTodbRemoteRelationshipFixture =
|
||||
{ Fixture.setupAction = rhsPostgresSetup testEnvironment,
|
||||
Fixture.teardownAction = \_ -> rhsPostgresTeardown testEnvironment
|
||||
},
|
||||
Fixture.SetupAction
|
||||
{ Fixture.setupAction = lhsPostgresSetup (testEnvironment, Nothing),
|
||||
Fixture.teardownAction = \_ -> lhsPostgresTeardown testEnvironment
|
||||
},
|
||||
Fixture.SetupAction
|
||||
{ Fixture.setupAction = createSourceRemoteRelationship testEnvironment,
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
SetupAction.noTeardown (lhsPostgresSetup (testEnvironment, Nothing)),
|
||||
SetupAction.noTeardown (createSourceRemoteRelationship testEnvironment)
|
||||
]
|
||||
}
|
||||
|
||||
@ -98,14 +93,8 @@ dbToRemoteSchemaRemoteRelationshipFixture =
|
||||
{ Fixture.setupAction = rhsRemoteServerSetup (testEnvironment, rhsServer),
|
||||
Fixture.teardownAction = \_ -> rhsRemoteServerTeardown (testEnvironment, rhsServer)
|
||||
},
|
||||
Fixture.SetupAction
|
||||
{ Fixture.setupAction = lhsPostgresSetup (testEnvironment, Nothing),
|
||||
Fixture.teardownAction = \_ -> lhsPostgresTeardown testEnvironment
|
||||
},
|
||||
Fixture.SetupAction
|
||||
{ Fixture.setupAction = createRemoteSchemaRemoteRelationship testEnvironment,
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
SetupAction.noTeardown (lhsPostgresSetup (testEnvironment, Nothing)),
|
||||
SetupAction.noTeardown (createRemoteSchemaRemoteRelationship testEnvironment)
|
||||
]
|
||||
}
|
||||
|
||||
@ -277,9 +266,6 @@ args:
|
||||
id: artist_id
|
||||
|]
|
||||
|
||||
lhsPostgresTeardown :: TestEnvironment -> IO ()
|
||||
lhsPostgresTeardown testEnvironment = Postgres.dropTable testEnvironment track
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- DB to Remote Schema Remote relationship
|
||||
|
||||
|
@ -39,6 +39,7 @@ import Harness.Test.Permissions (SelectPermissionDetails (..))
|
||||
import Harness.Test.Permissions qualified as Permissions
|
||||
import Harness.Test.Schema (Table (..))
|
||||
import Harness.Test.Schema qualified as Schema
|
||||
import Harness.Test.SetupAction qualified as SetupAction
|
||||
import Harness.Test.TestResource (Managed)
|
||||
import Harness.TestEnvironment (GlobalTestEnvironment, Server, TestEnvironment, stopServer)
|
||||
import Harness.Yaml (shouldBeYaml, shouldReturnYaml)
|
||||
@ -64,10 +65,7 @@ lhsPostgres tableName =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Postgres)
|
||||
{ Fixture.mkLocalTestEnvironment = \_ -> pure Nothing,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = lhsPostgresSetup tableName testEnv,
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
[ SetupAction.noTeardown (lhsPostgresSetup tableName testEnv)
|
||||
]
|
||||
}
|
||||
|
||||
@ -76,10 +74,7 @@ lhsCitus tableName =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Citus)
|
||||
{ Fixture.mkLocalTestEnvironment = \_ -> pure Nothing,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = lhsCitusSetup tableName testEnv,
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
[ SetupAction.noTeardown (lhsCitusSetup tableName testEnv)
|
||||
]
|
||||
}
|
||||
|
||||
@ -88,10 +83,7 @@ lhsCockroach tableName =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Cockroach)
|
||||
{ Fixture.mkLocalTestEnvironment = \_ -> pure Nothing,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = lhsCockroachSetup tableName testEnv,
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
[ SetupAction.noTeardown (lhsCockroachSetup tableName testEnv)
|
||||
],
|
||||
Fixture.customOptions =
|
||||
Just
|
||||
@ -105,10 +97,7 @@ lhsSQLServer tableName =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.SQLServer)
|
||||
{ Fixture.mkLocalTestEnvironment = \_ -> pure Nothing,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = lhsSQLServerSetup tableName testEnv,
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
[ SetupAction.noTeardown (lhsSQLServerSetup tableName testEnv)
|
||||
]
|
||||
}
|
||||
|
||||
@ -131,10 +120,7 @@ rhsPostgres =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Postgres)
|
||||
{ Fixture.mkLocalTestEnvironment = Fixture.noLocalTestEnvironment,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = rhsPostgresSetup testEnv,
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
[ SetupAction.noTeardown (rhsPostgresSetup testEnv)
|
||||
]
|
||||
}
|
||||
in (rhsTable, fixture)
|
||||
@ -145,10 +131,7 @@ rhsCockroach =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Cockroach)
|
||||
{ Fixture.mkLocalTestEnvironment = Fixture.noLocalTestEnvironment,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = rhsCockroachSetup testEnv,
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
[ SetupAction.noTeardown (rhsCockroachSetup testEnv)
|
||||
],
|
||||
Fixture.customOptions =
|
||||
Just
|
||||
@ -164,10 +147,7 @@ rhsCitus =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Citus)
|
||||
{ Fixture.mkLocalTestEnvironment = Fixture.noLocalTestEnvironment,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = rhsCitusSetup testEnv,
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
[ SetupAction.noTeardown (rhsCitusSetup testEnv)
|
||||
]
|
||||
}
|
||||
in (rhsTable, fixture)
|
||||
@ -178,10 +158,7 @@ rhsSQLServer =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.SQLServer)
|
||||
{ Fixture.mkLocalTestEnvironment = Fixture.noLocalTestEnvironment,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = rhsSQLServerSetup testEnv,
|
||||
Fixture.teardownAction = \_ -> pure ()
|
||||
}
|
||||
[ SetupAction.noTeardown (rhsSQLServerSetup testEnv)
|
||||
]
|
||||
}
|
||||
in (rhsTable, fixture)
|
||||
|
@ -29,6 +29,7 @@ import Harness.RemoteServer qualified as RemoteServer
|
||||
import Harness.Test.Fixture qualified as Fixture
|
||||
import Harness.Test.Schema (Table (..))
|
||||
import Harness.Test.Schema qualified as Schema
|
||||
import Harness.Test.SetupAction as SetupAction
|
||||
import Harness.Test.TestResource (Managed)
|
||||
import Harness.TestEnvironment (GlobalTestEnvironment, Server, TestEnvironment, stopServer)
|
||||
import Harness.Yaml (shouldReturnYaml)
|
||||
@ -97,10 +98,7 @@ lhsPostgres tableName =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Postgres)
|
||||
{ Fixture.mkLocalTestEnvironment = lhsPostgresMkLocalTestEnvironment,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = lhsPostgresSetup tableName testEnv,
|
||||
Fixture.teardownAction = \_ -> lhsPostgresTeardown testEnv
|
||||
}
|
||||
[ SetupAction.noTeardown (lhsPostgresSetup tableName testEnv)
|
||||
]
|
||||
}
|
||||
|
||||
@ -109,10 +107,7 @@ lhsCitus tableName =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Citus)
|
||||
{ Fixture.mkLocalTestEnvironment = lhsCitusMkLocalTestEnvironment,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = lhsCitusSetup tableName testEnv,
|
||||
Fixture.teardownAction = \_ -> lhsCitusTeardown testEnv
|
||||
}
|
||||
[ SetupAction.noTeardown (lhsCitusSetup tableName testEnv)
|
||||
]
|
||||
}
|
||||
|
||||
@ -121,10 +116,7 @@ lhsCockroach tableName =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Cockroach)
|
||||
{ Fixture.mkLocalTestEnvironment = lhsCockroachMkLocalTestEnvironment,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = lhsCockroachSetup tableName testEnv,
|
||||
Fixture.teardownAction = \_ -> lhsCockroachTeardown testEnv
|
||||
}
|
||||
[ SetupAction.noTeardown (lhsCockroachSetup tableName testEnv)
|
||||
],
|
||||
Fixture.customOptions = Nothing
|
||||
}
|
||||
@ -134,10 +126,7 @@ lhsSQLServer tableName =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.SQLServer)
|
||||
{ Fixture.mkLocalTestEnvironment = lhsSQLServerMkLocalTestEnvironment,
|
||||
Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = lhsSQLServerSetup tableName testEnv,
|
||||
Fixture.teardownAction = \_ -> lhsSQLServerTeardown testEnv
|
||||
}
|
||||
[ SetupAction.noTeardown (lhsSQLServerSetup tableName testEnv)
|
||||
]
|
||||
}
|
||||
|
||||
@ -171,10 +160,7 @@ rhsPostgres =
|
||||
context =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Postgres)
|
||||
{ Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = rhsPostgresSetup testEnv,
|
||||
Fixture.teardownAction = \_ -> rhsPostgresTeardown testEnv
|
||||
}
|
||||
[ SetupAction.noTeardown (rhsPostgresSetup testEnv)
|
||||
]
|
||||
}
|
||||
in (table, context)
|
||||
@ -189,10 +175,7 @@ rhsCitus =
|
||||
context =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Citus)
|
||||
{ Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = rhsCitusSetup testEnv,
|
||||
Fixture.teardownAction = \_ -> rhsCitusTeardown testEnv
|
||||
}
|
||||
[ SetupAction.noTeardown (rhsCitusSetup testEnv)
|
||||
]
|
||||
}
|
||||
in (table, context)
|
||||
@ -207,10 +190,7 @@ rhsCockroach =
|
||||
context =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.Cockroach)
|
||||
{ Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = rhsCockroachSetup testEnv,
|
||||
Fixture.teardownAction = \_ -> rhsCockroachTeardown testEnv
|
||||
}
|
||||
[ SetupAction.noTeardown (rhsCockroachSetup testEnv)
|
||||
],
|
||||
Fixture.customOptions = Nothing
|
||||
}
|
||||
@ -226,10 +206,7 @@ rhsSQLServer =
|
||||
context =
|
||||
(Fixture.fixture $ Fixture.Backend Fixture.SQLServer)
|
||||
{ Fixture.setupTeardown = \testEnv ->
|
||||
[ Fixture.SetupAction
|
||||
{ Fixture.setupAction = rhsSQLServerSetup testEnv,
|
||||
Fixture.teardownAction = \_ -> rhsSQLServerTeardown testEnv
|
||||
}
|
||||
[ SetupAction.noTeardown (rhsSQLServerSetup testEnv)
|
||||
]
|
||||
}
|
||||
in (table, context)
|
||||
@ -341,10 +318,6 @@ args:
|
||||
album_id: id
|
||||
|]
|
||||
|
||||
lhsPostgresTeardown :: (TestEnvironment, Maybe Server) -> IO ()
|
||||
lhsPostgresTeardown (_testEnvironment, _) =
|
||||
pure ()
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- LHS Citus
|
||||
|
||||
@ -410,10 +383,6 @@ args:
|
||||
album_id: id
|
||||
|]
|
||||
|
||||
lhsCitusTeardown :: (TestEnvironment, Maybe Server) -> IO ()
|
||||
lhsCitusTeardown (_testEnvironment, _) =
|
||||
pure ()
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- LHS Cockroach
|
||||
|
||||
@ -479,9 +448,6 @@ lhsCockroachSetup rhsTableName (testEnvironment, _) = do
|
||||
album_id: id
|
||||
|]
|
||||
|
||||
lhsCockroachTeardown :: (TestEnvironment, Maybe Server) -> IO ()
|
||||
lhsCockroachTeardown _ = pure ()
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- LHS SQLServer
|
||||
|
||||
@ -548,9 +514,6 @@ args:
|
||||
album_id: id
|
||||
|]
|
||||
|
||||
lhsSQLServerTeardown :: (TestEnvironment, Maybe Server) -> IO ()
|
||||
lhsSQLServerTeardown (testEnvironment, _) = SQLServer.dropTable testEnvironment track
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- LHS Remote Server
|
||||
|
||||
@ -807,10 +770,6 @@ args:
|
||||
allow_aggregations: true
|
||||
|]
|
||||
|
||||
rhsPostgresTeardown :: (TestEnvironment, ()) -> IO ()
|
||||
rhsPostgresTeardown (_testEnvironment, _) =
|
||||
pure ()
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- RHS Citus
|
||||
|
||||
@ -869,10 +828,6 @@ args:
|
||||
allow_aggregations: true
|
||||
|]
|
||||
|
||||
rhsCitusTeardown :: (TestEnvironment, ()) -> IO ()
|
||||
rhsCitusTeardown (_testEnvironment, _) =
|
||||
pure ()
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- RHS Cockroach
|
||||
|
||||
@ -931,9 +886,6 @@ rhsCockroachSetup (testEnvironment, _) = do
|
||||
allow_aggregations: true
|
||||
|]
|
||||
|
||||
rhsCockroachTeardown :: (TestEnvironment, ()) -> IO ()
|
||||
rhsCockroachTeardown _ = pure ()
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- RHS SQLServer
|
||||
|
||||
@ -992,9 +944,6 @@ args:
|
||||
allow_aggregations: true
|
||||
|]
|
||||
|
||||
rhsSQLServerTeardown :: (TestEnvironment, ()) -> IO ()
|
||||
rhsSQLServerTeardown (testEnvironment, _) = SQLServer.dropTable testEnvironment album
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Tests
|
||||
|
||||
|
@ -28,6 +28,7 @@ import Harness.RemoteServer qualified as RemoteServer
|
||||
import Harness.Test.Fixture qualified as Fixture
|
||||
import Harness.Test.Schema (Table (..), table)
|
||||
import Harness.Test.Schema qualified as Schema
|
||||
import Harness.Test.SetupAction qualified as SetupAction
|
||||
import Harness.Test.TestResource (Managed)
|
||||
import Harness.TestEnvironment (GlobalTestEnvironment, Server, TestEnvironment, stopServer)
|
||||
import Harness.Yaml (shouldReturnYaml)
|
||||
@ -134,9 +135,8 @@ track =
|
||||
|
||||
lhsPostgresSetupAction :: TestEnvironment -> Fixture.SetupAction
|
||||
lhsPostgresSetupAction testEnv =
|
||||
Fixture.SetupAction
|
||||
SetupAction.noTeardown
|
||||
(lhsPostgresSetup (testEnv, Nothing))
|
||||
(const $ lhsPostgresTeardown (testEnv, Nothing))
|
||||
|
||||
lhsPostgresMkLocalTestEnvironment :: TestEnvironment -> Managed (Maybe Server)
|
||||
lhsPostgresMkLocalTestEnvironment _ = pure Nothing
|
||||
@ -182,19 +182,13 @@ args:
|
||||
album_id: $album_id
|
||||
|]
|
||||
|
||||
lhsPostgresTeardown :: (TestEnvironment, Maybe Server) -> IO ()
|
||||
lhsPostgresTeardown (testEnvironment, _) = do
|
||||
let sourceName = "source"
|
||||
Schema.untrackTable Fixture.Postgres sourceName track testEnvironment
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- LHS Citus
|
||||
|
||||
lhsCitusSetupAction :: TestEnvironment -> Fixture.SetupAction
|
||||
lhsCitusSetupAction testEnv =
|
||||
Fixture.SetupAction
|
||||
SetupAction.noTeardown
|
||||
(lhsCitusSetup (testEnv, Nothing))
|
||||
(const $ lhsCitusTeardown (testEnv, Nothing))
|
||||
|
||||
lhsCitusMkLocalTestEnvironment :: TestEnvironment -> Managed (Maybe Server)
|
||||
lhsCitusMkLocalTestEnvironment _ = pure Nothing
|
||||
@ -240,19 +234,13 @@ args:
|
||||
album_id: $album_id
|
||||
|]
|
||||
|
||||
lhsCitusTeardown :: (TestEnvironment, Maybe Server) -> IO ()
|
||||
lhsCitusTeardown (testEnvironment, _) = do
|
||||
let sourceName = "source"
|
||||
Schema.untrackTable Fixture.Citus sourceName track testEnvironment
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- LHS Cockroach
|
||||
|
||||
lhsCockroachSetupAction :: TestEnvironment -> Fixture.SetupAction
|
||||
lhsCockroachSetupAction testEnv =
|
||||
Fixture.SetupAction
|
||||
SetupAction.noTeardown
|
||||
(lhsCockroachSetup (testEnv, Nothing))
|
||||
(const $ lhsCockroachTeardown (testEnv, Nothing))
|
||||
|
||||
lhsCockroachMkLocalTestEnvironment :: TestEnvironment -> Managed (Maybe Server)
|
||||
lhsCockroachMkLocalTestEnvironment _ = pure Nothing
|
||||
@ -297,12 +285,6 @@ lhsCockroachSetup (testEnvironment, _) = do
|
||||
album_id: $album_id
|
||||
|]
|
||||
|
||||
lhsCockroachTeardown :: (TestEnvironment, Maybe Server) -> IO ()
|
||||
lhsCockroachTeardown (testEnvironment, _) = do
|
||||
let sourceName = "source"
|
||||
Schema.untrackTable Fixture.Cockroach sourceName track testEnvironment
|
||||
Cockroach.dropTable testEnvironment track
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- LHS SQLServer
|
||||
|
||||
@ -311,9 +293,8 @@ lhsSQLServerMkLocalTestEnvironment _ = pure Nothing
|
||||
|
||||
lhsSQLServerSetupAction :: TestEnvironment -> Fixture.SetupAction
|
||||
lhsSQLServerSetupAction testEnv =
|
||||
Fixture.SetupAction
|
||||
SetupAction.noTeardown
|
||||
(lhsSQLServerSetup (testEnv, Nothing))
|
||||
(const $ lhsSQLServerTeardown (testEnv, Nothing))
|
||||
|
||||
lhsSQLServerSetup :: (TestEnvironment, Maybe Server) -> IO ()
|
||||
lhsSQLServerSetup (testEnvironment, _) = do
|
||||
@ -356,12 +337,6 @@ args:
|
||||
album_id: $album_id
|
||||
|]
|
||||
|
||||
lhsSQLServerTeardown :: (TestEnvironment, Maybe Server) -> IO ()
|
||||
lhsSQLServerTeardown (testEnvironment, _) = do
|
||||
let sourceName = "source"
|
||||
Schema.untrackTable Fixture.SQLServer sourceName track testEnvironment
|
||||
SQLServer.dropTable testEnvironment track
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- LHS Remote Server
|
||||
|
||||
|
@ -3,6 +3,7 @@ module Harness.Test.SetupAction
|
||||
( SetupAction (..),
|
||||
clearMetadata,
|
||||
permitTeardownFail,
|
||||
noTeardown,
|
||||
)
|
||||
where
|
||||
|
||||
@ -30,6 +31,14 @@ clearMetadata testEnv =
|
||||
teardownAction = \_ -> GraphqlEngine.clearMetadata testEnv
|
||||
}
|
||||
|
||||
-- | a SetupAction with no teardown
|
||||
noTeardown :: IO a -> SetupAction
|
||||
noTeardown setup =
|
||||
SetupAction
|
||||
{ setupAction = setup,
|
||||
teardownAction = \_ -> pure ()
|
||||
}
|
||||
|
||||
permitTeardownFail :: SetupAction -> SetupAction
|
||||
permitTeardownFail SetupAction {teardownAction = ta, setupAction = sa} =
|
||||
SetupAction
|
||||
|
Loading…
Reference in New Issue
Block a user