Revert "add: config db-timezone-enabled for optional querying of timezones"
This reverts commit d6c338d588.
This commit is contained in:
committed by
Steve Chavez
parent
ca4a6d9e99
commit
a41396c425
@@ -11,7 +11,6 @@ All notable changes to this project will be documented in this file. From versio
|
|||||||
+ Removed unnecessary double count when building the `Content-Range`.
|
+ Removed unnecessary double count when building the `Content-Range`.
|
||||||
- Add config `client-error-verbosity` to customize error verbosity by @taimoorzaeem in #4088, #3980, #3824
|
- Add config `client-error-verbosity` to customize error verbosity by @taimoorzaeem in #4088, #3980, #3824
|
||||||
- Add `Vary` header to responses by @develop7 in #4609
|
- Add `Vary` header to responses by @develop7 in #4609
|
||||||
- Add config `db-timezone-enabled` for optional querying of timezones by @taimoorzaeem in #4751
|
|
||||||
- Log schema cache queries timings on `log-level=debug` by @steve-chavez in #4805
|
- Log schema cache queries timings on `log-level=debug` by @steve-chavez in #4805
|
||||||
- Add GHC runtime metrics to the metrics endpoint by @mkleczek in #4862
|
- Add GHC runtime metrics to the metrics endpoint by @mkleczek in #4862
|
||||||
- Support running the admin server on a unix socket by @wolfgangwalther in #5003
|
- Support running the admin server on a unix socket by @wolfgangwalther in #5003
|
||||||
|
|||||||
@@ -117,10 +117,6 @@ However, with ``handling=strict``, an invalid time zone preference will throw an
|
|||||||
|
|
||||||
HTTP/1.1 400 Bad Request
|
HTTP/1.1 400 Bad Request
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
This feature requires querying `pg_timezone_names <https://www.postgresql.org/docs/current/view-pg-timezone-names.html>`_ during :ref:`schema_cache` load. If this is not desired, you can disable the feature with :ref:`db-timezone-enabled`.
|
|
||||||
|
|
||||||
.. _prefer_return:
|
.. _prefer_return:
|
||||||
|
|
||||||
Return Representation
|
Return Representation
|
||||||
|
|||||||
@@ -580,21 +580,6 @@ db-schemas
|
|||||||
|
|
||||||
The list of database schemas to expose to clients. See :ref:`schemas`.
|
The list of database schemas to expose to clients. See :ref:`schemas`.
|
||||||
|
|
||||||
.. _db-timezone-enabled:
|
|
||||||
|
|
||||||
db-timezone-enabled
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
=============== =================================
|
|
||||||
**Type** Boolean
|
|
||||||
**Default** True
|
|
||||||
**Reloadable** Y
|
|
||||||
**Environment** PGRST_DB_TIMEZONE_ENABLED
|
|
||||||
**In-Database** pgrst.db_timezone_enabled
|
|
||||||
=============== =================================
|
|
||||||
|
|
||||||
Enables the use of :ref:`prefer_timezone` preference header. Disabled when set to ``false``.
|
|
||||||
|
|
||||||
.. _db-tx-end:
|
.. _db-tx-end:
|
||||||
|
|
||||||
db-tx-end
|
db-tx-end
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ data AppConfig = AppConfig
|
|||||||
, configDbSchemas :: NonEmpty Text
|
, configDbSchemas :: NonEmpty Text
|
||||||
, configDbConfig :: Bool
|
, configDbConfig :: Bool
|
||||||
, configDbPreConfig :: Maybe QualifiedIdentifier
|
, configDbPreConfig :: Maybe QualifiedIdentifier
|
||||||
, configDbTimezoneEnabled :: Bool
|
|
||||||
, configDbTxAllowOverride :: Bool
|
, configDbTxAllowOverride :: Bool
|
||||||
, configDbTxRollbackAll :: Bool
|
, configDbTxRollbackAll :: Bool
|
||||||
, configDbUri :: Text
|
, configDbUri :: Text
|
||||||
@@ -186,7 +185,6 @@ toText conf =
|
|||||||
,("db-schemas", q . T.intercalate "," . toList . configDbSchemas)
|
,("db-schemas", q . T.intercalate "," . toList . configDbSchemas)
|
||||||
,("db-config", T.toLower . show . configDbConfig)
|
,("db-config", T.toLower . show . configDbConfig)
|
||||||
,("db-pre-config", q . maybe mempty dumpQi . configDbPreConfig)
|
,("db-pre-config", q . maybe mempty dumpQi . configDbPreConfig)
|
||||||
,("db-timezone-enabled", T.toLower . show . configDbTimezoneEnabled)
|
|
||||||
,("db-tx-end", q . showTxEnd)
|
,("db-tx-end", q . showTxEnd)
|
||||||
,("db-uri", q . configDbUri)
|
,("db-uri", q . configDbUri)
|
||||||
,("jwt-aud", q . fromMaybe mempty . configJwtAudience)
|
,("jwt-aud", q . fromMaybe mempty . configJwtAudience)
|
||||||
@@ -301,7 +299,6 @@ parser optPath env dbSettings roleSettings roleIsolationLvl =
|
|||||||
<*> parseDbSchemas "db-schemas" "db-schema"
|
<*> parseDbSchemas "db-schemas" "db-schema"
|
||||||
<*> (fromMaybe True <$> optBool "db-config")
|
<*> (fromMaybe True <$> optBool "db-config")
|
||||||
<*> (fmap toQi <$> optString "db-pre-config")
|
<*> (fmap toQi <$> optString "db-pre-config")
|
||||||
<*> (fromMaybe True <$> optBool "db-timezone-enabled")
|
|
||||||
<*> parseTxEnd "db-tx-end" snd
|
<*> parseTxEnd "db-tx-end" snd
|
||||||
<*> parseTxEnd "db-tx-end" fst
|
<*> parseTxEnd "db-tx-end" fst
|
||||||
<*> (fromMaybe "postgresql://" <$> optString "db-uri")
|
<*> (fromMaybe "postgresql://" <$> optString "db-uri")
|
||||||
@@ -737,9 +734,6 @@ exampleConfigFile = S.unlines
|
|||||||
, "## The name of which database schema to expose to REST clients"
|
, "## The name of which database schema to expose to REST clients"
|
||||||
, "db-schemas = \"public\""
|
, "db-schemas = \"public\""
|
||||||
, ""
|
, ""
|
||||||
, "## Enable quering pg_timezone_names from db"
|
|
||||||
, "# db-timezone-enabled = true"
|
|
||||||
, ""
|
|
||||||
, "## How to terminate database transactions"
|
, "## How to terminate database transactions"
|
||||||
, "## Possible values are:"
|
, "## Possible values are:"
|
||||||
, "## commit (default)"
|
, "## commit (default)"
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ dbSettingsNames =
|
|||||||
,"db_prepared_statements"
|
,"db_prepared_statements"
|
||||||
,"db_root_spec"
|
,"db_root_spec"
|
||||||
,"db_schemas"
|
,"db_schemas"
|
||||||
,"db_timezone_enabled"
|
|
||||||
,"db_tx_end"
|
,"db_tx_end"
|
||||||
,"db_hoisted_tx_settings"
|
,"db_hoisted_tx_settings"
|
||||||
,"jwt_aud"
|
,"jwt_aud"
|
||||||
|
|||||||
@@ -160,15 +160,13 @@ querySchemaCache pgVer conf@AppConfig{..} = do
|
|||||||
cRels <- sqlTimedStmt gucCRels mempty allComputedRels
|
cRels <- sqlTimedStmt gucCRels mempty allComputedRels
|
||||||
reps <- sqlTimedStmt gucDReps conf dataRepresentations
|
reps <- sqlTimedStmt gucDReps conf dataRepresentations
|
||||||
mHdlers <- sqlTimedStmt gucMHdrs conf mediaHandlers
|
mHdlers <- sqlTimedStmt gucMHdrs conf mediaHandlers
|
||||||
tzones <- if configDbTimezoneEnabled
|
tzones <- sqlTimedStmt gucTzones mempty timezones
|
||||||
then sqlTimedStmt gucTzones mempty timezones
|
|
||||||
else pure S.empty
|
|
||||||
|
|
||||||
for_ configInternalSCQuerySleepSnd (`SQL.statement` sleepCall) -- only used for testing
|
for_ configInternalSCQuerySleepSnd (`SQL.statement` sleepCall) -- only used for testing
|
||||||
|
|
||||||
qsTime <-
|
qsTime <-
|
||||||
if isLogDebug
|
if isLogDebug
|
||||||
then Just <$> SQL.statement mempty (extractTimings configDbTimezoneEnabled)
|
then Just <$> SQL.statement mempty (extractTimings True)
|
||||||
else pure Nothing
|
else pure Nothing
|
||||||
|
|
||||||
let tabsWViewsPks = addViewPrimaryKeys tabs keyDeps
|
let tabsWViewsPks = addViewPrimaryKeys tabs keyDeps
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ db-pre-request = "check_alias"
|
|||||||
db-prepared-statements = true
|
db-prepared-statements = true
|
||||||
db-root-spec = "open_alias"
|
db-root-spec = "open_alias"
|
||||||
db-schemas = "provided_through_alias"
|
db-schemas = "provided_through_alias"
|
||||||
db-timezone-enabled = true
|
|
||||||
db-tx-end = "commit"
|
db-tx-end = "commit"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
jwt-aud = ""
|
jwt-aud = ""
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ db-pre-request = ""
|
|||||||
db-prepared-statements = false
|
db-prepared-statements = false
|
||||||
db-root-spec = ""
|
db-root-spec = ""
|
||||||
db-schemas = "public"
|
db-schemas = "public"
|
||||||
db-timezone-enabled = true
|
|
||||||
db-tx-end = "commit"
|
db-tx-end = "commit"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
jwt-aud = ""
|
jwt-aud = ""
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ db-pre-request = ""
|
|||||||
db-prepared-statements = false
|
db-prepared-statements = false
|
||||||
db-root-spec = ""
|
db-root-spec = ""
|
||||||
db-schemas = "public"
|
db-schemas = "public"
|
||||||
db-timezone-enabled = true
|
|
||||||
db-tx-end = "commit"
|
db-tx-end = "commit"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
jwt-aud = ""
|
jwt-aud = ""
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ db-pre-request = ""
|
|||||||
db-prepared-statements = true
|
db-prepared-statements = true
|
||||||
db-root-spec = ""
|
db-root-spec = ""
|
||||||
db-schemas = "public"
|
db-schemas = "public"
|
||||||
db-timezone-enabled = true
|
|
||||||
db-tx-end = "commit"
|
db-tx-end = "commit"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
jwt-aud = ""
|
jwt-aud = ""
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ db-pre-request = "test.other_custom_headers"
|
|||||||
db-prepared-statements = false
|
db-prepared-statements = false
|
||||||
db-root-spec = "other_root"
|
db-root-spec = "other_root"
|
||||||
db-schemas = "test,other_tenant1,other_tenant2"
|
db-schemas = "test,other_tenant1,other_tenant2"
|
||||||
db-timezone-enabled = false
|
|
||||||
db-tx-end = "rollback-allow-override"
|
db-tx-end = "rollback-allow-override"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
jwt-aud = "https://otherexample.org"
|
jwt-aud = "https://otherexample.org"
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ db-pre-request = "test.custom_headers"
|
|||||||
db-prepared-statements = false
|
db-prepared-statements = false
|
||||||
db-root-spec = "root"
|
db-root-spec = "root"
|
||||||
db-schemas = "test,tenant1,tenant2"
|
db-schemas = "test,tenant1,tenant2"
|
||||||
db-timezone-enabled = false
|
|
||||||
db-tx-end = "commit-allow-override"
|
db-tx-end = "commit-allow-override"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
jwt-aud = "https://example.org"
|
jwt-aud = "https://example.org"
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ db-pre-request = "please_run_fast"
|
|||||||
db-prepared-statements = false
|
db-prepared-statements = false
|
||||||
db-root-spec = "openapi_v3"
|
db-root-spec = "openapi_v3"
|
||||||
db-schemas = "multi,tenant,setup"
|
db-schemas = "multi,tenant,setup"
|
||||||
db-timezone-enabled = false
|
|
||||||
db-tx-end = "rollback-allow-override"
|
db-tx-end = "rollback-allow-override"
|
||||||
db-uri = "tmp_db"
|
db-uri = "tmp_db"
|
||||||
jwt-aud = "https://postgrest.org"
|
jwt-aud = "https://postgrest.org"
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ db-pre-request = ""
|
|||||||
db-prepared-statements = true
|
db-prepared-statements = true
|
||||||
db-root-spec = ""
|
db-root-spec = ""
|
||||||
db-schemas = "public"
|
db-schemas = "public"
|
||||||
db-timezone-enabled = true
|
|
||||||
db-tx-end = "commit"
|
db-tx-end = "commit"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
jwt-aud = ""
|
jwt-aud = ""
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ db-pre-request = ""
|
|||||||
db-prepared-statements = true
|
db-prepared-statements = true
|
||||||
db-root-spec = ""
|
db-root-spec = ""
|
||||||
db-schemas = "public"
|
db-schemas = "public"
|
||||||
db-timezone-enabled = true
|
|
||||||
db-tx-end = "commit"
|
db-tx-end = "commit"
|
||||||
db-uri = "postgresql://"
|
db-uri = "postgresql://"
|
||||||
jwt-aud = ""
|
jwt-aud = ""
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ PGRST_DB_ROOT_SPEC: openapi_v3
|
|||||||
PGRST_DB_SCHEMAS: multi, tenant,setup
|
PGRST_DB_SCHEMAS: multi, tenant,setup
|
||||||
PGRST_DB_CONFIG: false
|
PGRST_DB_CONFIG: false
|
||||||
PGRST_DB_PRE_CONFIG: "postgrest.pre_config"
|
PGRST_DB_PRE_CONFIG: "postgrest.pre_config"
|
||||||
PGRST_DB_TIMEZONE_ENABLED: false
|
|
||||||
PGRST_DB_TX_END: rollback-allow-override
|
PGRST_DB_TX_END: rollback-allow-override
|
||||||
PGRST_DB_URI: tmp_db
|
PGRST_DB_URI: tmp_db
|
||||||
PGRST_DB_USE_LEGACY_GUCS: false
|
PGRST_DB_USE_LEGACY_GUCS: false
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ db-root-spec = "openapi_v3"
|
|||||||
db-schemas = "multi, tenant,setup"
|
db-schemas = "multi, tenant,setup"
|
||||||
db-config = false
|
db-config = false
|
||||||
db-pre-config = "postgrest.pre_config"
|
db-pre-config = "postgrest.pre_config"
|
||||||
db-timezone-enabled = false
|
|
||||||
db-tx-end = "rollback-allow-override"
|
db-tx-end = "rollback-allow-override"
|
||||||
db-uri = "tmp_db"
|
db-uri = "tmp_db"
|
||||||
jwt-aud = "https://postgrest.org"
|
jwt-aud = "https://postgrest.org"
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ ALTER ROLE db_config_authenticator SET pgrst.db_pre_request = 'test.custom_heade
|
|||||||
ALTER ROLE db_config_authenticator SET pgrst.db_prepared_statements = 'false';
|
ALTER ROLE db_config_authenticator SET pgrst.db_prepared_statements = 'false';
|
||||||
ALTER ROLE db_config_authenticator SET pgrst.db_root_spec = 'root';
|
ALTER ROLE db_config_authenticator SET pgrst.db_root_spec = 'root';
|
||||||
ALTER ROLE db_config_authenticator SET pgrst.db_schemas = 'test, tenant1, tenant2';
|
ALTER ROLE db_config_authenticator SET pgrst.db_schemas = 'test, tenant1, tenant2';
|
||||||
ALTER ROLE db_config_authenticator SET pgrst.db_timezone_enabled = 'false';
|
|
||||||
ALTER ROLE db_config_authenticator SET pgrst.db_tx_end = 'commit-allow-override';
|
ALTER ROLE db_config_authenticator SET pgrst.db_tx_end = 'commit-allow-override';
|
||||||
ALTER ROLE db_config_authenticator SET pgrst.jwt_aud = 'https://example.org';
|
ALTER ROLE db_config_authenticator SET pgrst.jwt_aud = 'https://example.org';
|
||||||
ALTER ROLE db_config_authenticator SET pgrst.jwt_cache_max_entries = '86400';
|
ALTER ROLE db_config_authenticator SET pgrst.jwt_cache_max_entries = '86400';
|
||||||
@@ -71,7 +70,6 @@ ALTER ROLE other_authenticator SET pgrst.db_pre_request = 'test.other_custom_hea
|
|||||||
ALTER ROLE other_authenticator SET pgrst.db_prepared_statements = 'false';
|
ALTER ROLE other_authenticator SET pgrst.db_prepared_statements = 'false';
|
||||||
ALTER ROLE other_authenticator SET pgrst.db_root_spec = 'other_root';
|
ALTER ROLE other_authenticator SET pgrst.db_root_spec = 'other_root';
|
||||||
ALTER ROLE other_authenticator SET pgrst.db_schemas = 'test, other_tenant1, other_tenant2';
|
ALTER ROLE other_authenticator SET pgrst.db_schemas = 'test, other_tenant1, other_tenant2';
|
||||||
ALTER ROLE other_authenticator SET pgrst.db_timezone_enabled = 'false';
|
|
||||||
ALTER ROLE other_authenticator SET pgrst.jwt_aud = 'https://otherexample.org';
|
ALTER ROLE other_authenticator SET pgrst.jwt_aud = 'https://otherexample.org';
|
||||||
ALTER ROLE other_authenticator SET pgrst.jwt_secret = 'ODERREALLYREALLYREALLYREALLYVERYSAFE';
|
ALTER ROLE other_authenticator SET pgrst.jwt_secret = 'ODERREALLYREALLYREALLYREALLYVERYSAFE';
|
||||||
ALTER ROLE other_authenticator SET pgrst.jwt_secret_is_base64 = 'false';
|
ALTER ROLE other_authenticator SET pgrst.jwt_secret_is_base64 = 'false';
|
||||||
|
|||||||
+2
-8
@@ -994,16 +994,13 @@ def test_schema_cache_query_sleep_logs(defaultenv):
|
|||||||
assert 1000 < observed_ms < 2000
|
assert 1000 < observed_ms < 2000
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("timezone_enabled", ["true", "false"])
|
|
||||||
@pytest.mark.parametrize("level", ["crit", "error", "warn", "info", "debug"])
|
@pytest.mark.parametrize("level", ["crit", "error", "warn", "info", "debug"])
|
||||||
def test_schema_cache_query_timings_log(level, timezone_enabled, defaultenv):
|
def test_schema_cache_query_timings_log(level, defaultenv):
|
||||||
"Schema cache query timings should be logged on log-level=debug."
|
"Schema cache query timings should be logged on log-level=debug."
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
**defaultenv,
|
**defaultenv,
|
||||||
"PGRST_LOG_LEVEL": level,
|
"PGRST_LOG_LEVEL": level,
|
||||||
# when this is disabled, it should log 0 for tzones
|
|
||||||
"PGRST_DB_TIMEZONE_ENABLED": timezone_enabled,
|
|
||||||
}
|
}
|
||||||
# here we also capture the tzones: <value> ms
|
# here we also capture the tzones: <value> ms
|
||||||
log_pattern = re.compile(
|
log_pattern = re.compile(
|
||||||
@@ -1018,10 +1015,7 @@ def test_schema_cache_query_timings_log(level, timezone_enabled, defaultenv):
|
|||||||
|
|
||||||
if level == "debug":
|
if level == "debug":
|
||||||
assert len(timing_matches) == 1
|
assert len(timing_matches) == 1
|
||||||
if timezone_enabled == "false":
|
assert float(timing_matches[0].group(1)) > 0
|
||||||
assert float(timing_matches[0].group(1)) == 0
|
|
||||||
else:
|
|
||||||
assert float(timing_matches[0].group(1)) > 0
|
|
||||||
else:
|
else:
|
||||||
assert not timing_matches
|
assert not timing_matches
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ baseCfg = let secret = encodeUtf8 "reallyreallyreallyreallyverysafe" in
|
|||||||
, configDbSchemas = fromList ["test"]
|
, configDbSchemas = fromList ["test"]
|
||||||
, configDbConfig = False
|
, configDbConfig = False
|
||||||
, configDbPreConfig = Nothing
|
, configDbPreConfig = Nothing
|
||||||
, configDbTimezoneEnabled = True
|
|
||||||
, configDbUri = "postgresql://"
|
, configDbUri = "postgresql://"
|
||||||
, configFilePath = Nothing
|
, configFilePath = Nothing
|
||||||
, configJWKS = rightToMaybe $ parseSecret secret
|
, configJWKS = rightToMaybe $ parseSecret secret
|
||||||
|
|||||||
@@ -5,13 +5,12 @@ import Test.Hspec
|
|||||||
import Test.Hspec.Wai
|
import Test.Hspec.Wai
|
||||||
import Test.Hspec.Wai.JSON
|
import Test.Hspec.Wai.JSON
|
||||||
|
|
||||||
import PostgREST.Config (AppConfig (..))
|
|
||||||
|
|
||||||
import Protolude hiding (get)
|
import Protolude hiding (get)
|
||||||
import SpecHelper
|
import SpecHelper
|
||||||
|
|
||||||
enabledSpec :: SpecWithConfig
|
spec :: SpecWithConfig
|
||||||
enabledSpec withConfig = withConfig baseCfg $ describe "test Prefer: timezone with db-timezone-enabled is true" $ do
|
spec withConfig = withConfig baseCfg $
|
||||||
|
describe "test Prefer: timezone with db-timezone-enabled is true" $ do
|
||||||
context "test Prefer: timezone=America/Los_Angeles" $ do
|
context "test Prefer: timezone=America/Los_Angeles" $ do
|
||||||
it "should change timezone with handling=strict" $
|
it "should change timezone with handling=strict" $
|
||||||
request methodGet "/timestamps"
|
request methodGet "/timestamps"
|
||||||
@@ -59,34 +58,3 @@ enabledSpec withConfig = withConfig baseCfg $ describe "test Prefer: timezone wi
|
|||||||
{ matchStatus = 200
|
{ matchStatus = 200
|
||||||
, matchHeaders = [matchContentTypeJson
|
, matchHeaders = [matchContentTypeJson
|
||||||
, "Preference-Applied" <:> "handling=lenient"]}
|
, "Preference-Applied" <:> "handling=lenient"]}
|
||||||
|
|
||||||
|
|
||||||
disabledSpec :: SpecWithConfig
|
|
||||||
disabledSpec withConfig = withConfig (baseCfg { configDbTimezoneEnabled = False }) $
|
|
||||||
describe "test Prefer: timezone with db-timezone-enabled is false" $ do
|
|
||||||
context "test Prefer: timezone=America/Los_Angeles when timezone is disabled" $ do
|
|
||||||
it "should throw error with handling=strict" $
|
|
||||||
request methodGet "/timestamps"
|
|
||||||
[("Prefer", "handling=strict, timezone=America/Los_Angeles")]
|
|
||||||
""
|
|
||||||
`shouldRespondWith`
|
|
||||||
[json|{"code":"PGRST122","details":"Invalid preferences: timezone=America/Los_Angeles","hint":null,"message":"Invalid preferences given with handling=strict"}|]
|
|
||||||
{ matchStatus = 400 }
|
|
||||||
|
|
||||||
it "should return with default timezone without handling or with handling=lenient" $ do
|
|
||||||
request methodGet "/timestamps"
|
|
||||||
[("Prefer", "timezone=America/Los_Angeles")]
|
|
||||||
""
|
|
||||||
`shouldRespondWith`
|
|
||||||
[json|[{"t":"2023-10-18T12:37:59.611+00:00"}, {"t":"2023-10-18T14:37:59.611+00:00"}, {"t":"2023-10-18T16:37:59.611+00:00"}]|]
|
|
||||||
{ matchStatus = 200
|
|
||||||
, matchHeaders = [matchContentTypeJson]}
|
|
||||||
|
|
||||||
request methodGet "/timestamps"
|
|
||||||
[("Prefer", "handling=lenient, timezone=America/Los_Angeles")]
|
|
||||||
""
|
|
||||||
`shouldRespondWith`
|
|
||||||
[json|[{"t":"2023-10-18T12:37:59.611+00:00"}, {"t":"2023-10-18T14:37:59.611+00:00"}, {"t":"2023-10-18T16:37:59.611+00:00"}]|]
|
|
||||||
{ matchStatus = 200
|
|
||||||
, matchHeaders = [matchContentTypeJson
|
|
||||||
, "Preference-Applied" <:> "handling=lenient"]}
|
|
||||||
|
|||||||
+1
-2
@@ -149,7 +149,7 @@ main = do
|
|||||||
, ("Feature.Query.PlanSpec.spec" , Feature.Query.PlanSpec.spec)
|
, ("Feature.Query.PlanSpec.spec" , Feature.Query.PlanSpec.spec)
|
||||||
, ("Feature.Query.Preferences.HandlingSpec" , Feature.Query.Preferences.HandlingSpec.spec)
|
, ("Feature.Query.Preferences.HandlingSpec" , Feature.Query.Preferences.HandlingSpec.spec)
|
||||||
, ("Feature.Query.Preferences.MaxAffectedSpec" , Feature.Query.Preferences.MaxAffectedSpec.spec)
|
, ("Feature.Query.Preferences.MaxAffectedSpec" , Feature.Query.Preferences.MaxAffectedSpec.spec)
|
||||||
, ("Feature.Query.Preferences.TimezoneSpec.enabledSpec", Feature.Query.Preferences.TimezoneSpec.enabledSpec)
|
, ("Feature.Query.Preferences.TimezoneSpec" , Feature.Query.Preferences.TimezoneSpec.spec)
|
||||||
, ("Feature.Query.PreparedStatementsSpec.spec" , Feature.Query.PreparedStatementsSpec.spec)
|
, ("Feature.Query.PreparedStatementsSpec.spec" , Feature.Query.PreparedStatementsSpec.spec)
|
||||||
, ("Feature.Query.QueryLimitedSpec" , Feature.Query.QueryLimitedSpec.spec)
|
, ("Feature.Query.QueryLimitedSpec" , Feature.Query.QueryLimitedSpec.spec)
|
||||||
, ("Feature.Query.QuerySpec" , Feature.Query.QuerySpec.spec actualPgVersion)
|
, ("Feature.Query.QuerySpec" , Feature.Query.QuerySpec.spec actualPgVersion)
|
||||||
@@ -174,7 +174,6 @@ main = do
|
|||||||
parallel $ describe "Feature.ExtraSearchPathSpec" $ Feature.ExtraSearchPathSpec.spec withConfigDbs
|
parallel $ describe "Feature.ExtraSearchPathSpec" $ Feature.ExtraSearchPathSpec.spec withConfigDbs
|
||||||
parallel $ describe "Feature.Query.PostGISSpec" $ Feature.Query.PostGISSpec.spec withConfigDbs
|
parallel $ describe "Feature.Query.PostGISSpec" $ Feature.Query.PostGISSpec.spec withConfigDbs
|
||||||
parallel $ describe "Feature.Query.MultipleSchemaSpec" $ Feature.Query.MultipleSchemaSpec.spec withConfigDbs
|
parallel $ describe "Feature.Query.MultipleSchemaSpec" $ Feature.Query.MultipleSchemaSpec.spec withConfigDbs
|
||||||
parallel $ describe "Feature.Query.Preferences.TimezoneSpec.disabledSpec" $ Feature.Query.Preferences.TimezoneSpec.disabledSpec withConfigDbs
|
|
||||||
|
|
||||||
-- Note: the rollback tests can not run in parallel, because they test persistence and
|
-- Note: the rollback tests can not run in parallel, because they test persistence and
|
||||||
-- this results in race conditions
|
-- this results in race conditions
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ baseCfg = let secret = encodeUtf8 "reallyreallyreallyreallyverysafe" in
|
|||||||
, configDbSchemas = fromList ["test"]
|
, configDbSchemas = fromList ["test"]
|
||||||
, configDbConfig = False
|
, configDbConfig = False
|
||||||
, configDbPreConfig = Nothing
|
, configDbPreConfig = Nothing
|
||||||
, configDbTimezoneEnabled = True
|
|
||||||
, configDbUri = "postgresql://"
|
, configDbUri = "postgresql://"
|
||||||
, configFilePath = Nothing
|
, configFilePath = Nothing
|
||||||
, configJWKS = rightToMaybe $ parseSecret secret
|
, configJWKS = rightToMaybe $ parseSecret secret
|
||||||
|
|||||||
Reference in New Issue
Block a user