mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 04:51:35 +03:00
f243760398
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2765 Co-authored-by: Philip Lykke Carlsen <358550+plcplc@users.noreply.github.com> Co-authored-by: Chris Done <11019+chrisdone@users.noreply.github.com> Co-authored-by: Aishwarya Rao <59638722+aishwaryarao712@users.noreply.github.com> Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com> Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com> Co-authored-by: Ikechukwu Eze <22247592+iykekings@users.noreply.github.com> Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com> Co-authored-by: awjchen <13142944+awjchen@users.noreply.github.com> Co-authored-by: Martin Mark <74692114+martin-hasura@users.noreply.github.com> Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com> Co-authored-by: Sooraj <8408875+soorajshankar@users.noreply.github.com> Co-authored-by: Sameer Kolhar <6604943+kolharsam@users.noreply.github.com> Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com> Co-authored-by: hasura-bot <30118761+hasura-bot@users.noreply.github.com> Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com> Co-authored-by: Sibi Prabakaran <737477+psibi@users.noreply.github.com> Co-authored-by: Robert <132113+robx@users.noreply.github.com> Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com> Co-authored-by: Praveen Durairaju <14110316+praveenweb@users.noreply.github.com> Co-authored-by: Abhijeet Khangarot <26903230+abhi40308@users.noreply.github.com> GitOrigin-RevId: b3b07c3b42da9f3daa450d6d9e5fbf0bf506c651
178 lines
5.0 KiB
Haskell
178 lines
5.0 KiB
Haskell
{-# LANGUAGE DisambiguateRecordFields #-}
|
|
|
|
-- | Constant configurations used throughout the test suite.
|
|
module Harness.Constants
|
|
( postgresPassword,
|
|
postgresUser,
|
|
postgresDb,
|
|
postgresHost,
|
|
postgresPort,
|
|
postgresqlConnectionString,
|
|
postgresLivenessCheckAttempts,
|
|
postgresLivenessCheckIntervalSeconds,
|
|
postgresLivenessCheckIntervalMicroseconds,
|
|
mysqlLivenessCheckAttempts,
|
|
mysqlLivenessCheckIntervalSeconds,
|
|
mysqlLivenessCheckIntervalMicroseconds,
|
|
mysqlPassword,
|
|
mysqlUser,
|
|
mysqlDatabase,
|
|
mysqlHost,
|
|
mysqlPort,
|
|
mysqlConnectInfo,
|
|
httpHealthCheckAttempts,
|
|
httpHealthCheckIntervalSeconds,
|
|
httpHealthCheckIntervalMicroseconds,
|
|
serveOptions,
|
|
debugMessagesEnabled,
|
|
)
|
|
where
|
|
|
|
import Data.HashSet qualified as Set
|
|
import Data.Word
|
|
import Database.MySQL.Simple qualified as Mysql
|
|
import Database.PG.Query qualified as Q
|
|
import Hasura.GraphQL.Execute.LiveQuery.Options qualified as LQ
|
|
import Hasura.Logging qualified as L
|
|
import Hasura.Prelude
|
|
import Hasura.RQL.Types
|
|
import Hasura.Server.Cors
|
|
import Hasura.Server.Init
|
|
import Hasura.Server.Types
|
|
import Network.WebSockets qualified as WS
|
|
|
|
postgresPassword :: String
|
|
postgresPassword = "hasura"
|
|
|
|
postgresUser :: String
|
|
postgresUser = "hasura"
|
|
|
|
postgresDb :: String
|
|
postgresDb = "hasura"
|
|
|
|
postgresHost :: String
|
|
postgresHost = "127.0.0.1"
|
|
|
|
postgresPort :: Word16
|
|
postgresPort = 65002
|
|
|
|
postgresqlConnectionString :: String
|
|
postgresqlConnectionString =
|
|
"postgres://"
|
|
++ postgresUser
|
|
++ ":"
|
|
++ postgresPassword
|
|
++ "@"
|
|
++ postgresHost
|
|
++ ":"
|
|
++ show postgresPort
|
|
++ "/"
|
|
++ postgresDb
|
|
|
|
postgresLivenessCheckAttempts :: Int
|
|
postgresLivenessCheckAttempts = 5
|
|
|
|
postgresLivenessCheckIntervalSeconds :: Int
|
|
postgresLivenessCheckIntervalSeconds = 1
|
|
|
|
postgresLivenessCheckIntervalMicroseconds :: Int
|
|
postgresLivenessCheckIntervalMicroseconds = 1000 * 1000 * postgresLivenessCheckIntervalSeconds
|
|
|
|
mysqlLivenessCheckAttempts :: Int
|
|
mysqlLivenessCheckAttempts = 5
|
|
|
|
mysqlLivenessCheckIntervalSeconds :: Int
|
|
mysqlLivenessCheckIntervalSeconds = 1
|
|
|
|
mysqlLivenessCheckIntervalMicroseconds :: Int
|
|
mysqlLivenessCheckIntervalMicroseconds = 1000 * 1000 * mysqlLivenessCheckIntervalSeconds
|
|
|
|
mysqlPassword :: String
|
|
mysqlPassword = "hasura"
|
|
|
|
mysqlUser :: String
|
|
mysqlUser = "hasura"
|
|
|
|
mysqlDatabase :: String
|
|
mysqlDatabase = "hasura"
|
|
|
|
mysqlHost :: String
|
|
mysqlHost = "127.0.0.1"
|
|
|
|
mysqlPort :: Word16
|
|
mysqlPort = 65001
|
|
|
|
mysqlConnectInfo :: Mysql.ConnectInfo
|
|
mysqlConnectInfo =
|
|
Mysql.defaultConnectInfo
|
|
{ Mysql.connectUser = mysqlUser,
|
|
Mysql.connectPassword = mysqlPassword,
|
|
Mysql.connectDatabase = mysqlDatabase,
|
|
Mysql.connectHost = mysqlHost,
|
|
Mysql.connectPort = mysqlPort
|
|
}
|
|
|
|
httpHealthCheckAttempts :: Int
|
|
httpHealthCheckAttempts = 5
|
|
|
|
httpHealthCheckIntervalSeconds :: Int
|
|
httpHealthCheckIntervalSeconds = 1
|
|
|
|
httpHealthCheckIntervalMicroseconds :: Int
|
|
httpHealthCheckIntervalMicroseconds = 1000 * 1000 * httpHealthCheckIntervalSeconds
|
|
|
|
serveOptions :: ServeOptions impl
|
|
serveOptions =
|
|
ServeOptions
|
|
{ soPort = 12345, -- The server runner will typically be generating
|
|
-- a random port, so this isn't particularly
|
|
-- important.
|
|
soHost = "0.0.0.0",
|
|
soConnParams = Q.defaultConnParams,
|
|
soTxIso = Q.Serializable,
|
|
soAdminSecret = mempty,
|
|
soAuthHook = Nothing,
|
|
soJwtSecret = mempty,
|
|
soUnAuthRole = Nothing,
|
|
soCorsConfig = CCAllowAll,
|
|
soEnableConsole = True,
|
|
soConsoleAssetsDir = Nothing,
|
|
soEnableTelemetry = False,
|
|
soStringifyNum = True,
|
|
soDangerousBooleanCollapse = False,
|
|
soEnabledAPIs = testSuiteEnabledApis,
|
|
soLiveQueryOpts = LQ.mkLiveQueriesOptions Nothing Nothing,
|
|
soEnableAllowlist = False,
|
|
soEnabledLogTypes = Set.empty,
|
|
soLogLevel =
|
|
if debugMessagesEnabled
|
|
then L.LevelDebug
|
|
else L.LevelOther "test-suite",
|
|
soResponseInternalErrorsConfig = InternalErrorsAllRequests,
|
|
soEventsHttpPoolSize = Nothing,
|
|
soEventsFetchInterval = Nothing,
|
|
soAsyncActionsFetchInterval = Skip,
|
|
soLogHeadersFromEnv = False,
|
|
soEnableRemoteSchemaPermissions = RemoteSchemaPermsDisabled,
|
|
soConnectionOptions = WS.defaultConnectionOptions,
|
|
soWebsocketKeepAlive = defaultKeepAliveDelay,
|
|
soInferFunctionPermissions = FunctionPermissionsInferred,
|
|
soEnableMaintenanceMode = MaintenanceModeDisabled,
|
|
-- MUST be disabled to be able to modify schema.
|
|
soSchemaPollInterval = Interval 10,
|
|
soExperimentalFeatures = mempty,
|
|
soEventsFetchBatchSize = 1,
|
|
soDevMode = True,
|
|
soGracefulShutdownTimeout = 0, -- Don't wait to shutdown.
|
|
soWebsocketConnectionInitTimeout = defaultWSConnectionInitTimeout,
|
|
soEventingMode = EventingEnabled
|
|
}
|
|
|
|
-- | Use the below to show messages.
|
|
debugMessagesEnabled :: Bool
|
|
debugMessagesEnabled = False
|
|
|
|
-- These are important for the test suite.
|
|
testSuiteEnabledApis :: HashSet API
|
|
testSuiteEnabledApis = Set.fromList [METADATA, GRAPHQL, DEVELOPER, CONFIG]
|