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:
Wolfgang Walther
2021-11-25 22:56:49 +01:00
committed by Remo
co-authored by Dmitry Wagin
parent 81f9bf290c
commit 4fb0d1279c
2 changed files with 14 additions and 0 deletions
+5
View File
@@ -494,6 +494,11 @@ spec actualPgVersion =
liftIO $ do
simpleStatus p `shouldBe` badRequest400
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
it "DELETE fails" $
+9
View File
@@ -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: -
--