From 5fc2dcac54b535851398855bc1f5694436e38836 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Thu, 5 Dec 2024 14:50:34 -0800 Subject: [PATCH] note on testing --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a5e8db..cd66f0f 100644 --- a/README.md +++ b/README.md @@ -378,9 +378,17 @@ PG_CONFIG = /usr/lib/postgresql/14/bin/pg_config There is a build available at [postgresonline](http://www.postgresonline.com/journal/archives/371-http-extension.html), not maintained by me. +### Testing + +The integration tests are run with `make install && make installcheck` and expect to find a running instance of [httpbin](http://httpbin.org) at port 9080. The easiest way to get that is: + +``` +docker run -p 9080:80 kennethreitz/httpbin +``` + ## Why This is a Bad Idea -- "What happens if the web page takes a long time to return?" Your SQL call will just wait there until it does. Make sure your web service fails fast. Or (dangerous in a different way) run your query within [pg_background](https://github.com/vibhorkum/pg_background). +- "What happens if the web page takes a long time to return?" Your SQL call will just wait there until it does. Make sure your web service fails fast. Or (dangerous in a different way) run your query within [pg_background](https://github.com/vibhorkum/pg_background) or on a schedule with [pg_cron](https://github.com/citusdata/pg_cron). - "What if the web page returns junk?" Your SQL call will have to test for junk before doing anything with the payload. - "What if the web page never returns?" Set a short timeout, or send a cancel to the request, or just wait forever. - "What if a user queries a page they shouldn't?" Restrict function access, or just don't install a footgun like this extension where users can access it. @@ -388,5 +396,4 @@ There is a build available at [postgresonline](http://www.postgresonline.com/jou ## To Do - The new http://www.postgresql.org/docs/9.3/static/bgworker.html background worker support could be used to set up an HTTP request queue, so that pgsql-http can register a request and callback and then return immediately. -- Inevitably some web server will return gzip content (Content-Encoding) without being asked for it. Handling that gracefully would be good.