From 86a039cf7a4f3a76357b640a976eddc3d5099597 Mon Sep 17 00:00:00 2001 From: Alexis King Date: Thu, 4 Jul 2019 10:21:54 -0500 Subject: [PATCH 1/2] Remove obsolete/unmaintained server Haskell test suite --- server/graphql-engine.cabal | 28 --- server/test/Main.hs | 87 --------- server/test/Spec.hs | 165 ------------------ server/test/testcases/all_json_queries.yaml | 56 ------ server/test/testcases/alter_table.yaml | 15 -- ...e_address_resident_relationship_error.yaml | 10 -- .../create_author_article_permissions.yaml | 54 ------ .../create_author_article_relationship.yaml | 20 --- ...te_author_permission_role_admin_error.yaml | 12 -- server/test/testcases/create_tables.yaml | 68 -------- .../create_user_permission_address.yaml | 11 -- .../create_user_permission_test_table.yaml | 21 --- .../testcases/delete_mutation/article.yaml | 12 -- .../delete_mutation/article_returning.yaml | 15 -- .../author_foreign_key_violation.yaml | 15 -- .../address_check_constraint_error.yaml | 17 -- .../address_not_null_constraint_error.yaml | 19 -- .../testcases/insert_mutation/article.yaml | 32 ---- .../article_author_nested.yaml | 42 ----- .../article_author_nested_error.yaml | 44 ----- .../insert_mutation/article_on_conflict.yaml | 28 --- ...icle_on_conflict_empty_update_columns.yaml | 28 --- .../article_on_conflict_error_01.yaml | 27 --- .../article_on_conflict_error_02.yaml | 27 --- .../article_on_conflict_error_03.yaml | 28 --- .../article_on_conflict_ignore.yaml | 28 --- ...article_on_conflict_ignore_constraint.yaml | 28 --- .../article_on_conflict_only_constraint.yaml | 27 --- .../article_on_conflict_update_columns.yaml | 25 --- .../article_on_conflict_user_role.yaml | 28 --- .../testcases/insert_mutation/author.yaml | 22 --- .../author_articles_nested.yaml | 32 ---- .../author_articles_nested_error.yaml | 33 ---- .../author_on_conflict_ignore_user_role.yaml | 28 --- .../author_on_conflict_update_user_role.yaml | 28 --- .../author_unique_constraint_error.yaml | 19 -- .../test/testcases/insert_mutation/order.yaml | 20 --- .../testcases/insert_mutation/person.yaml | 24 --- .../insert_mutation/person_array.yaml | 27 --- .../testcases/insert_mutation_article.yaml | 47 ----- server/test/testcases/introspection.yaml | 104 ----------- .../testcases/introspection_user_role.yaml | 106 ----------- .../nested_select_query_article.yaml | 16 -- .../nested_select_where_query_author.yaml | 19 -- server/test/testcases/reload_metadata.yaml | 6 - .../select_query_article_limit_offset.yaml | 16 -- ...t_query_article_limit_offset_error_01.yaml | 16 -- ...t_query_article_limit_offset_error_02.yaml | 16 -- .../select_query_author_by_pkey.yaml | 16 -- .../testcases/simple_select_query_author.yaml | 11 -- server/test/testcases/track_tables.yaml | 35 ---- .../testcases/update_mutation/author.yaml | 23 --- .../update_mutation/person_append.yaml | 24 --- .../person_delete_at_path.yaml | 19 -- .../update_mutation/person_delete_elem.yaml | 19 -- .../update_mutation/person_delete_key.yaml | 19 -- .../update_mutation/person_error_01.yaml | 16 -- .../testcases/update_mutation/person_inc.yaml | 19 -- .../update_mutation/person_prepend.yaml | 23 --- .../testcases/update_mutation/person_set.yaml | 24 --- server/test/testcases/upsert_role_user.yaml | 17 -- .../testcases/upsert_role_user_error.yaml | 19 -- 62 files changed, 1880 deletions(-) delete mode 100644 server/test/Main.hs delete mode 100644 server/test/Spec.hs delete mode 100644 server/test/testcases/all_json_queries.yaml delete mode 100644 server/test/testcases/alter_table.yaml delete mode 100644 server/test/testcases/create_address_resident_relationship_error.yaml delete mode 100644 server/test/testcases/create_author_article_permissions.yaml delete mode 100644 server/test/testcases/create_author_article_relationship.yaml delete mode 100644 server/test/testcases/create_author_permission_role_admin_error.yaml delete mode 100644 server/test/testcases/create_tables.yaml delete mode 100644 server/test/testcases/create_user_permission_address.yaml delete mode 100644 server/test/testcases/create_user_permission_test_table.yaml delete mode 100644 server/test/testcases/delete_mutation/article.yaml delete mode 100644 server/test/testcases/delete_mutation/article_returning.yaml delete mode 100644 server/test/testcases/delete_mutation/author_foreign_key_violation.yaml delete mode 100644 server/test/testcases/insert_mutation/address_check_constraint_error.yaml delete mode 100644 server/test/testcases/insert_mutation/address_not_null_constraint_error.yaml delete mode 100644 server/test/testcases/insert_mutation/article.yaml delete mode 100644 server/test/testcases/insert_mutation/article_author_nested.yaml delete mode 100644 server/test/testcases/insert_mutation/article_author_nested_error.yaml delete mode 100644 server/test/testcases/insert_mutation/article_on_conflict.yaml delete mode 100644 server/test/testcases/insert_mutation/article_on_conflict_empty_update_columns.yaml delete mode 100644 server/test/testcases/insert_mutation/article_on_conflict_error_01.yaml delete mode 100644 server/test/testcases/insert_mutation/article_on_conflict_error_02.yaml delete mode 100644 server/test/testcases/insert_mutation/article_on_conflict_error_03.yaml delete mode 100644 server/test/testcases/insert_mutation/article_on_conflict_ignore.yaml delete mode 100644 server/test/testcases/insert_mutation/article_on_conflict_ignore_constraint.yaml delete mode 100644 server/test/testcases/insert_mutation/article_on_conflict_only_constraint.yaml delete mode 100644 server/test/testcases/insert_mutation/article_on_conflict_update_columns.yaml delete mode 100644 server/test/testcases/insert_mutation/article_on_conflict_user_role.yaml delete mode 100644 server/test/testcases/insert_mutation/author.yaml delete mode 100644 server/test/testcases/insert_mutation/author_articles_nested.yaml delete mode 100644 server/test/testcases/insert_mutation/author_articles_nested_error.yaml delete mode 100644 server/test/testcases/insert_mutation/author_on_conflict_ignore_user_role.yaml delete mode 100644 server/test/testcases/insert_mutation/author_on_conflict_update_user_role.yaml delete mode 100644 server/test/testcases/insert_mutation/author_unique_constraint_error.yaml delete mode 100644 server/test/testcases/insert_mutation/order.yaml delete mode 100644 server/test/testcases/insert_mutation/person.yaml delete mode 100644 server/test/testcases/insert_mutation/person_array.yaml delete mode 100644 server/test/testcases/insert_mutation_article.yaml delete mode 100644 server/test/testcases/introspection.yaml delete mode 100644 server/test/testcases/introspection_user_role.yaml delete mode 100644 server/test/testcases/nested_select_query_article.yaml delete mode 100644 server/test/testcases/nested_select_where_query_author.yaml delete mode 100644 server/test/testcases/reload_metadata.yaml delete mode 100644 server/test/testcases/select_query_article_limit_offset.yaml delete mode 100644 server/test/testcases/select_query_article_limit_offset_error_01.yaml delete mode 100644 server/test/testcases/select_query_article_limit_offset_error_02.yaml delete mode 100644 server/test/testcases/select_query_author_by_pkey.yaml delete mode 100644 server/test/testcases/simple_select_query_author.yaml delete mode 100644 server/test/testcases/track_tables.yaml delete mode 100644 server/test/testcases/update_mutation/author.yaml delete mode 100644 server/test/testcases/update_mutation/person_append.yaml delete mode 100644 server/test/testcases/update_mutation/person_delete_at_path.yaml delete mode 100644 server/test/testcases/update_mutation/person_delete_elem.yaml delete mode 100644 server/test/testcases/update_mutation/person_delete_key.yaml delete mode 100644 server/test/testcases/update_mutation/person_error_01.yaml delete mode 100644 server/test/testcases/update_mutation/person_inc.yaml delete mode 100644 server/test/testcases/update_mutation/person_prepend.yaml delete mode 100644 server/test/testcases/update_mutation/person_set.yaml delete mode 100644 server/test/testcases/upsert_role_user.yaml delete mode 100644 server/test/testcases/upsert_role_user_error.yaml diff --git a/server/graphql-engine.cabal b/server/graphql-engine.cabal index 56c6bb8e49249..c6d493dfdb547 100644 --- a/server/graphql-engine.cabal +++ b/server/graphql-engine.cabal @@ -368,31 +368,3 @@ executable graphql-engine -Wincomplete-uni-patterns -Wredundant-constraints -threaded -rtsopts - -test-suite graphql-engine-test - type: exitcode-stdio-1.0 - main-is: Main.hs - Default-Language: Haskell2010 - Hs-Source-Dirs: test - ghc-options: -O2 -Wall - Build-Depends: Spock-core >= 0.11 - , base - , aeson - , aeson-casing - , bytestring - , hspec - , hspec-core - , hspec-wai - , optparse-applicative - , graphql-engine -any - , text - , wai - , pg-client - , time - , yaml - , http-client - , http-client-tls - , unordered-containers >= 0.2 - , case-insensitive - - other-modules: Spec diff --git a/server/test/Main.hs b/server/test/Main.hs deleted file mode 100644 index 728fc17294ab3..0000000000000 --- a/server/test/Main.hs +++ /dev/null @@ -1,87 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RankNTypes #-} - -module Main where - -import Data.Time.Clock (getCurrentTime) -import Network.Wai (Application) -import Options.Applicative -import System.Environment (withArgs) -import System.Exit (exitFailure) -import Test.Hspec.Core.Runner -import Test.Hspec.Wai - -import qualified Data.Aeson as J -import qualified Data.ByteString.Lazy.Char8 as BLC - -import qualified Database.PG.Query as Q -import qualified Hasura.Logging as L -import Hasura.Prelude -import Hasura.Server.App (mkWaiApp) -import Hasura.Server.Auth (AuthMode (..)) - - -import qualified Database.PG.Query as PGQ -import qualified Network.HTTP.Client as HTTP -import qualified Network.HTTP.Client.TLS as HTTP - -import Hasura.Server.Init -import Ops (initCatalogSafe) -import Spec (mkSpecs) - -data ConnectionParams = ConnectionParams RawConnInfo Q.ConnParams - -defTxMode :: Q.TxMode -defTxMode = (Q.Serializable, Nothing) - -resetStateTx :: Q.TxE PGQ.PGExecErr () -resetStateTx = do - Q.unitQE PGQ.PGExecErrTx "DROP SCHEMA hdb_catalog CASCADE" () False - Q.unitQE PGQ.PGExecErrTx "DROP SCHEMA hdb_views CASCADE" () False - Q.unitQE PGQ.PGExecErrTx "DROP SCHEMA public CASCADE" () False - Q.unitQE PGQ.PGExecErrTx "CREATE SCHEMA public" () False - -ravenApp :: L.LoggerCtx -> PGQ.PGPool -> IO Application -ravenApp loggerCtx pool = do - let corsCfg = CorsConfigG "*" False -- cors is enabled - httpManager <- HTTP.newManager HTTP.tlsManagerSettings - -- spockAsApp $ spockT id $ app Q.Serializable Nothing rlogger pool AMNoAuth corsCfg True -- no admin secret and no webhook - (app, _) <- mkWaiApp Q.Serializable Nothing loggerCtx pool httpManager AMNoAuth corsCfg True -- no admin secret and no webhook - return app - - -main :: IO () -main = do - -- parse CLI flags for connection params - ConnectionParams rci cp <- parseArgs - -- form the postgres connection info - ci <- either ((>> exitFailure) . (putStrLn . connInfoErrModifier)) - return $ mkConnInfo Nothing rci - -- intialize the pool - pool <- Q.initPGPool ci cp - -- reset state in the database - void $ liftIO $ runExceptT $ Q.runTx pool defTxMode resetStateTx - -- intialize state for graphql-engine in the database - liftIO $ initialise pool - -- generate the test specs - specs <- mkSpecs - loggerCtx <- L.mkLoggerCtx $ L.defaultLoggerSettings True - -- run the tests - withArgs [] $ hspecWith defaultConfig $ with (ravenApp loggerCtx pool) specs - - where - initialise :: Q.PGPool -> IO () - initialise pool = do - currentTime <- getCurrentTime - res <- runExceptT $ Q.runTx pool defTxMode $ initCatalogSafe currentTime - either ((>> exitFailure) . (BLC.putStrLn . J.encode)) putStrLn res - - -parseArgs :: IO ConnectionParams -parseArgs = execParser opts - where - optParser = ConnectionParams <$> parseRawConnInfo <*> parseConnParams - - opts = info (helper <*> optParser) - ( fullDesc <> - header "graphql-engine-test") diff --git a/server/test/Spec.hs b/server/test/Spec.hs deleted file mode 100644 index fd8df43ed8a11..0000000000000 --- a/server/test/Spec.hs +++ /dev/null @@ -1,165 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TemplateHaskell #-} - -module Spec (mkSpecs) where - -import Hasura.Prelude hiding (get) -import Network.Wai (Application) -import Test.Hspec -import Test.Hspec.Wai -import Test.Hspec.Wai.Matcher - -import qualified Data.Aeson as J -import qualified Data.Aeson.Casing as J -import qualified Data.Aeson.TH as J -import qualified Data.CaseInsensitive as CI -import qualified Data.HashMap.Strict as HM -import qualified Data.Text as T -import qualified Data.Text.Encoding as T -import qualified Data.Yaml as Y - -type Headers = HM.HashMap T.Text T.Text - -data TestCase - = TestCase - { tcDescription :: !T.Text - , tcQuery :: !J.Value - , tcUrl :: !T.Text - , tcHeaders :: !(Maybe Headers) - , tcStatus :: !Int - , tcResponse :: !(Maybe J.Value) - -- , tcDependsOn :: !(Maybe TestCase) - } deriving (Show) - -$(J.deriveJSON (J.aesonDrop 2 J.snakeCase) ''TestCase) - - -querySpecFiles :: [FilePath] -querySpecFiles = - [ "create_tables.yaml" - , "track_tables.yaml" - , "create_author_article_relationship.yaml" - , "create_author_article_permissions.yaml" - , "create_address_resident_relationship_error.yaml" - , "create_user_permission_address.yaml" - , "reload_metadata.yaml" - , "create_author_permission_role_admin_error.yaml" - , "create_user_permission_test_table.yaml" - , "all_json_queries.yaml" - , "upsert_role_user.yaml" - , "upsert_role_user_error.yaml" - ] - -gqlIntrospection :: FilePath -gqlIntrospection = "introspection.yaml" - -gqlSpecFiles :: [FilePath] -gqlSpecFiles = - [ "insert_mutation/author.yaml" - , "introspection.yaml" - , "introspection_user_role.yaml" - , "insert_mutation/author.yaml" - , "insert_mutation/author_articles_nested.yaml" - , "insert_mutation/author_articles_nested_error.yaml" - , "simple_select_query_author.yaml" - , "select_query_author_by_pkey.yaml" - , "insert_mutation/article.yaml" - , "insert_mutation/article_author_nested.yaml" - , "insert_mutation/article_author_nested_error.yaml" - , "insert_mutation/article_on_conflict.yaml" - , "insert_mutation/article_on_conflict_user_role.yaml" - , "insert_mutation/article_on_conflict_update_columns.yaml" - , "insert_mutation/article_on_conflict_ignore.yaml" - , "insert_mutation/article_on_conflict_ignore_constraint.yaml" - , "insert_mutation/article_on_conflict_empty_update_columns.yaml" - , "insert_mutation/article_on_conflict_only_constraint.yaml" - , "insert_mutation/article_on_conflict_error_01.yaml" - , "insert_mutation/article_on_conflict_error_02.yaml" - , "insert_mutation/article_on_conflict_error_03.yaml" - , "insert_mutation/person.yaml" - , "insert_mutation/person_array.yaml" - , "insert_mutation/order.yaml" - , "insert_mutation/address_check_constraint_error.yaml" - , "insert_mutation/address_not_null_constraint_error.yaml" - , "insert_mutation/author_unique_constraint_error.yaml" - , "insert_mutation/author_on_conflict_ignore_user_role.yaml" - , "insert_mutation/author_on_conflict_update_user_role.yaml" - , "nested_select_query_article.yaml" - , "select_query_article_limit_offset.yaml" - , "select_query_article_limit_offset_error_01.yaml" - , "select_query_article_limit_offset_error_02.yaml" - , "update_mutation/author.yaml" - , "update_mutation/person_set.yaml" - , "update_mutation/person_append.yaml" - , "update_mutation/person_prepend.yaml" - , "update_mutation/person_delete_key.yaml" - , "update_mutation/person_delete_elem.yaml" - , "update_mutation/person_delete_at_path.yaml" - , "update_mutation/person_inc.yaml" - , "update_mutation/person_error_01.yaml" - , "delete_mutation/article.yaml" - , "delete_mutation/article_returning.yaml" - , "delete_mutation/author_foreign_key_violation.yaml" - ] - -alterTable :: FilePath -alterTable = "alter_table.yaml" - -readTestCase :: FilePath -> IO TestCase -readTestCase fpath = do - res <- Y.decodeFileEither ("test/testcases/" ++ fpath) - case res of - Left e -> do - putStrLn $ Y.prettyPrintParseException e - error $ "Could not parse testcase YAML: " ++ fpath - Right q -> return q - -mkSpec :: TestCase -> SpecWith Application -mkSpec tc = do - let desc = tcDescription tc - url = tcUrl tc - q = tcQuery tc - mHeaders = tcHeaders tc - statusCode = tcStatus tc - mRespBody = tcResponse tc - headers = maybe [] (map toHeader . HM.toList) mHeaders - body = maybe matchAny bodyEquals $ fmap J.encode mRespBody - resp = ResponseMatcher statusCode [] body - it (T.unpack desc) $ - request "POST" (T.encodeUtf8 url) headers (J.encode q) `shouldRespondWith` resp - where - matchAny = MatchBody (\_ _ -> Nothing) - toHeader (k, v) = (CI.mk $ T.encodeUtf8 k, T.encodeUtf8 v) - - -mkSpecs :: IO (SpecWith Application) -mkSpecs = do - ddlTc <- mapM readTestCase querySpecFiles - gqlTc <- mapM readTestCase gqlSpecFiles - gqlIntrospectionTc <- readTestCase gqlIntrospection - alterTabTc <- readTestCase alterTable - return $ do - describe "version API" $ - it "responds with version" $ - get "/v1/version" `shouldRespondWith` 200 - - describe "console endpoint" $ - it "responds with 200" $ - get "/console" `shouldRespondWith` 200 - - describe "CORS test" $ - it "should respond with correct CORS headers" $ - request "OPTIONS" "/v1/version" [("Origin", "example.com")] "" - `shouldRespondWith` 204 - {matchHeaders = ["Access-Control-Allow-Origin" <:> "example.com"]} - - describe "Query API" $ mapM_ mkSpec ddlTc - - describe "GraphQL Introspection" $ mkSpec gqlIntrospectionTc - - describe "GraphQL API" $ mapM_ mkSpec gqlTc - - describe "Alter Table" $ mkSpec alterTabTc - - describe "GraphQL Introspection after altering a table" - $ mkSpec gqlIntrospectionTc diff --git a/server/test/testcases/all_json_queries.yaml b/server/test/testcases/all_json_queries.yaml deleted file mode 100644 index 8e16752f64fe4..0000000000000 --- a/server/test/testcases/all_json_queries.yaml +++ /dev/null @@ -1,56 +0,0 @@ -description: Select, Insert, Upsert, Update and Delete JSON queries -url: /v1/query -status: 200 -query: - type: bulk - args: - - type: select - args: - table: author - columns: - - id - - name - - type: insert - args: - table: test_table - objects: - - name: erlich - age: 30 - - name: gilfoyle - age: 27 - returing: - - id - - name - - age - - type: update - args: - table: test_table - where: - id: 1 - $set: - age: 31 - returing: - - id - - name - - age - - type: insert - args: - table: test_table - objects: - - id: 2 - name: galvin - age: 45 - on_conflict: - constraint_on: - - id - action: update - returing: - - id - - name - - age - - type: delete - args: - table: test_table - where: - id: 2 - diff --git a/server/test/testcases/alter_table.yaml b/server/test/testcases/alter_table.yaml deleted file mode 100644 index 99e90b3636e53..0000000000000 --- a/server/test/testcases/alter_table.yaml +++ /dev/null @@ -1,15 +0,0 @@ -description: Runs a bulk sql query to alter a table -url: /v1/query -status: 200 -query: - type: bulk - args: - - type: run_sql - args: - sql: "ALTER TABLE dollar$test RENAME TO dollar_test" - - type: run_sql - args: - sql: "ALTER TABLE dollar_test RENAME name TO name_altered" - - type: run_sql - args: - sql: "ALTER TABLE dollar_test RENAME CONSTRAINT dollar$test_pkey TO dollar_test_pkey" diff --git a/server/test/testcases/create_address_resident_relationship_error.yaml b/server/test/testcases/create_address_resident_relationship_error.yaml deleted file mode 100644 index 75925a8061f20..0000000000000 --- a/server/test/testcases/create_address_resident_relationship_error.yaml +++ /dev/null @@ -1,10 +0,0 @@ -description: Create address to resident object relationship. But resident table is not tracked, so expecting a 400 error -url: /v1/query -status: 400 -query: - type: create_object_relationship - args: - table: address - name: resident - using: - foreign_key_constraint_on: resident_id diff --git a/server/test/testcases/create_author_article_permissions.yaml b/server/test/testcases/create_author_article_permissions.yaml deleted file mode 100644 index 67782377be14f..0000000000000 --- a/server/test/testcases/create_author_article_permissions.yaml +++ /dev/null @@ -1,54 +0,0 @@ -description: Create relevant permissions -url: /v1/query -status: 200 -query: - type: bulk - args: - - type: create_select_permission - args: - table: article - role: user - permission: - columns: '*' - filter: - $or: - - author_id: X-HASURA-USER-ID - - is_published: true - - type: create_insert_permission - args: - table: article - role: user - permission: - check: - author_id: X-Hasura-User-Id - - type: create_update_permission - args: - table: article - role: user - permission: - columns: '*' - filter: - author_id: X-Hasura-User-Id - - type: create_select_permission - args: - table: author - role: user - permission: - columns: '*' - filter: - id: X-HASURA-USER-ID - - type: create_insert_permission - args: - table: author - role: user - permission: - check: - id: X-HASURA-USER-ID - - type: create_update_permission - args: - table: author - role: user - permission: - columns: '*' - filter: - id: X-Hasura-User-Id diff --git a/server/test/testcases/create_author_article_relationship.yaml b/server/test/testcases/create_author_article_relationship.yaml deleted file mode 100644 index ad1aeb869aef7..0000000000000 --- a/server/test/testcases/create_author_article_relationship.yaml +++ /dev/null @@ -1,20 +0,0 @@ -description: Creates relationships -url: /v1/query -status: 200 -query: - type: bulk - args: - - type: create_object_relationship - args: - table: article - name: author - using: - foreign_key_constraint_on: author_id - - type: create_array_relationship - args: - table: author - name: articles - using: - foreign_key_constraint_on: - table: article - column: author_id diff --git a/server/test/testcases/create_author_permission_role_admin_error.yaml b/server/test/testcases/create_author_permission_role_admin_error.yaml deleted file mode 100644 index 644181ecb28c4..0000000000000 --- a/server/test/testcases/create_author_permission_role_admin_error.yaml +++ /dev/null @@ -1,12 +0,0 @@ -description: Create permission with admin as role (error) -url: /v1/query -status: 400 -query: - type: create_select_permission - args: - table: article - role: admin - permission: - columns: '*' - filter: - id: X-Hasura-User-Id diff --git a/server/test/testcases/create_tables.yaml b/server/test/testcases/create_tables.yaml deleted file mode 100644 index 4f6fc2c359df3..0000000000000 --- a/server/test/testcases/create_tables.yaml +++ /dev/null @@ -1,68 +0,0 @@ -description: Runs a bulk SQL query to create tables -url: /v1/query -status: 200 -query: - type: bulk - args: - - type: run_sql - args: - sql: "CREATE TABLE author (id SERIAL PRIMARY KEY, name TEXT UNIQUE)" - - type: run_sql - args: - sql: | - CREATE TABLE article ( - id SERIAL PRIMARY KEY, - title TEXT, - content TEXT, - author_id INTEGER REFERENCES author(id), - is_published BOOLEAN, - published_on TIMESTAMP - ) - - type: run_sql - args: - sql: | - CREATE TABLE person ( - id SERIAL PRIMARY KEY, - details JSONB NOT NULL - ) - - type: run_sql - args: - sql: | - CREATE TABLE dollar$test ( - id SERIAL PRIMARY KEY, - name TEXT NOT NULL - ) - - type: run_sql - args: - sql: | - CREATE TABLE resident ( - id SERIAL PRIMARY KEY, - name TEXT NOT NULL, - age INTEGER NOT NULL - ) - - type: run_sql - args: - sql: | - CREATE TABLE address ( - id SERIAL PRIMARY KEY, - door_no TEXT NOT NULL, - street TEXT NOT NULL, - city TEXT NOT NULL, - resident_id INTEGER REFERENCES resident(id) - ) - - type: run_sql - args: - sql: | - CREATE TABLE orders ( - id SERIAL PRIMARY KEY, - placed TIMESTAMPTZ NOT NULL, - shipped TIMESTAMPTZ - ) - - type: run_sql - args: - sql: | - CREATE TABLE test_table ( - id SERIAL PRIMARY KEY, - name TEXT NOT NULL, - age INTEGER NOT NULL - ) diff --git a/server/test/testcases/create_user_permission_address.yaml b/server/test/testcases/create_user_permission_address.yaml deleted file mode 100644 index c1990c3ac12ac..0000000000000 --- a/server/test/testcases/create_user_permission_address.yaml +++ /dev/null @@ -1,11 +0,0 @@ -description: Create a insert permission on address table for user role -url: /v1/query -status: 200 -query: - type: create_insert_permission - args: - table: address - role: merchant - permission: - check: - city: bengaluru diff --git a/server/test/testcases/create_user_permission_test_table.yaml b/server/test/testcases/create_user_permission_test_table.yaml deleted file mode 100644 index d3b313fb11cd1..0000000000000 --- a/server/test/testcases/create_user_permission_test_table.yaml +++ /dev/null @@ -1,21 +0,0 @@ -description: Create a insert permission on test_table for user role -url: /v1/query -status: 200 -query: - type: bulk - args: - - type: create_insert_permission - args: - table: test_table - role: user - permission: - check: - id: X-Hasura-User-Id - - type: create_update_permission - args: - table: test_table - role: user - permission: - filter: - id: X-Hasura-User-Id - columns: '*' diff --git a/server/test/testcases/delete_mutation/article.yaml b/server/test/testcases/delete_mutation/article.yaml deleted file mode 100644 index 8ae815e4e7848..0000000000000 --- a/server/test/testcases/delete_mutation/article.yaml +++ /dev/null @@ -1,12 +0,0 @@ -description: Delete mutation on article -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation delete_article { - delete_article ( - where: {id: {_eq: 5}} - ) { - affected_rows - } - } diff --git a/server/test/testcases/delete_mutation/article_returning.yaml b/server/test/testcases/delete_mutation/article_returning.yaml deleted file mode 100644 index 14333cc2d34b9..0000000000000 --- a/server/test/testcases/delete_mutation/article_returning.yaml +++ /dev/null @@ -1,15 +0,0 @@ -description: Delete mutation on article with returning -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation delete_article { - delete_article ( - where: {id: {_eq: 5}} - ) { - affected_rows - returning{ - id - } - } - } diff --git a/server/test/testcases/delete_mutation/author_foreign_key_violation.yaml b/server/test/testcases/delete_mutation/author_foreign_key_violation.yaml deleted file mode 100644 index 5dc046bf6dd52..0000000000000 --- a/server/test/testcases/delete_mutation/author_foreign_key_violation.yaml +++ /dev/null @@ -1,15 +0,0 @@ -description: delete from author table (Foreign Key Violation Error) -url: /v1alpha1/graphql -status: 400 -query: - query: | - mutation { - delete_author(where: {id: {_eq: 2}}){ - affected_rows - } - } -response: - errors: - - path: $ - error: "Foreign key violation. update or delete on table \"author\" violates foreign key constraint \"article_author_id_fkey\" on table \"article\"" - code: constraint-violation diff --git a/server/test/testcases/insert_mutation/address_check_constraint_error.yaml b/server/test/testcases/insert_mutation/address_check_constraint_error.yaml deleted file mode 100644 index 28689d136cad3..0000000000000 --- a/server/test/testcases/insert_mutation/address_check_constraint_error.yaml +++ /dev/null @@ -1,17 +0,0 @@ -description: Insert into order table as user role (Check Constraint Error) -url: /v1alpha1/graphql -status: 400 -headers: - X-Hasura-Role: merchant -query: - query: | - mutation { - insert_address(objects: [{door_no: "12-21", street: "Madhapur", city: "Hyderabad", resident_id: 1}]){ - affected_rows - } - } -response: - errors: - - path: $.selectionSet.insert_address.args.objects - error: Check constraint violation. insert check constraint failed - code: permission-error diff --git a/server/test/testcases/insert_mutation/address_not_null_constraint_error.yaml b/server/test/testcases/insert_mutation/address_not_null_constraint_error.yaml deleted file mode 100644 index c2e7cf5d35014..0000000000000 --- a/server/test/testcases/insert_mutation/address_not_null_constraint_error.yaml +++ /dev/null @@ -1,19 +0,0 @@ -description: Insert into order table as user role (Not Null Constraint Error) -url: /v1alpha1/graphql -status: 400 -query: - query: | - mutation { - insert_address(objects: [{street: "koramangala"}]){ - returning{ - id - street - } - affected_rows - } - } -response: - errors: - - path: $.selectionSet.insert_address.args.objects - error: "Not-NULL violation. null value in column \"door_no\" violates not-null constraint" - code: constraint-violation diff --git a/server/test/testcases/insert_mutation/article.yaml b/server/test/testcases/insert_mutation/article.yaml deleted file mode 100644 index 6237c33a0863d..0000000000000 --- a/server/test/testcases/insert_mutation/article.yaml +++ /dev/null @@ -1,32 +0,0 @@ -description: Inserts article data via GraphQL mutation -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - title: "Article 1", - content: "Sample article content", - author_id: 1 - }, - { - title: "Article 2", - content: "Sample article content", - author_id: 1 - }, - { - title: "Article 3", - content: "Sample article content", - author_id: 2 - } - ] - ) { - returning { - id - title - content - } - } - } diff --git a/server/test/testcases/insert_mutation/article_author_nested.yaml b/server/test/testcases/insert_mutation/article_author_nested.yaml deleted file mode 100644 index 1a20bc37a7456..0000000000000 --- a/server/test/testcases/insert_mutation/article_author_nested.yaml +++ /dev/null @@ -1,42 +0,0 @@ -description: Insert article and it's author via nested mutation -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation article_author{ - insert_article( - objects: [ - { - title: "Article by author 4", - content: "Article content for article by author 4", - is_published: true - author: { - data: { - name: "Article 4" - } - } - }, - { - title: "Article by author 5", - content: "Article content for article by author 5", - is_published: true - author: { - data: { - name: "Article 5" - } - } - } - ] - ){ - affected_rows - returning{ - id - title - content - author{ - id - name - } - } - } - } diff --git a/server/test/testcases/insert_mutation/article_author_nested_error.yaml b/server/test/testcases/insert_mutation/article_author_nested_error.yaml deleted file mode 100644 index 98e47133a7a0f..0000000000000 --- a/server/test/testcases/insert_mutation/article_author_nested_error.yaml +++ /dev/null @@ -1,44 +0,0 @@ -description: Insert article and it's author via nested mutation (Error) -url: /v1alpha1/graphql -status: 400 -query: - query: | - mutation article_author{ - insert_article( - objects: [ - { - title: "Article by author 4", - content: "Article content for article by author 4", - is_published: true, - author_id: 4 - author: { - data: { - name: "Article 4" - } - } - }, - { - title: "Article by author 5", - content: "Article content for article by author 5", - is_published: true, - author_id: 5 - author: { - data: { - name: "Article 5" - } - } - } - ] - ){ - affected_rows - returning{ - id - title - content - author{ - id - name - } - } - } - } diff --git a/server/test/testcases/insert_mutation/article_on_conflict.yaml b/server/test/testcases/insert_mutation/article_on_conflict.yaml deleted file mode 100644 index 13d5a6e86f896..0000000000000 --- a/server/test/testcases/insert_mutation/article_on_conflict.yaml +++ /dev/null @@ -1,28 +0,0 @@ -description: Upserts article data via GraphQL mutation -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - content: "Updated Article 1 content", - id: 1 - }, - { - content: "Updated Article 2 content", - id: 2 - } - ], - on_conflict: { - constraint: article_pkey, - action: update - } - ) { - returning { - title - content - } - } - } diff --git a/server/test/testcases/insert_mutation/article_on_conflict_empty_update_columns.yaml b/server/test/testcases/insert_mutation/article_on_conflict_empty_update_columns.yaml deleted file mode 100644 index adb68c96811f5..0000000000000 --- a/server/test/testcases/insert_mutation/article_on_conflict_empty_update_columns.yaml +++ /dev/null @@ -1,28 +0,0 @@ -description: Upserts article data via GraphQL mutation with empty update columns -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - content: "Updated Article 1 content", - id: 1 - }, - { - content: "Updated Article 2 content", - id: 2 - } - ], - on_conflict: { - constraint: article_pkey, - update_columns: [] - } - ) { - returning { - title - content - } - } - } diff --git a/server/test/testcases/insert_mutation/article_on_conflict_error_01.yaml b/server/test/testcases/insert_mutation/article_on_conflict_error_01.yaml deleted file mode 100644 index af057ab6372c8..0000000000000 --- a/server/test/testcases/insert_mutation/article_on_conflict_error_01.yaml +++ /dev/null @@ -1,27 +0,0 @@ -description: Upserts article data via GraphQL mutation (Error 01) -url: /v1alpha1/graphql -status: 400 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - content: "Updated Article 1 content", - id: 1 - }, - { - content: "Updated Article 2 content", - id: 2 - } - ], - on_conflict: { - action: update - } - ) { - returning { - title - content - } - } - } diff --git a/server/test/testcases/insert_mutation/article_on_conflict_error_02.yaml b/server/test/testcases/insert_mutation/article_on_conflict_error_02.yaml deleted file mode 100644 index 316f23059dbd9..0000000000000 --- a/server/test/testcases/insert_mutation/article_on_conflict_error_02.yaml +++ /dev/null @@ -1,27 +0,0 @@ -description: Upserts article data via GraphQL mutation (Error 02) -url: /v1alpha1/graphql -status: 400 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - content: "Updated Article 1 content", - id: 1 - }, - { - content: "Updated Article 2 content", - id: 2 - } - ], - on_conflict: { - action: random - } - ) { - returning { - title - content - } - } - } diff --git a/server/test/testcases/insert_mutation/article_on_conflict_error_03.yaml b/server/test/testcases/insert_mutation/article_on_conflict_error_03.yaml deleted file mode 100644 index 14bbc2fd598ee..0000000000000 --- a/server/test/testcases/insert_mutation/article_on_conflict_error_03.yaml +++ /dev/null @@ -1,28 +0,0 @@ -description: Upserts article data via GraphQL mutation (Error 03) -url: /v1alpha1/graphql -status: 400 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - content: "Updated Article 1 content", - id: 1 - }, - { - content: "Updated Article 2 content", - id: 2 - } - ], - on_conflict: { - action: update, - constraint: random_constraint - } - ) { - returning { - title - content - } - } - } diff --git a/server/test/testcases/insert_mutation/article_on_conflict_ignore.yaml b/server/test/testcases/insert_mutation/article_on_conflict_ignore.yaml deleted file mode 100644 index 8f824eacf7c95..0000000000000 --- a/server/test/testcases/insert_mutation/article_on_conflict_ignore.yaml +++ /dev/null @@ -1,28 +0,0 @@ -description: Upserts article data via GraphQL mutation -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - content: "Updated Article 1 content", - id: 1 - }, - { - content: "Updated Article 2 content", - id: 2 - } - ], - on_conflict: { - constraint: article_pkey, - action: ignore - } - ) { - returning { - title - content - } - } - } diff --git a/server/test/testcases/insert_mutation/article_on_conflict_ignore_constraint.yaml b/server/test/testcases/insert_mutation/article_on_conflict_ignore_constraint.yaml deleted file mode 100644 index 8f824eacf7c95..0000000000000 --- a/server/test/testcases/insert_mutation/article_on_conflict_ignore_constraint.yaml +++ /dev/null @@ -1,28 +0,0 @@ -description: Upserts article data via GraphQL mutation -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - content: "Updated Article 1 content", - id: 1 - }, - { - content: "Updated Article 2 content", - id: 2 - } - ], - on_conflict: { - constraint: article_pkey, - action: ignore - } - ) { - returning { - title - content - } - } - } diff --git a/server/test/testcases/insert_mutation/article_on_conflict_only_constraint.yaml b/server/test/testcases/insert_mutation/article_on_conflict_only_constraint.yaml deleted file mode 100644 index e15d7e34e1ae9..0000000000000 --- a/server/test/testcases/insert_mutation/article_on_conflict_only_constraint.yaml +++ /dev/null @@ -1,27 +0,0 @@ -description: Upserts article data via GraphQL mutation with only constraint -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - content: "Updated Article 1 content", - id: 1 - }, - { - content: "Updated Article 2 content", - id: 2 - } - ], - on_conflict: { - constraint: article_pkey - } - ) { - returning { - title - content - } - } - } diff --git a/server/test/testcases/insert_mutation/article_on_conflict_update_columns.yaml b/server/test/testcases/insert_mutation/article_on_conflict_update_columns.yaml deleted file mode 100644 index c243e5038600e..0000000000000 --- a/server/test/testcases/insert_mutation/article_on_conflict_update_columns.yaml +++ /dev/null @@ -1,25 +0,0 @@ -description: Upserts article data view GraphQL mutation using update columns -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - title: "Update Article 2 title only", - content: "Update Article 2 content", - id: 2 - } - ], - on_conflict: { - constraint: article_pkey, - update_columns: [title] - } - ) { - returning { - title - content - } - } - } diff --git a/server/test/testcases/insert_mutation/article_on_conflict_user_role.yaml b/server/test/testcases/insert_mutation/article_on_conflict_user_role.yaml deleted file mode 100644 index 263d3dff58bbf..0000000000000 --- a/server/test/testcases/insert_mutation/article_on_conflict_user_role.yaml +++ /dev/null @@ -1,28 +0,0 @@ -description: Upserts article data via GraphQL mutation as User role -url: /v1alpha1/graphql -status: 200 -headers: - X-Hasura-Role: user - X-Hasura-User-Id: '1' -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - content: "Updated Article 1 content", - id: 1 - author_id: 1 - } - ], - on_conflict: { - constraint: article_pkey - } - ) { - returning { - title - content - author_id - } - } - } diff --git a/server/test/testcases/insert_mutation/author.yaml b/server/test/testcases/insert_mutation/author.yaml deleted file mode 100644 index c3d9800e87972..0000000000000 --- a/server/test/testcases/insert_mutation/author.yaml +++ /dev/null @@ -1,22 +0,0 @@ -description: Inserts author data via GraphQL mutation -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation insert_author { - insert_author( - objects: [ - { - name: "Author 1" - }, - { - name: "Author 2" - } - ] - ) { - returning { - id - name - } - } - } diff --git a/server/test/testcases/insert_mutation/author_articles_nested.yaml b/server/test/testcases/insert_mutation/author_articles_nested.yaml deleted file mode 100644 index 084214af4ac75..0000000000000 --- a/server/test/testcases/insert_mutation/author_articles_nested.yaml +++ /dev/null @@ -1,32 +0,0 @@ -description: Insert author and it's articles via nested mutation -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation nested_author_insert { - insert_author( - objects: [ - { - name: "Author 3", - articles: { - data: [ - { - title: "An article by author 3", - content: "Content for article by author 4", - is_published: false - } - ] - } - } - ] - ) { - affected_rows - returning { - id - name - articles { - id - } - } - } - } diff --git a/server/test/testcases/insert_mutation/author_articles_nested_error.yaml b/server/test/testcases/insert_mutation/author_articles_nested_error.yaml deleted file mode 100644 index a3e3aec62064c..0000000000000 --- a/server/test/testcases/insert_mutation/author_articles_nested_error.yaml +++ /dev/null @@ -1,33 +0,0 @@ -description: Insert author and it's articles via nested mutation (Error) -url: /v1alpha1/graphql -status: 400 -query: - query: | - mutation nested_author_insert { - insert_author( - objects: [ - { - name: "Author 3", - articles: { - data: [ - { - title: "An article by author 3", - content: "Content for article by author 4", - is_published: false, - author_id: 3 - } - ] - } - } - ] - ) { - affected_rows - returning { - id - name - articles { - id - } - } - } - } diff --git a/server/test/testcases/insert_mutation/author_on_conflict_ignore_user_role.yaml b/server/test/testcases/insert_mutation/author_on_conflict_ignore_user_role.yaml deleted file mode 100644 index f190d52cea27a..0000000000000 --- a/server/test/testcases/insert_mutation/author_on_conflict_ignore_user_role.yaml +++ /dev/null @@ -1,28 +0,0 @@ -description: Upserts author with id 1 as a user (Error) -url: /v1alpha1/graphql -status: 200 -headers: - X-Hasura-Role: user - X-Hasura-User-Id: '1' -query: - query: | - mutation insert_author { - insert_author ( - objects: [ - { - id: 1 - name: "Author 1 Updated" - } - ], - on_conflict: { - constraint: author_pkey, - action: ignore - } - ) { - affected_rows - returning { - id - name - } - } - } diff --git a/server/test/testcases/insert_mutation/author_on_conflict_update_user_role.yaml b/server/test/testcases/insert_mutation/author_on_conflict_update_user_role.yaml deleted file mode 100644 index aa566605df18f..0000000000000 --- a/server/test/testcases/insert_mutation/author_on_conflict_update_user_role.yaml +++ /dev/null @@ -1,28 +0,0 @@ -description: Upserts author with id 1 as a user -url: /v1alpha1/graphql -status: 200 -headers: - X-Hasura-Role: user - X-Hasura-User-Id: '1' -query: - query: | - mutation insert_author { - insert_author ( - objects: [ - { - id: 1 - name: "Author 1 Updated" - } - ], - on_conflict: { - action: update, - constraint: author_pkey - } - ) { - affected_rows - returning { - id - name - } - } - } diff --git a/server/test/testcases/insert_mutation/author_unique_constraint_error.yaml b/server/test/testcases/insert_mutation/author_unique_constraint_error.yaml deleted file mode 100644 index d420f7c658ea9..0000000000000 --- a/server/test/testcases/insert_mutation/author_unique_constraint_error.yaml +++ /dev/null @@ -1,19 +0,0 @@ -description: Insert into author table as user role (Unique Constraint Error) -url: /v1alpha1/graphql -status: 400 -query: - query: | - mutation { - insert_author(objects: [{name: "Author 2"}]){ - returning{ - id - name - } - affected_rows - } - } -response: - errors: - - path: $.selectionSet.insert_author.args.objects - error: "Uniqueness violation. duplicate key value violates unique constraint \"author_name_key\"" - code: constraint-violation diff --git a/server/test/testcases/insert_mutation/order.yaml b/server/test/testcases/insert_mutation/order.yaml deleted file mode 100644 index 64ec76093501b..0000000000000 --- a/server/test/testcases/insert_mutation/order.yaml +++ /dev/null @@ -1,20 +0,0 @@ -description: Insert into order table with a null value -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation insert_orders{ - insert_orders( - objects: [ - { - placed: "2017-08-19 14:22:11.802755+02", - shipped: null - } - ] - ) { - returning { - id - } - affected_rows - } - } diff --git a/server/test/testcases/insert_mutation/person.yaml b/server/test/testcases/insert_mutation/person.yaml deleted file mode 100644 index 19333d2b709ad..0000000000000 --- a/server/test/testcases/insert_mutation/person.yaml +++ /dev/null @@ -1,24 +0,0 @@ -description: Inserts person data via GraphQL mutation -url: /v1alpha1/graphql -status: 200 -query: - variables: - value: - name: - first: john - last: murphy - query: | - mutation insert_person($value: jsonb) { - insert_person( - objects: [ - { - details: $value - } - ] - ) { - returning { - id - details - } - } - } diff --git a/server/test/testcases/insert_mutation/person_array.yaml b/server/test/testcases/insert_mutation/person_array.yaml deleted file mode 100644 index ad84a17e3ea42..0000000000000 --- a/server/test/testcases/insert_mutation/person_array.yaml +++ /dev/null @@ -1,27 +0,0 @@ -description: Inserts persons data via GraphQL mutation -url: /v1alpha1/graphql -status: 200 -query: - variables: - value: - - name: - first: thelonious - last: jaha - - name: - first: clarke - last: griffin - query: | - mutation insert_person($value: jsonb) { - insert_person( - objects: [ - { - details: $value - } - ] - ) { - returning { - id - details - } - } - } diff --git a/server/test/testcases/insert_mutation_article.yaml b/server/test/testcases/insert_mutation_article.yaml deleted file mode 100644 index 990855292bf7e..0000000000000 --- a/server/test/testcases/insert_mutation_article.yaml +++ /dev/null @@ -1,47 +0,0 @@ -description: Inserts article data via GraphQL mutation -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation insert_article { - insert_article ( - objects: [ - { - title: "Article 1", - content: "Sample article content", - author_id: 1, - is_published: true - }, - { - title: "Article 2", - content: "Sample article content", - author_id: 1, - is_published: true - }, - { - title: "Article 3", - content: "Sample article content", - author_id: 2, - is_published: true - }, - { - title: "Article 4", - content: "Sample article content", - author_id: 1, - is_published: false - }, - { - title: "Article 5", - content: "Sample article content", - author_id: 2, - is_published: false - } - ] - ) { - returning { - id - title - content - } - } - } diff --git a/server/test/testcases/introspection.yaml b/server/test/testcases/introspection.yaml deleted file mode 100644 index 7a45310e5709c..0000000000000 --- a/server/test/testcases/introspection.yaml +++ /dev/null @@ -1,104 +0,0 @@ -description: GraphQL introspection query -url: /v1alpha1/graphql -status: 200 -query: - query: | - query IntrospectionQuery { - __schema { - queryType { - name - } - mutationType { - name - } - subscriptionType { - name - } - types { - ...FullType - } - directives { - name - description - locations - args { - ...InputValue - } - } - } - } - - fragment FullType on __Type { - kind - name - description - fields(includeDeprecated: true) { - name - description - args { - ...InputValue - } - type { - ...TypeRef - } - isDeprecated - deprecationReason - } - inputFields { - ...InputValue - } - interfaces { - ...TypeRef - } - enumValues(includeDeprecated: true) { - name - description - isDeprecated - deprecationReason - } - possibleTypes { - ...TypeRef - } - } - - fragment InputValue on __InputValue { - name - description - type { - ...TypeRef - } - defaultValue - } - - fragment TypeRef on __Type { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - } - } - } - } - } - } - } - } diff --git a/server/test/testcases/introspection_user_role.yaml b/server/test/testcases/introspection_user_role.yaml deleted file mode 100644 index daa5580a1d65a..0000000000000 --- a/server/test/testcases/introspection_user_role.yaml +++ /dev/null @@ -1,106 +0,0 @@ -description: GraphQL introspection query as user role -url: /v1alpha1/graphql -status: 200 -headers: - X-Hasura-Role: user -query: - query: | - query IntrospectionQuery { - __schema { - queryType { - name - } - mutationType { - name - } - subscriptionType { - name - } - types { - ...FullType - } - directives { - name - description - locations - args { - ...InputValue - } - } - } - } - - fragment FullType on __Type { - kind - name - description - fields(includeDeprecated: true) { - name - description - args { - ...InputValue - } - type { - ...TypeRef - } - isDeprecated - deprecationReason - } - inputFields { - ...InputValue - } - interfaces { - ...TypeRef - } - enumValues(includeDeprecated: true) { - name - description - isDeprecated - deprecationReason - } - possibleTypes { - ...TypeRef - } - } - - fragment InputValue on __InputValue { - name - description - type { - ...TypeRef - } - defaultValue - } - - fragment TypeRef on __Type { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - } - } - } - } - } - } - } - } diff --git a/server/test/testcases/nested_select_query_article.yaml b/server/test/testcases/nested_select_query_article.yaml deleted file mode 100644 index f8f2ecaa240e7..0000000000000 --- a/server/test/testcases/nested_select_query_article.yaml +++ /dev/null @@ -1,16 +0,0 @@ -description: Nested select on article -url: /v1alpha1/graphql -status: 200 -query: - query: | - query { - article { - id - title - content - author { - id - name - } - } - } diff --git a/server/test/testcases/nested_select_where_query_author.yaml b/server/test/testcases/nested_select_where_query_author.yaml deleted file mode 100644 index 124244c2c0286..0000000000000 --- a/server/test/testcases/nested_select_where_query_author.yaml +++ /dev/null @@ -1,19 +0,0 @@ -description: Select author and their articles -url: /v1alpha1/graphql -status: 200 -query: - query: | - query { - author (where: {name: {_eq: "Author 1"}}) { - id - name - articles ( - where: {is_published: {_eq: true}} - limit: 10, - offset: 1 - ) { - id - title - } - } - } diff --git a/server/test/testcases/reload_metadata.yaml b/server/test/testcases/reload_metadata.yaml deleted file mode 100644 index 02485a5f9a9d5..0000000000000 --- a/server/test/testcases/reload_metadata.yaml +++ /dev/null @@ -1,6 +0,0 @@ -description: Reload schema cache (metadata) -url: /v1/query -status: 200 -query: - type: reload_metadata - args: {} diff --git a/server/test/testcases/select_query_article_limit_offset.yaml b/server/test/testcases/select_query_article_limit_offset.yaml deleted file mode 100644 index 79e0422ecb192..0000000000000 --- a/server/test/testcases/select_query_article_limit_offset.yaml +++ /dev/null @@ -1,16 +0,0 @@ -description: Nested select on article with limit -url: /v1alpha1/graphql -status: 200 -query: - query: | - query { - article(limit: 3, offset: 2) { - id - title - content - author { - id - name - } - } - } diff --git a/server/test/testcases/select_query_article_limit_offset_error_01.yaml b/server/test/testcases/select_query_article_limit_offset_error_01.yaml deleted file mode 100644 index da5c155186955..0000000000000 --- a/server/test/testcases/select_query_article_limit_offset_error_01.yaml +++ /dev/null @@ -1,16 +0,0 @@ -description: Nested select on article with limit expecting error -url: /v1alpha1/graphql -status: 400 -query: - query: | - query { - article(limit: "3", offset: 1) { - id - title - content - author { - id - name - } - } - } diff --git a/server/test/testcases/select_query_article_limit_offset_error_02.yaml b/server/test/testcases/select_query_article_limit_offset_error_02.yaml deleted file mode 100644 index 2804db017643f..0000000000000 --- a/server/test/testcases/select_query_article_limit_offset_error_02.yaml +++ /dev/null @@ -1,16 +0,0 @@ -description: Nested select on article with limit expecting error -url: /v1alpha1/graphql -status: 400 -query: - query: | - query { - article(limit: -1, offset: 1) { - id - title - content - author { - id - name - } - } - } diff --git a/server/test/testcases/select_query_author_by_pkey.yaml b/server/test/testcases/select_query_author_by_pkey.yaml deleted file mode 100644 index 3f1e1ef9080dc..0000000000000 --- a/server/test/testcases/select_query_author_by_pkey.yaml +++ /dev/null @@ -1,16 +0,0 @@ -description: select query on author with id = 1 -url: /v1alpha1/graphql -status: 200 -response: - data: - author_by_pk: - name: Author 1 - id: 1 -query: - query: | - query { - author_by_pk(id: 1){ - id - name - } - } diff --git a/server/test/testcases/simple_select_query_author.yaml b/server/test/testcases/simple_select_query_author.yaml deleted file mode 100644 index 6582011bb8dc0..0000000000000 --- a/server/test/testcases/simple_select_query_author.yaml +++ /dev/null @@ -1,11 +0,0 @@ -description: Simple GraphQL object query on author -url: /v1alpha1/graphql -status: 200 -query: - query: | - query { - author { - id - name - } - } diff --git a/server/test/testcases/track_tables.yaml b/server/test/testcases/track_tables.yaml deleted file mode 100644 index 4749906313c85..0000000000000 --- a/server/test/testcases/track_tables.yaml +++ /dev/null @@ -1,35 +0,0 @@ -description: Track the above created tables -url: /v1/query -status: 200 -query: - type: bulk - args: - - type: track_table - args: - schema: public - name: author - - type: track_table - args: - schema: public - name: article - - type: track_table - args: - schema: public - name: person - - type: track_table - args: - schema: public - name: dollar$test - - type: track_table - args: - schema: public - name: address - - type: track_table - args: - schema: public - name: orders - - type: track_table - args: - schema: public - name: test_table - diff --git a/server/test/testcases/update_mutation/author.yaml b/server/test/testcases/update_mutation/author.yaml deleted file mode 100644 index 22917a1260c17..0000000000000 --- a/server/test/testcases/update_mutation/author.yaml +++ /dev/null @@ -1,23 +0,0 @@ -description: Update mutation on author -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation update_author { - update_author( - where: {id: {_eq: 1}}, - _set: {name: "Jane"} - ) { - affected_rows - returning{ - id - name - articles{ - id - title - content - is_published - } - } - } - } diff --git a/server/test/testcases/update_mutation/person_append.yaml b/server/test/testcases/update_mutation/person_append.yaml deleted file mode 100644 index 13631bb91bc1d..0000000000000 --- a/server/test/testcases/update_mutation/person_append.yaml +++ /dev/null @@ -1,24 +0,0 @@ -description: Updated person data using _append operator -url: /v1alpha1/graphql -status: 200 -query: - variables: - value: - address: - country: Australia - city: Sydney - query: | - mutation update_person($value: jsonb) { - update_person( - where: {id: {_eq: 1}}, - _append: { - details: $value - } - ){ - affected_rows - returning{ - id - details - } - } - } diff --git a/server/test/testcases/update_mutation/person_delete_at_path.yaml b/server/test/testcases/update_mutation/person_delete_at_path.yaml deleted file mode 100644 index dba228d6d222a..0000000000000 --- a/server/test/testcases/update_mutation/person_delete_at_path.yaml +++ /dev/null @@ -1,19 +0,0 @@ -description: Updated person data using _delete_at_path operator -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation update_person($value: jsonb) { - update_person( - where: {id: {_eq: 1}}, - _delete_at_path: { - details: ["name", "last"] - } - ){ - affected_rows - returning{ - id - details - } - } - } diff --git a/server/test/testcases/update_mutation/person_delete_elem.yaml b/server/test/testcases/update_mutation/person_delete_elem.yaml deleted file mode 100644 index 406680f3deda4..0000000000000 --- a/server/test/testcases/update_mutation/person_delete_elem.yaml +++ /dev/null @@ -1,19 +0,0 @@ -description: Updated person data using _delete_elem operator -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation update_person($value: jsonb) { - update_person( - where: {id: {_eq: 2}}, - _delete_elem: { - details: 0 - } - ){ - affected_rows - returning{ - id - details - } - } - } diff --git a/server/test/testcases/update_mutation/person_delete_key.yaml b/server/test/testcases/update_mutation/person_delete_key.yaml deleted file mode 100644 index 449c131a890bf..0000000000000 --- a/server/test/testcases/update_mutation/person_delete_key.yaml +++ /dev/null @@ -1,19 +0,0 @@ -description: Updated person data using _delete_key operator -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation update_person($value: jsonb) { - update_person( - where: {id: {_eq: 1}}, - _delete_key: { - details: "address" - } - ){ - affected_rows - returning{ - id - details - } - } - } diff --git a/server/test/testcases/update_mutation/person_error_01.yaml b/server/test/testcases/update_mutation/person_error_01.yaml deleted file mode 100644 index d7e35befa9da9..0000000000000 --- a/server/test/testcases/update_mutation/person_error_01.yaml +++ /dev/null @@ -1,16 +0,0 @@ -description: Updated person data without any operator -url: /v1alpha1/graphql -status: 400 -query: - query: | - mutation update_person($value: jsonb) { - update_person( - where: {id: {_eq: 2}} - ){ - affected_rows - returning{ - id - details - } - } - } diff --git a/server/test/testcases/update_mutation/person_inc.yaml b/server/test/testcases/update_mutation/person_inc.yaml deleted file mode 100644 index b6962458ebd32..0000000000000 --- a/server/test/testcases/update_mutation/person_inc.yaml +++ /dev/null @@ -1,19 +0,0 @@ -description: Updated person data using _inc operator -url: /v1alpha1/graphql -status: 200 -query: - query: | - mutation update_person($value: jsonb) { - update_person( - where: {id: {_eq: 2}}, - _inc: { - id: 1 - } - ){ - affected_rows - returning{ - id - details - } - } - } diff --git a/server/test/testcases/update_mutation/person_prepend.yaml b/server/test/testcases/update_mutation/person_prepend.yaml deleted file mode 100644 index 346f934cb4cd0..0000000000000 --- a/server/test/testcases/update_mutation/person_prepend.yaml +++ /dev/null @@ -1,23 +0,0 @@ -description: Updated person data using _prepend operator -url: /v1alpha1/graphql -status: 200 -query: - variables: - value: - university: - name: Sydney university - query: | - mutation update_person($value: jsonb) { - update_person( - where: {id: {_eq: 1}}, - _prepend: { - details: $value - } - ){ - affected_rows - returning{ - id - details - } - } - } diff --git a/server/test/testcases/update_mutation/person_set.yaml b/server/test/testcases/update_mutation/person_set.yaml deleted file mode 100644 index 4c51a3e2b72de..0000000000000 --- a/server/test/testcases/update_mutation/person_set.yaml +++ /dev/null @@ -1,24 +0,0 @@ -description: Updated person data using _set operator -url: /v1alpha1/graphql -status: 200 -query: - variables: - value: - name: - first: john - last: taylor - query: | - mutation update_person($value: jsonb) { - update_person( - where: {id: {_eq: 1}}, - _set: { - details: $value - } - ){ - affected_rows - returning{ - id - details - } - } - } diff --git a/server/test/testcases/upsert_role_user.yaml b/server/test/testcases/upsert_role_user.yaml deleted file mode 100644 index 9b1e8a60b8838..0000000000000 --- a/server/test/testcases/upsert_role_user.yaml +++ /dev/null @@ -1,17 +0,0 @@ -description: upsert into test_table with user role -url: v1/query -headers: - X-Hasura-Role: user - X-Hasura-User-Id: '1' -status: 200 -query: - type: insert - args: - table: test_table - objects: - - id: 1 - name: monika - age: 25 - on_conflict: - constraint: test_table_pkey - action: update diff --git a/server/test/testcases/upsert_role_user_error.yaml b/server/test/testcases/upsert_role_user_error.yaml deleted file mode 100644 index 735a6154f77d6..0000000000000 --- a/server/test/testcases/upsert_role_user_error.yaml +++ /dev/null @@ -1,19 +0,0 @@ -description: Upsert on test_table as user role with constraint on columns (error) -url: /v1/query -headers: - X-Hasura-Role: user - X-Hasura-User-Id: '1' -status: 400 -query: - type: insert - args: - table: test_table - objects: - - id: 1 - name: monika - age: 25 - on_conflict: - constraint_on: - - id - action: ignore - From 100c173b7a45a3f6f484322e1991dc0a704a3048 Mon Sep 17 00:00:00 2001 From: Alexis King Date: Thu, 4 Jul 2019 10:37:49 -0500 Subject: [PATCH 2/2] Prune some unused server dependencies --- server/graphql-engine.cabal | 7 ------- 1 file changed, 7 deletions(-) diff --git a/server/graphql-engine.cabal b/server/graphql-engine.cabal index c6d493dfdb547..840dbbc512de5 100644 --- a/server/graphql-engine.cabal +++ b/server/graphql-engine.cabal @@ -53,11 +53,9 @@ library , Spock-core , split , optparse-applicative - , wai-extra , containers , monad-control , monad-time - , wai-logger , fast-logger , wai , postgresql-binary @@ -98,9 +96,6 @@ library -- Http client , wreq , http-client - , http-client-tls - , connection - , retry -- ordered map , insert-ordered-containers @@ -122,7 +117,6 @@ library -- websockets interface related , websockets , wai-websockets - , hashtables , stm , stm-containers , list-t @@ -351,7 +345,6 @@ executable graphql-engine , http-client-tls , stm , wreq - , connection , string-conversions , uuid