From 1428a3aac8e4ef53331f4c7ed827449ad42385af Mon Sep 17 00:00:00 2001 From: lmangani Date: Sat, 5 Jul 2025 14:15:47 +0000 Subject: [PATCH 1/2] v1.3.1 + tests --- .../workflows/MainDistributionPipeline.yml | 4 +-- duckdb | 2 +- extension-ci-tools | 2 +- extension_config.cmake | 1 + test/sql/httpserver.test | 28 +++++++++++++++++++ test/sql/quack.test | 23 --------------- 6 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 test/sql/httpserver.test delete mode 100644 test/sql/quack.test diff --git a/.github/workflows/MainDistributionPipeline.yml b/.github/workflows/MainDistributionPipeline.yml index dbbde8f..9ed7c8b 100644 --- a/.github/workflows/MainDistributionPipeline.yml +++ b/.github/workflows/MainDistributionPipeline.yml @@ -19,8 +19,8 @@ jobs: name: Build extension binaries uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.3.0 with: - duckdb_version: v1.3.0 - ci_tools_version: v1.3.0 + duckdb_version: v1.3.1 + ci_tools_version: v1.3.1 extension_name: httpserver # duckdb-next-build: diff --git a/duckdb b/duckdb index 1986445..2063dda 160000 --- a/duckdb +++ b/duckdb @@ -1 +1 @@ -Subproject commit 19864453f7d0ed095256d848b46e7b8630989bac +Subproject commit 2063dda3e6bd955c364ce8e61939c6248a907be6 diff --git a/extension-ci-tools b/extension-ci-tools index 00831df..c1d18ec 160000 --- a/extension-ci-tools +++ b/extension-ci-tools @@ -1 +1 @@ -Subproject commit 00831df06713072df217d3fb2f6b5e0fae78742f +Subproject commit c1d18ec811d4fc74f68a122ee68387f13090eddc diff --git a/extension_config.cmake b/extension_config.cmake index 85a2669..b8fa578 100644 --- a/extension_config.cmake +++ b/extension_config.cmake @@ -8,3 +8,4 @@ duckdb_extension_load(httpserver # Any extra extensions that should be built # e.g.: duckdb_extension_load(json) +duckdb_extension_load(json) diff --git a/test/sql/httpserver.test b/test/sql/httpserver.test new file mode 100644 index 0000000..babb8f2 --- /dev/null +++ b/test/sql/httpserver.test @@ -0,0 +1,28 @@ +# name: test/sql/httpserver.test +# description: test httpserver extension +# group: [httpserver] + +statement ok +SET autoinstall_known_extensions=1; SET autoload_known_extensions=1 + +# Before we load the extension, this will fail +statement error +SELECT httpserve_start('0.0.0.0', 8123, ''); +---- +Catalog Error: Scalar Function with name httpserve_start does not exist! + +# Require statement will ensure this test is run with this extension loaded +require httpserver + +# Confirm the extension works +query I +SELECT httpserve_start('0.0.0.0', 8123, ''); +---- +HTTP server started on 0.0.0.0:8123 + +require json + +query I +SELECT * FROM read_json_auto('http://localhost:8123/?q=SELECT 1'); +---- +1 diff --git a/test/sql/quack.test b/test/sql/quack.test deleted file mode 100644 index 519a354..0000000 --- a/test/sql/quack.test +++ /dev/null @@ -1,23 +0,0 @@ -# name: test/sql/quack.test -# description: test quack extension -# group: [quack] - -# Before we load the extension, this will fail -statement error -SELECT quack('Sam'); ----- -Catalog Error: Scalar Function with name quack does not exist! - -# Require statement will ensure this test is run with this extension loaded -require quack - -# Confirm the extension works -query I -SELECT quack('Sam'); ----- -Quack Sam 🐥 - -query I -SELECT quack_openssl_version('Michael') ILIKE 'Quack Michael, my linked OpenSSL version is OpenSSL%'; ----- -true From 90f45411d24ed11707bdcb08737cf58ba2d0bfad Mon Sep 17 00:00:00 2001 From: Lorenzo Mangani Date: Sat, 5 Jul 2025 16:34:23 +0200 Subject: [PATCH 2/2] Create httpserver_test.py --- test/python/httpserver_test.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/python/httpserver_test.py diff --git a/test/python/httpserver_test.py b/test/python/httpserver_test.py new file mode 100644 index 0000000..add8aeb --- /dev/null +++ b/test/python/httpserver_test.py @@ -0,0 +1,23 @@ +import duckdb +import os +import pytest + +# Get a fresh connection to DuckDB with the community extension binary loaded +@pytest.fixture +def duckdb_conn(): + extension_binary = os.getenv('HTTPSERVER_EXTENSION_BINARY_PATH') + if (extension_binary == ''): + raise Exception('Please make sure the `HTTPSERVER_EXTENSION_BINARY_PATH` is set to run the python tests') + conn = duckdb.connect('', config={'allow_unsigned_extensions': 'true'}) + conn.execute(f"load '{extension_binary}'") + return conn + +def test_quack(duckdb_conn): + duckdb_conn.execute("SELECT httpserve_start('0.0.0.0', 8123, '');"); + res = duckdb_conn.fetchall() + assert(res[0][0] == "HTTP server started on 0.0.0.0:8123"); + +def test_quack(duckdb_conn): + duckdb_conn.execute("SELECT * FROM read_json_auto('http://localhost:8123/?q=SELECT 1');"); + res = duckdb_conn.fetchall() + assert(res[0][0] == "1");