Skip to content

Commit ff437d5

Browse files
authored
v1.3.1 + tests (#43)
* v1.3.1 + tests * Create httpserver_test.py
1 parent 9a9800f commit ff437d5

File tree

7 files changed

+56
-27
lines changed

7 files changed

+56
-27
lines changed

.github/workflows/MainDistributionPipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
name: Build extension binaries
2020
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.3.0
2121
with:
22-
duckdb_version: v1.3.0
23-
ci_tools_version: v1.3.0
22+
duckdb_version: v1.3.1
23+
ci_tools_version: v1.3.1
2424
extension_name: httpserver
2525

2626
# duckdb-next-build:

duckdb

Submodule duckdb updated 4984 files

extension_config.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ duckdb_extension_load(httpserver
88

99
# Any extra extensions that should be built
1010
# e.g.: duckdb_extension_load(json)
11+
duckdb_extension_load(json)

test/python/httpserver_test.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import duckdb
2+
import os
3+
import pytest
4+
5+
# Get a fresh connection to DuckDB with the community extension binary loaded
6+
@pytest.fixture
7+
def duckdb_conn():
8+
extension_binary = os.getenv('HTTPSERVER_EXTENSION_BINARY_PATH')
9+
if (extension_binary == ''):
10+
raise Exception('Please make sure the `HTTPSERVER_EXTENSION_BINARY_PATH` is set to run the python tests')
11+
conn = duckdb.connect('', config={'allow_unsigned_extensions': 'true'})
12+
conn.execute(f"load '{extension_binary}'")
13+
return conn
14+
15+
def test_quack(duckdb_conn):
16+
duckdb_conn.execute("SELECT httpserve_start('0.0.0.0', 8123, '');");
17+
res = duckdb_conn.fetchall()
18+
assert(res[0][0] == "HTTP server started on 0.0.0.0:8123");
19+
20+
def test_quack(duckdb_conn):
21+
duckdb_conn.execute("SELECT * FROM read_json_auto('http://localhost:8123/?q=SELECT 1');");
22+
res = duckdb_conn.fetchall()
23+
assert(res[0][0] == "1");

test/sql/httpserver.test

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# name: test/sql/httpserver.test
2+
# description: test httpserver extension
3+
# group: [httpserver]
4+
5+
statement ok
6+
SET autoinstall_known_extensions=1; SET autoload_known_extensions=1
7+
8+
# Before we load the extension, this will fail
9+
statement error
10+
SELECT httpserve_start('0.0.0.0', 8123, '');
11+
----
12+
Catalog Error: Scalar Function with name httpserve_start does not exist!
13+
14+
# Require statement will ensure this test is run with this extension loaded
15+
require httpserver
16+
17+
# Confirm the extension works
18+
query I
19+
SELECT httpserve_start('0.0.0.0', 8123, '');
20+
----
21+
HTTP server started on 0.0.0.0:8123
22+
23+
require json
24+
25+
query I
26+
SELECT * FROM read_json_auto('http://localhost:8123/?q=SELECT 1');
27+
----
28+
1

test/sql/quack.test

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)