From b92fa5a21161e7f1184c8cb8401c158eb42fd247 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Fri, 18 Sep 2026 18:46:57 -0500 Subject: [PATCH] test: simple pg_regress test pytest was added as a workaround before because we couldn't make pg_regress work, but this PR proves it does work. Related to https://github.com/supabase/pg_net/pull/293#issuecomment-5737423388. --- Makefile | 5 ++++- test/expected/http_get_wait.out | 18 ++++++++++++++++++ test/sql/http_get_wait.sql | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 test/expected/http_get_wait.out create mode 100644 test/sql/http_get_wait.sql diff --git a/Makefile b/Makefile index 0d1b0e35..532e323f 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,9 @@ $(EXTENSION).control: $(EXTENSION).control.in PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) +# otherwise contrib_regression is picked +CONTRIB_TESTDB = postgres + .PHONY: test test: - net-with-nginx python -m pytest -s -vv $(PYTEST_ARGS) + net-with-nginx make installcheck diff --git a/test/expected/http_get_wait.out b/test/expected/http_get_wait.out new file mode 100644 index 00000000..97ac5cb3 --- /dev/null +++ b/test/expected/http_get_wait.out @@ -0,0 +1,18 @@ +\set ON_ERROR_STOP on +BEGIN; +SELECT net.http_get('http://localhost:8080') AS request_id \gset +-- COMMIT is required otherwise the test runs forever +COMMIT; +SELECT (result).status, + (result).message, + ((result).response).status_code, + ((result).response).body +FROM ( + SELECT net._http_collect_response(:request_id, async := false) AS result +) AS response; + status | message | status_code | body +---------+---------+-------------+------------- + SUCCESS | ok | 200 | Hello world+ + | | | +(1 row) + diff --git a/test/sql/http_get_wait.sql b/test/sql/http_get_wait.sql new file mode 100644 index 00000000..466160da --- /dev/null +++ b/test/sql/http_get_wait.sql @@ -0,0 +1,14 @@ +\set ON_ERROR_STOP on + +BEGIN; +SELECT net.http_get('http://localhost:8080') AS request_id \gset +-- COMMIT is required otherwise the test runs forever +COMMIT; + +SELECT (result).status, + (result).message, + ((result).response).status_code, + ((result).response).body +FROM ( + SELECT net._http_collect_response(:request_id, async := false) AS result +) AS response;