Disable downgrade test for now. Closes #5273 (#5291)

This commit is contained in:
Brandon Simmons 2020-07-06 00:38:26 -04:00 committed by GitHub
parent 7ae3e55a88
commit 5cd30e073a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,25 +8,28 @@ import Control.Concurrent.MVar.Lifted
import Control.Monad.Trans.Control (MonadBaseControl) import Control.Monad.Trans.Control (MonadBaseControl)
import Control.Monad.Unique import Control.Monad.Unique
import Control.Natural ((:~>) (..)) import Control.Natural ((:~>) (..))
import Data.List (isPrefixOf, stripPrefix)
import Data.List.Split (splitOn)
import Data.Time.Clock (getCurrentTime) import Data.Time.Clock (getCurrentTime)
import Data.Tuple (swap) import Data.Tuple (swap)
import System.Process (readProcess)
import Test.Hspec.Core.Spec import Test.Hspec.Core.Spec
import Test.Hspec.Expectations.Lifted import Test.Hspec.Expectations.Lifted
import qualified Database.PG.Query as Q import qualified Database.PG.Query as Q
import qualified Safe
import Hasura.RQL.DDL.Metadata (ClearMetadata (..), runClearMetadata) import Hasura.RQL.DDL.Metadata (ClearMetadata (..), runClearMetadata)
import Hasura.RQL.DDL.Schema import Hasura.RQL.DDL.Schema
import Hasura.RQL.Types import Hasura.RQL.Types
import Hasura.Server.API.PGDump import Hasura.Server.API.PGDump
import Hasura.Server.Init (DowngradeOptions (..), downgradeShortcuts) import Hasura.Server.Init (DowngradeOptions (..))
import Hasura.Server.Migrate import Hasura.Server.Migrate
import Hasura.Server.Version (HasVersion) import Hasura.Server.Version (HasVersion)
-- -- NOTE: downgrade test disabled for now (see #5273)
-- import Data.List.Split (splitOn)
-- import Data.List (isPrefixOf, stripPrefix)
-- import System.Process (readProcess)
-- import qualified Safe
-- import Hasura.Server.Init (downgradeShortcuts)
newtype CacheRefT m a newtype CacheRefT m a
= CacheRefT { runCacheRefT :: MVar (RebuildableSchemaCache m) -> m a } = CacheRefT { runCacheRefT :: MVar (RebuildableSchemaCache m) -> m a }
deriving deriving
@ -94,14 +97,18 @@ spec pgConnInfo = do
_ -> False _ -> False
transact (upgradeToLatest time) `shouldReturn` MRMigrated "12" transact (upgradeToLatest time) `shouldReturn` MRMigrated "12"
it "supports downgrades for every Git tag" $ singleTransaction do -- -- NOTE: this has been problematic in CI and we're not quite sure how to
gitOutput <- liftIO $ readProcess "git" ["log", "--no-walk", "--tags", "--pretty=%D"] "" -- -- make this work reliably given the way we do releases and create
let filterOldest = filter (not . isPrefixOf "v1.0.0-alpha") -- -- beta tags and so on. Phil and Alexis are okay just commenting
extractTagName = Safe.headMay . splitOn ", " <=< stripPrefix "tag: " -- -- this until we need revisit. See #5273:
supportedDowngrades = sort (map fst downgradeShortcuts) -- it "supports downgrades for every Git tag" $ singleTransaction do
gitTags = (sort . filterOldest . mapMaybe extractTagName . tail . lines) gitOutput -- gitOutput <- liftIO $ readProcess "git" ["log", "--no-walk", "--tags", "--pretty=%D"] ""
for_ gitTags \t -> -- let filterOldest = filter (not . isPrefixOf "v1.0.0-alpha")
t `shouldSatisfy` (`elem` supportedDowngrades) -- extractTagName = Safe.headMay . splitOn ", " <=< stripPrefix "tag: "
-- supportedDowngrades = sort (map fst downgradeShortcuts)
-- gitTags = (sort . filterOldest . mapMaybe extractTagName . tail . lines) gitOutput
-- for_ gitTags \t ->
-- t `shouldSatisfy` (`elem` supportedDowngrades)
describe "recreateSystemMetadata" $ do describe "recreateSystemMetadata" $ do
let dumpMetadata = execPGDump (PGDumpReqBody ["--schema=hdb_catalog"] (Just False)) pgConnInfo let dumpMetadata = execPGDump (PGDumpReqBody ["--schema=hdb_catalog"] (Just False)) pgConnInfo