mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
80c977da85
We currently have a fairly intricate way of running our PostgreSQL and MSSQL integration tests (not the API tests). By splitting them out, we can simplify this a lot. Most prominently, we can rely on Cabal to be our argument parser instead of writing our own. We can also simplify how they're run in CI. They are currently (weirdly) run alongside the Python integration tests. This breaks them out into their own jobs for better visibility, and to avoid conflating the two. The changes are as follows: - The "unit" tests that rely on a running PostgreSQL database are extracted out to a new test directory so they can be run separately. - Most of the `Main` module comes with them. - We now refer to these as "integration" tests instead. - Likewise for the "unit" tests that rely on a running MS SQL Server database. These are a little simpler and we can use `hspec-discover`, with a `SpecHook` to extract the connection string from an environment variable. - Henceforth, these are the MS SQL Server integration tests. - New CI jobs have been added for each of these. - There wasn't actually a job for the MS SQL Server integration tests. It's pretty amazing they still run well. - The "haskell-tests" CI job, which used to run the PostgreSQL integration tests, has been removed. - The makefiles and contributing guide have been updated to run these. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6912 GitOrigin-RevId: 67bbe2941bba31793f63d04a9a693779d4463ee1
35 lines
1.6 KiB
Haskell
35 lines
1.6 KiB
Haskell
module Hasura.Backends.MSSQL.ErrorSpec (spec) where
|
|
|
|
import Hasura.Backends.MSSQL.SQL.Error
|
|
import Hasura.Prelude
|
|
import Test.Hspec
|
|
|
|
spec :: SpecWith a
|
|
spec = do
|
|
it "test parseErrorClass all classes" $ const $ mapM_ testParseErrorClass testCases
|
|
it "test parseErrorClass invalid SQLSTATE" $ const $ (parseErrorClass "99999") `shouldBe` Nothing
|
|
where
|
|
testParseErrorClass :: (String, ErrorClass) -> Expectation
|
|
testParseErrorClass (sqlStateCode, expectedClass) =
|
|
(parseErrorClass sqlStateCode) `shouldBe` (Just expectedClass)
|
|
|
|
testCases :: [(String, ErrorClass)]
|
|
testCases =
|
|
[ ("22000", DataException NoSubclass),
|
|
("22001", DataException (Subclass StringDataRightTruncated)),
|
|
("22003", DataException (Subclass NumericValueOutOfRange)),
|
|
("22007", DataException (Subclass InvalidDatetimeFormat)),
|
|
("22008", DataException (Subclass DatetimeFieldOverflow)),
|
|
("22015", DataException (Subclass IntervalFieldOverflow)),
|
|
("22019", DataException (Subclass InvalidEscapeCharacter)),
|
|
("22025", DataException (Subclass InvalidEscapeSequence)),
|
|
("23000", IntegrityConstraintViolation),
|
|
("42000", SyntaxErrorOrAccessViolation NoSubclass),
|
|
("42S01", SyntaxErrorOrAccessViolation (Subclass TableOrViewAlreadyExists)),
|
|
("42S02", SyntaxErrorOrAccessViolation (Subclass TableOrViewNotFound)),
|
|
("42S11", SyntaxErrorOrAccessViolation (Subclass IndexAlreadyExists)),
|
|
("42S12", SyntaxErrorOrAccessViolation (Subclass IndexNotFound)),
|
|
("42S21", SyntaxErrorOrAccessViolation (Subclass ColumnAlreadyExists)),
|
|
("42S22", SyntaxErrorOrAccessViolation (Subclass ColumnNotFound))
|
|
]
|