Skip to main content
Glama
test_runtime.py2.99 kB
""" Test script for the Sectional MCP Panel runtime engine. """ import asyncio import sys import os import json from pathlib import Path # Add the project root to the Python path project_root = Path(__file__).parent.parent sys.path.append(str(project_root)) from src.runtime.runtime_engine import RuntimeEngine async def test_runtime_engine(): """Test the runtime engine functionality.""" print("Testing runtime engine...") # Initialize the runtime engine runtime_engine = RuntimeEngine() print("Runtime engine initialized") # Check if Docker is available if not runtime_engine.docker_client: print("Docker is not available. Some tests will be skipped.") else: print("Docker is available. Proceeding with container tests.") # Test starting a container if runtime_engine.docker_client: print("\nTesting container start:") server_name = "test-nginx" runtime_definition = { "type": "docker_image", "command": "nginx:latest", "args": [], "ports": [ { "containerPort": 80, "protocol": "TCP" } ] } effective_settings = { "environmentVars": { "TEST_ENV": "runtime_test" }, "resourceLimits": { "cpuLimit": 0.5, "memoryLimitMB": 128 }, "runtimeOptions": { "restartPolicy": "no", "maxRestarts": 3, "terminationGracePeriodSeconds": 30 } } success, message, process_id = await runtime_engine.start_server( server_name, runtime_definition, effective_settings ) print(f"Start result: {success}, Message: {message}") if success and process_id: print(f"Container started with process ID: {process_id}") # Test getting container status status = await runtime_engine.get_server_status(process_id) print(f"Container status: {status}") # Test stopping the container print("\nTesting container stop:") stop_success, stop_message = await runtime_engine.stop_server( server_name, process_id, force=False, timeout=10 ) print(f"Stop result: {stop_success}, Message: {stop_message}") # Verify container is stopped status = await runtime_engine.get_server_status(process_id) print(f"Container status after stop: {status}") else: print("Container start failed, skipping stop test") print("\nRuntime engine test completed") if __name__ == "__main__": asyncio.run(test_runtime_engine())

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rblake2320/sectional-mcp-panel'

If you have feedback or need assistance with the MCP directory API, please join our Discord server