test: move db-pre-config with pg reserved word func to spec tests
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
This commit is contained in:
@@ -478,23 +478,6 @@
|
|||||||
pdSchema: public
|
pdSchema: public
|
||||||
pdVolatility: Volatile
|
pdVolatility: Volatile
|
||||||
|
|
||||||
- - qiName: 'true'
|
|
||||||
qiSchema: public
|
|
||||||
- - pdDescription: null
|
|
||||||
pdFuncSettings: []
|
|
||||||
pdHasVariadic: false
|
|
||||||
pdName: 'true'
|
|
||||||
pdParams: []
|
|
||||||
pdReturnType:
|
|
||||||
contents:
|
|
||||||
contents:
|
|
||||||
qiName: bool
|
|
||||||
qiSchema: pg_catalog
|
|
||||||
tag: Scalar
|
|
||||||
tag: Single
|
|
||||||
pdSchema: public
|
|
||||||
pdVolatility: Volatile
|
|
||||||
|
|
||||||
- - qiName: create_function
|
- - qiName: create_function
|
||||||
qiSchema: public
|
qiSchema: public
|
||||||
- - pdDescription: null
|
- - pdDescription: null
|
||||||
|
|||||||
@@ -251,10 +251,6 @@ select * from projects;
|
|||||||
create or replace view infinite_recursion as
|
create or replace view infinite_recursion as
|
||||||
select * from infinite_recursion;
|
select * from infinite_recursion;
|
||||||
|
|
||||||
create or replace function "true"() returns boolean as $_$
|
|
||||||
select true;
|
|
||||||
$_$ language sql;
|
|
||||||
|
|
||||||
create or replace function notify_pgrst() returns void as $$
|
create or replace function notify_pgrst() returns void as $$
|
||||||
notify pgrst;
|
notify pgrst;
|
||||||
$$ language sql;
|
$$ language sql;
|
||||||
|
|||||||
@@ -2037,19 +2037,6 @@ def test_connection_error_message_does_not_claim_retry(defaultenv):
|
|||||||
assert any('"message":"Database connection error."' in line for line in output)
|
assert any('"message":"Database connection error."' in line for line in output)
|
||||||
|
|
||||||
|
|
||||||
def test_db_pre_config_with_pg_reserved_words(defaultenv):
|
|
||||||
"The db-pre-config should not fail unexpectedly when function name is a postgres reserved word"
|
|
||||||
|
|
||||||
env = {
|
|
||||||
**defaultenv,
|
|
||||||
"PGRST_DB_PRE_CONFIG": "true", # call true function
|
|
||||||
}
|
|
||||||
|
|
||||||
with run(env=env) as postgrest:
|
|
||||||
response = postgrest.session.post("/rpc/true")
|
|
||||||
assert response.status_code == 200
|
|
||||||
|
|
||||||
|
|
||||||
def test_db_pre_config_with_non_existent_function(defaultenv):
|
def test_db_pre_config_with_non_existent_function(defaultenv):
|
||||||
"Log error when db-pre-config is set to non-existent function"
|
"Log error when db-pre-config is set to non-existent function"
|
||||||
|
|
||||||
|
|||||||
@@ -10,14 +10,16 @@ import Test.Hspec.Wai
|
|||||||
import Test.Hspec.Wai.JSON
|
import Test.Hspec.Wai.JSON
|
||||||
import Text.Heredoc
|
import Text.Heredoc
|
||||||
|
|
||||||
|
import PostgREST.Config (AppConfig (..))
|
||||||
import PostgREST.Config.PgVersion (PgVersion, pgVersion180)
|
import PostgREST.Config.PgVersion (PgVersion, pgVersion180)
|
||||||
|
import PostgREST.SchemaCache.Identifiers (QualifiedIdentifier (..))
|
||||||
|
|
||||||
import Protolude hiding (get)
|
import Protolude hiding (get)
|
||||||
import SpecHelper
|
import SpecHelper
|
||||||
|
|
||||||
spec :: PgVersion -> SpecWithConfig
|
spec :: PgVersion -> SpecWithConfig
|
||||||
spec actualPgVersion withConfig = withConfig baseCfg $
|
spec actualPgVersion withConfig = do
|
||||||
describe "remote procedure call" $ do
|
withConfig baseCfg $ describe "remote procedure call" $ do
|
||||||
context "a proc that returns a set" $ do
|
context "a proc that returns a set" $ do
|
||||||
context "returns paginated results" $ do
|
context "returns paginated results" $ do
|
||||||
it "using the Range header" $
|
it "using the Range header" $
|
||||||
@@ -1490,3 +1492,9 @@ spec actualPgVersion withConfig = withConfig baseCfg $
|
|||||||
`shouldRespondWith`
|
`shouldRespondWith`
|
||||||
[json| 1 |]
|
[json| 1 |]
|
||||||
{ matchStatus = 200 }
|
{ matchStatus = 200 }
|
||||||
|
|
||||||
|
withConfig baseCfg { configDbPreConfig = Just $ QualifiedIdentifier "test" "true" } $
|
||||||
|
it "should not fail when function name is a pg reserved word" $
|
||||||
|
request methodGet "/rpc/true"
|
||||||
|
[] ""
|
||||||
|
`shouldRespondWith` 200
|
||||||
|
|||||||
Vendored
+4
@@ -3877,3 +3877,7 @@ create or replace function custom_vary_hdr() returns void as $$
|
|||||||
perform set_config('response.headers', '[{"Vary": "X-Test-Accept"}]', false);
|
perform set_config('response.headers', '[{"Vary": "X-Test-Accept"}]', false);
|
||||||
end
|
end
|
||||||
$$ language plpgsql;
|
$$ language plpgsql;
|
||||||
|
|
||||||
|
create or replace function "true"() returns boolean as $_$
|
||||||
|
select true;
|
||||||
|
$_$ language sql;
|
||||||
|
|||||||
Reference in New Issue
Block a user