test: Add test to confirm ASSERT will return 500 Internal Server Error
Co-authored-by: Dmitry Wagin <dmitry.wagin@ya.ru>
This commit is contained in:
committed by
Remo
co-authored by
Dmitry Wagin
parent
81f9bf290c
commit
4fb0d1279c
@@ -494,6 +494,11 @@ spec actualPgVersion =
|
|||||||
liftIO $ do
|
liftIO $ do
|
||||||
simpleStatus p `shouldBe` badRequest400
|
simpleStatus p `shouldBe` badRequest400
|
||||||
isErrorFormat (simpleBody p) `shouldBe` True
|
isErrorFormat (simpleBody p) `shouldBe` True
|
||||||
|
it "treats plpgsql assert as internal server error" $ do
|
||||||
|
p <- post "/rpc/assert" "{}"
|
||||||
|
liftIO $ do
|
||||||
|
simpleStatus p `shouldBe` internalServerError500
|
||||||
|
isErrorFormat (simpleBody p) `shouldBe` True
|
||||||
|
|
||||||
context "unsupported verbs" $ do
|
context "unsupported verbs" $ do
|
||||||
it "DELETE fails" $
|
it "DELETE fails" $
|
||||||
|
|||||||
Vendored
+9
@@ -365,6 +365,15 @@ END;
|
|||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE FUNCTION assert() RETURNS void
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
ASSERT false, 'bad thing';
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: problem(); Type: FUNCTION; Schema: test; Owner: -
|
-- Name: problem(); Type: FUNCTION; Schema: test; Owner: -
|
||||||
--
|
--
|
||||||
|
|||||||
Reference in New Issue
Block a user