Replace MinIO with SeaweedFS for S3 integration tests

This commit is contained in:
Yiorgis Gozadinos 2026-04-03 18:20:25 +03:00
parent 5e7a4ebae5
commit 367accb814
No known key found for this signature in database
5 changed files with 50 additions and 41 deletions

View file

@ -43,13 +43,13 @@ lancedb:
aws_secret_access_key: YOUR_SECRET_KEY
region: us-east-1
# S3-compatible (MinIO, Tigris, etc.)
# S3-compatible (SeaweedFS, Tigris, etc.)
lancedb:
uri: s3://my-bucket/my-table
storage_options:
endpoint: http://localhost:9000
aws_access_key_id: minioadmin
aws_secret_access_key: minioadmin
endpoint: http://localhost:8333
aws_access_key_id: YOUR_ACCESS_KEY
aws_secret_access_key: YOUR_SECRET_KEY
region: us-east-1
allow_http: "true"

View file

@ -1,22 +0,0 @@
services:
minio:
image: minio/minio
ports:
- "9000:9000"
- "9001:9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
command: server /data --console-address ":9001"
createbucket:
image: minio/mc
depends_on:
- minio
entrypoint: >
/bin/sh -c "
sleep 2;
mc alias set myminio http://minio:9000 minioadmin minioadmin;
mc mb myminio/test-bucket;
exit 0;
"

View file

@ -0,0 +1,18 @@
services:
seaweedfs:
image: chrislusf/seaweedfs
ports:
- "8333:8333"
command: server -s3 -s3.config=/etc/seaweedfs/s3-config.json
volumes:
- ./s3-config.json:/etc/seaweedfs/s3-config.json:ro
createbucket:
image: chrislusf/seaweedfs
depends_on:
- seaweedfs
entrypoint: >
/bin/sh -c "
sleep 3 &&
echo 's3.bucket.create -name test-bucket' | weed shell -master seaweedfs:9333
"

View file

@ -0,0 +1,14 @@
{
"identities": [
{
"name": "admin",
"credentials": [
{
"accessKey": "testkey",
"secretKey": "testsecret"
}
],
"actions": ["Admin", "Read", "Write", "List", "Tagging"]
}
]
}

View file

@ -1,7 +1,7 @@
# Start MinIO before running:
# docker compose -f tests/docker/docker-compose.minio.yml up -d
# Start SeaweedFS before running:
# docker compose -f tests/docker/docker-compose.s3.yml up -d
# Stop after:
# docker compose -f tests/docker/docker-compose.minio.yml down -v
# docker compose -f tests/docker/docker-compose.s3.yml down -v
import socket
from uuid import uuid4
@ -13,20 +13,20 @@ from haiku.rag.client import HaikuRAG
from haiku.rag.config.models import AppConfig, LanceDBConfig
from haiku.rag.store.engine import Store
MINIO_ENDPOINT = "http://localhost:9000"
MINIO_BUCKET = "test-bucket"
MINIO_STORAGE_OPTIONS = {
"aws_access_key_id": "minioadmin",
"aws_secret_access_key": "minioadmin",
"endpoint": MINIO_ENDPOINT,
S3_ENDPOINT = "http://localhost:8333"
S3_BUCKET = "test-bucket"
S3_STORAGE_OPTIONS = {
"endpoint": S3_ENDPOINT,
"region": "us-east-1",
"allow_http": "true",
"aws_access_key_id": "testkey",
"aws_secret_access_key": "testsecret",
}
def _minio_available() -> bool:
def _s3_available() -> bool:
try:
s = socket.create_connection(("localhost", 9000), timeout=1)
s = socket.create_connection(("localhost", 8333), timeout=1)
s.close()
return True
except OSError:
@ -36,7 +36,7 @@ def _minio_available() -> bool:
pytestmark = [
pytest.mark.integration,
pytest.mark.skipif(
not _minio_available(), reason="MinIO not running on localhost:9000"
not _s3_available(), reason="SeaweedFS not running on localhost:8333"
),
]
@ -45,8 +45,8 @@ def _make_config() -> AppConfig:
unique_prefix = uuid4().hex[:8]
return AppConfig(
lancedb=LanceDBConfig(
uri=f"s3://{MINIO_BUCKET}/test-{unique_prefix}",
storage_options=MINIO_STORAGE_OPTIONS,
uri=f"s3://{S3_BUCKET}/test-{unique_prefix}",
storage_options=S3_STORAGE_OPTIONS,
)
)
@ -129,7 +129,6 @@ async def test_client_delete_document(tmp_path):
@pytest.mark.asyncio
async def test_app_info(tmp_path, capsys):
config = _make_config()
# Initialize the database first
async with HaikuRAG(tmp_path / "unused", config=config, create=True) as rag:
await rag.create_document("Info test document.", uri="test://info")