mcp-forge/tests/integration/conftest.py

60 lines
1.8 KiB
Python
Raw Permalink Normal View History

"""Shared fixtures for integration tests."""
import pytest
from pathlib import Path
from mcp_forge.config.schema import (
ForgeConfig, ServerConfig, SecurityConfig, ExecutionConfig, SessionConfig,
ImageConfig, VolumeConfig, EnvironmentBuilderConfig, PackageValidationConfig
)
@pytest.fixture
def real_config(tmp_path):
"""Real configuration with all required fields for integration tests."""
# Create required files
(tmp_path / "allowlist.txt").write_text("requests\npandas\nnumpy\n")
(tmp_path / "blocklist.txt").write_text("")
config = ForgeConfig(
server=ServerConfig(
host="localhost",
port=3000,
podman_socket=Path("/run/user/1000/podman/podman.sock")
),
security=SecurityConfig(
audit_log=tmp_path / "audit.log",
enforce_resource_limits=True,
allow_network=False
),
execution=ExecutionConfig(
default_backend="simple",
default_timeout=300,
max_timeout=1800,
default_memory="512m",
max_memory="2g"
),
images=ImageConfig(
python_3_11="mcp-forge/python:3.11",
python_3_12="mcp-forge/python:3.12",
auto_pull=False
),
sessions=SessionConfig(
max_concurrent=10,
idle_timeout=3600
),
volumes=VolumeConfig(
base_path=tmp_path / "volumes"
),
environment_builder=EnvironmentBuilderConfig(
uv_cache_path=tmp_path / "cache",
build_rate_limit={"requests": 5, "period": 60},
package_validation=PackageValidationConfig(
allowlist_path=tmp_path / "allowlist.txt",
blocklist_path=tmp_path / "blocklist.txt"
)
),
mcp_tools={}
)
return config