Skip to content

[TESTING][REGRESSION]: Add regression tests for gateway namespacing constraints #2520

@crivetimihai

Description

@crivetimihai

Context

PR #2507 updated unique constraints for Resources and Prompts to include gateway_id, allowing the same uri/name to exist across different gateways for the same team/owner.

Missing Test Coverage

1. Resources - Gateway Namespacing

  • Test: Same uri can be registered for different gateways (same team/owner)
  • Test: Same uri cannot be registered for the same gateway (same team/owner)
  • Test: Local resources (gateway_id=NULL) still enforce uniqueness per team/owner

2. Prompts - Gateway Namespacing

  • Test: Same name can be registered for different gateways (same team/owner)
  • Test: Same name cannot be registered for the same gateway (same team/owner)
  • Test: Local prompts (gateway_id=NULL) still enforce uniqueness per team/owner

3. Migration Idempotency

  • Test: Migration can run on fresh DB (tables from models.py)
  • Test: Migration can run on existing DB (upgrade path)
  • Test: Migration downgrade works correctly

Suggested Test Location

  • tests/unit/mcpgateway/services/test_resource_service.py
  • tests/unit/mcpgateway/services/test_prompt_service.py
  • tests/unit/mcpgateway/db/ (for migration tests)

Related

Metadata

Metadata

Assignees

Labels

SHOULDP2: Important but not vital; high-value items that are not crucial for the immediate releasepythonPython / backend development (FastAPI)test-automationAutomated testingwxowxo integration

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions