Replace MinIO with SeaweedFS for S3 integration tests
This commit is contained in:
parent
5e7a4ebae5
commit
367accb814
5 changed files with 50 additions and 41 deletions
|
|
@ -43,13 +43,13 @@ lancedb:
|
||||||
aws_secret_access_key: YOUR_SECRET_KEY
|
aws_secret_access_key: YOUR_SECRET_KEY
|
||||||
region: us-east-1
|
region: us-east-1
|
||||||
|
|
||||||
# S3-compatible (MinIO, Tigris, etc.)
|
# S3-compatible (SeaweedFS, Tigris, etc.)
|
||||||
lancedb:
|
lancedb:
|
||||||
uri: s3://my-bucket/my-table
|
uri: s3://my-bucket/my-table
|
||||||
storage_options:
|
storage_options:
|
||||||
endpoint: http://localhost:9000
|
endpoint: http://localhost:8333
|
||||||
aws_access_key_id: minioadmin
|
aws_access_key_id: YOUR_ACCESS_KEY
|
||||||
aws_secret_access_key: minioadmin
|
aws_secret_access_key: YOUR_SECRET_KEY
|
||||||
region: us-east-1
|
region: us-east-1
|
||||||
allow_http: "true"
|
allow_http: "true"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
"
|
|
||||||
18
tests/docker/docker-compose.s3.yml
Normal file
18
tests/docker/docker-compose.s3.yml
Normal 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
|
||||||
|
"
|
||||||
14
tests/docker/s3-config.json
Normal file
14
tests/docker/s3-config.json
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"identities": [
|
||||||
|
{
|
||||||
|
"name": "admin",
|
||||||
|
"credentials": [
|
||||||
|
{
|
||||||
|
"accessKey": "testkey",
|
||||||
|
"secretKey": "testsecret"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"actions": ["Admin", "Read", "Write", "List", "Tagging"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Start MinIO before running:
|
# Start SeaweedFS before running:
|
||||||
# docker compose -f tests/docker/docker-compose.minio.yml up -d
|
# docker compose -f tests/docker/docker-compose.s3.yml up -d
|
||||||
# Stop after:
|
# 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
|
import socket
|
||||||
from uuid import uuid4
|
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.config.models import AppConfig, LanceDBConfig
|
||||||
from haiku.rag.store.engine import Store
|
from haiku.rag.store.engine import Store
|
||||||
|
|
||||||
MINIO_ENDPOINT = "http://localhost:9000"
|
S3_ENDPOINT = "http://localhost:8333"
|
||||||
MINIO_BUCKET = "test-bucket"
|
S3_BUCKET = "test-bucket"
|
||||||
MINIO_STORAGE_OPTIONS = {
|
S3_STORAGE_OPTIONS = {
|
||||||
"aws_access_key_id": "minioadmin",
|
"endpoint": S3_ENDPOINT,
|
||||||
"aws_secret_access_key": "minioadmin",
|
|
||||||
"endpoint": MINIO_ENDPOINT,
|
|
||||||
"region": "us-east-1",
|
"region": "us-east-1",
|
||||||
"allow_http": "true",
|
"allow_http": "true",
|
||||||
|
"aws_access_key_id": "testkey",
|
||||||
|
"aws_secret_access_key": "testsecret",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _minio_available() -> bool:
|
def _s3_available() -> bool:
|
||||||
try:
|
try:
|
||||||
s = socket.create_connection(("localhost", 9000), timeout=1)
|
s = socket.create_connection(("localhost", 8333), timeout=1)
|
||||||
s.close()
|
s.close()
|
||||||
return True
|
return True
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|
@ -36,7 +36,7 @@ def _minio_available() -> bool:
|
||||||
pytestmark = [
|
pytestmark = [
|
||||||
pytest.mark.integration,
|
pytest.mark.integration,
|
||||||
pytest.mark.skipif(
|
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]
|
unique_prefix = uuid4().hex[:8]
|
||||||
return AppConfig(
|
return AppConfig(
|
||||||
lancedb=LanceDBConfig(
|
lancedb=LanceDBConfig(
|
||||||
uri=f"s3://{MINIO_BUCKET}/test-{unique_prefix}",
|
uri=f"s3://{S3_BUCKET}/test-{unique_prefix}",
|
||||||
storage_options=MINIO_STORAGE_OPTIONS,
|
storage_options=S3_STORAGE_OPTIONS,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -129,7 +129,6 @@ async def test_client_delete_document(tmp_path):
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_app_info(tmp_path, capsys):
|
async def test_app_info(tmp_path, capsys):
|
||||||
config = _make_config()
|
config = _make_config()
|
||||||
# Initialize the database first
|
|
||||||
async with HaikuRAG(tmp_path / "unused", config=config, create=True) as rag:
|
async with HaikuRAG(tmp_path / "unused", config=config, create=True) as rag:
|
||||||
await rag.create_document("Info test document.", uri="test://info")
|
await rag.create_document("Info test document.", uri="test://info")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue