[server/tests] don't do detailed teardown

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7128
GitOrigin-RevId: cbc52dadaca8ef7d4affb43528e8dcec0c8ec62e
This commit is contained in:
Daniel Harvey 2022-12-02 08:58:43 +00:00 committed by hasura-bot
parent 6c106c9e35
commit 16ecd63b01
4 changed files with 10 additions and 33 deletions

View File

@ -18,6 +18,7 @@ module Harness.Backend.BigQuery
)
where
import Control.Concurrent.Async (concurrently_)
import Control.Concurrent.Extended
import Data.List qualified as List
import Data.String
@ -243,14 +244,10 @@ setup tables' (testEnvironment, _) = do
-- | Teardown the schema and tracking in the most expected way.
-- NOTE: Certain test modules may warrant having their own version.
teardown :: [Schema.Table] -> (TestEnvironment, ()) -> IO ()
teardown (reverse -> tables) (testEnvironment, _) = do
teardown _ (testEnvironment, _) = do
let schemaName = Schema.getSchemaName testEnvironment
finally
-- Teardown relationships first
( forFinally_ tables $ \table ->
Schema.untrackRelationships BigQuery table testEnvironment
)
-- remove test dataset
concurrently_
(GraphqlEngine.setSources testEnvironment mempty Nothing)
(removeDataset schemaName)
setupTablesAction :: HasCallStack => [Schema.Table] -> TestEnvironment -> SetupAction

View File

@ -299,18 +299,8 @@ setupPermissionsAction permissions env =
-- | Teardown the schema and tracking in the most expected way.
-- NOTE: Certain test modules may warrant having their own version.
teardown :: HasCallStack => [Schema.Table] -> (TestEnvironment, ()) -> IO ()
teardown (reverse -> tables) (testEnvironment, _) = do
finally
-- Teardown relationships first
( forFinally_ tables $ \table ->
Schema.untrackRelationships Citus table testEnvironment
)
-- Then teardown tables
( forFinally_ tables $ \table ->
finally
(untrackTable testEnvironment table)
(dropTable testEnvironment table)
)
teardown _ (testEnvironment, _) =
GraphqlEngine.setSources testEnvironment mempty Nothing
-- | Setup the given permissions to the graphql engine in a TestEnvironment.
setupPermissions :: [Permissions.Permission] -> TestEnvironment -> IO ()

View File

@ -292,8 +292,8 @@ setup tables (testEnvironment, _) = do
-- NOTE: Certain test modules may warrant having their own version.
-- Because the Fixture takes care of dropping the DB, all we do here is
-- clear the metadata with `replace_metadata`.
teardown :: [Schema.Table] -> (TestEnvironment, ()) -> IO ()
teardown _ (testEnvironment, _) = do
teardown :: HasCallStack => [Schema.Table] -> (TestEnvironment, ()) -> IO ()
teardown _ (testEnvironment, _) =
GraphqlEngine.setSources testEnvironment mempty Nothing
setupTablesAction :: [Schema.Table] -> TestEnvironment -> SetupAction

View File

@ -304,18 +304,8 @@ setup tables (testEnvironment, _) = do
-- | Teardown the schema and tracking in the most expected way.
-- NOTE: Certain test modules may warrant having their own version.
teardown :: HasCallStack => [Schema.Table] -> (TestEnvironment, ()) -> IO ()
teardown (reverse -> tables) (testEnvironment, _) = do
finally
-- Teardown relationships first
( forFinally_ tables $ \table ->
Schema.untrackRelationships SQLServer table testEnvironment
)
-- Then teardown tables
( forFinally_ tables $ \table ->
finally
(untrackTable testEnvironment table)
(dropTable testEnvironment table)
)
teardown _ (testEnvironment, _) =
GraphqlEngine.setSources testEnvironment mempty Nothing
setupTablesAction :: [Schema.Table] -> TestEnvironment -> SetupAction
setupTablesAction ts env =