fix(clients): repair Python & Rust tests, add container test orchestration
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled

- Python: fix wire protocol test method names (bool_val -> bool, etc.)
- Python: make integration tests and example fully async with pytest-asyncio
- Rust: add tokio dev-dependency and convert integration tests to async/await
- Rust: update ping_test example to async
- Nim: remove committed ELF build artifact
- Docker: add BARADB_HOST/BARADB_PORT env vars to test containers
- Docker: fix docker-compose.test.yml usage (remove --abort-on-container-exit)
- Add scripts/test-clients.sh for sequential client test runs
- Remove docker-compose.test.yml from .gitignore so it is tracked
- Fix repository URLs in Python and Rust READMEs
This commit is contained in:
2026-05-14 23:35:45 +03:00
parent c55d3080cf
commit 359f945170
14 changed files with 311 additions and 129 deletions
+30 -29
View File
@@ -6,35 +6,36 @@ This script demonstrates common operations with the BaraDB Python client.
Run it while a BaraDB server is listening on localhost:9472.
"""
import asyncio
import sys
from baradb import Client, QueryBuilder, WireValue
def example_connection():
async def example_connection():
print("=== Connection ===")
client = Client("localhost", 9472)
client.connect()
await client.connect()
print(f"Connected: {client.is_connected()}")
print(f"Ping: {client.ping()}")
client.close()
print(f"Ping: {await client.ping()}")
await client.close()
print(f"Connected after close: {client.is_connected()}")
print()
def example_context_manager():
async def example_context_manager():
print("=== Context Manager ===")
with Client("localhost", 9472) as client:
async with Client("localhost", 9472) as client:
print(f"Inside context: {client.is_connected()}")
print(f"Ping: {client.ping()}")
print(f"Ping: {await client.ping()}")
print("Outside context: closed automatically")
print()
def example_simple_query():
async def example_simple_query():
print("=== Simple Query ===")
with Client("localhost", 9472) as client:
result = client.query("SELECT 42 as answer, 'BaraDB' as db")
async with Client("localhost", 9472) as client:
result = await client.query("SELECT 42 as answer, 'BaraDB' as db")
print(f"Columns: {result.columns}")
print(f"Rows: {result.rows}")
print(f"Row count: {result.row_count}")
@@ -43,15 +44,15 @@ def example_simple_query():
print()
def example_parameterized_query():
async def example_parameterized_query():
print("=== Parameterized Query ===")
with Client("localhost", 9472) as client:
result = client.query_params(
async with Client("localhost", 9472) as client:
result = await client.query_params(
"SELECT $1 as num, $2 as txt, $3 as flag",
[
WireValue.int64(123),
WireValue.string("hello world"),
WireValue.bool_val(True),
WireValue.bool(True),
],
)
for row in result:
@@ -59,9 +60,9 @@ def example_parameterized_query():
print()
def example_query_builder():
async def example_query_builder():
print("=== Query Builder ===")
with Client("localhost", 9472) as client:
async with Client("localhost", 9472) as client:
sql = (
QueryBuilder(client)
.select("id", "name")
@@ -75,10 +76,10 @@ def example_query_builder():
print()
def example_vector():
async def example_vector():
print("=== Vector Value ===")
with Client("localhost", 9472) as client:
result = client.query_params(
async with Client("localhost", 9472) as client:
result = await client.query_params(
"SELECT $1 as embedding",
[WireValue.vector([0.1, 0.2, 0.3, 0.4])],
)
@@ -87,34 +88,34 @@ def example_vector():
print()
def example_ddl_dml():
async def example_ddl_dml():
print("=== DDL & DML ===")
with Client("localhost", 9472) as client:
async with Client("localhost", 9472) as client:
# Clean up
try:
client.execute("DROP TABLE IF EXISTS demo_products")
await client.execute("DROP TABLE IF EXISTS demo_products")
except Exception as exc:
print(f"Cleanup warning: {exc}")
client.execute(
await client.execute(
"CREATE TABLE demo_products (id INT PRIMARY KEY, name STRING, price FLOAT)"
)
affected = client.execute(
affected = await client.execute(
"INSERT INTO demo_products (id, name, price) VALUES (1, 'Widget', 9.99)"
)
print(f"Insert affected rows: {affected}")
result = client.query("SELECT * FROM demo_products")
result = await client.query("SELECT * FROM demo_products")
print(f"Select returned {result.row_count} row(s)")
for row in result:
print(f" {row}")
client.execute("DROP TABLE demo_products")
await client.execute("DROP TABLE demo_products")
print("Table dropped")
print()
def main():
async def main():
print("BaraDB Python Client Examples")
print("Make sure BaraDB is running on localhost:9472")
print()
@@ -131,10 +132,10 @@ def main():
for fn in examples:
try:
fn()
await fn()
except Exception as exc:
print(f"ERROR in {fn.__name__}: {exc}", file=sys.stderr)
if __name__ == "__main__":
main()
asyncio.run(main())