Skip to content

Add unit tests for collectors, cloud storage, webhooks, and MCP #16

Closed

Description

@OkiriGabriel

Problem

Test coverage is narrow; docs reference integration tests that do not exist.

Current state

  • Only 6 test files under tests/; no tests for s3_storage.py, gcs_storage.py, azure_storage.py, devops_mcp/, or webhook auth
  • docs/PLATFORM_SUPPORT.md references pytest tests/integration/ -v but no tests/integration/ directory exists
  • tests/test_basic.py silently passes on exceptions in health/audit/K8s tests, masking failures
  • test_k8s_tools_dry_run and test_github_tools_mock are assert True stubs

Acceptance criteria

  • Add mocked tests for AWS/GCP/Azure/S3/GCS/Azure storage providers
  • Add FastAPI tests for all /webhook/* routes and /orgs/{org}/config
  • Add MCP registry smoke test (devops_mcp/registry.py)
  • Replace silent pass skips with explicit pytest.skip() or fixtures
  • Create tests/integration/ or remove doc reference

Files

  • tests/, docs/PLATFORM_SUPPORT.md, storage/, devops_mcp/, api/server.py

Activity

  1. added
    enhancement
    good first issue
    testing
    on Jul 16, 2026
  2. Maqbool61 commented on Jul 16, 2026

    @Maqbool61
    Contributor

    Hi @OkiriGabriel! I'd like to take this on in a single PR.

    I've read through the existing tests, storage/, devops_mcp/registry.py, api/server.py, and docs/PLATFORM_SUPPORT.md and have a clear plan:

    1. Storage provider tests (tests/test_storage.py)
    All three storage classes import their SDKs lazily inside __init__, so they're straightforward to mock with unittest.mock.patch:

    • S3Storage — mock boto3.client; test put_json, get_json, list_keys, delete
    • GCSStorage — mock google.cloud.storage.Client; same operations
    • AzureBlobStorage — mock azure.storage.blob.BlobServiceClient; same operations

    2. Webhook + org config API tests (tests/test_api.py)
    Using FastAPI's TestClient with mocked verify_github_signature and IncidentQueue:

    • POST /webhook/github — valid signature → 200, invalid signature → 401
    • POST /webhook/alertmanager — valid payload → 200
    • POST /webhook/manual — triggers enqueue
    • GET/POST/DELETE /orgs/{org}/docs and GET /orgs/{org}/config

    3. MCP registry smoke test (tests/test_mcp.py)

    • Mock FastMCP and DevOpsAgent; assert register_all_tools registers the expected tool names from AGENT_TOOLS

    4. Fix silent pass skips (tests/test_basic.py)

    • Replace bare except: pass in test_health_endpoint_structure, test_audit_endpoint_structure, TestK8sCollector with pytest.skip() or proper import guards
    • Replace assert True stubs in test_k8s_tools_dry_run and test_github_tools_mock with real mock-based assertions

    5. Fix doc reference (docs/PLATFORM_SUPPORT.md)

    • Create tests/integration/ with a README.md explaining these are manual-only tests requiring real credentials, so the doc reference is no longer broken

    Could you assign this to me?

  3. self-assigned this
    on Jul 16, 2026
  4. OkiriGabriel commented on Jul 16, 2026

    @OkiriGabriel
    CollaboratorAuthor

    Thanks @Maqbool61 assigned. Please fork the repo, branch from feat/add-mcp, and open a PR with Closes #16.
    Go ahead and open a draft PR from a fork and I’ll review. I’ll assign the issue once the PR is up.
    Note: tests/test_security.py already covers some webhook auth — extend rather than duplicate.
    Run pytest tests/ -v before opening the PR.

  5. OkiriGabriel commented on Jul 20, 2026

    @OkiriGabriel
    CollaboratorAuthor

    Update: @Maqbool61 delivered — see PR #30 (test coverage for storage, webhooks, MCP registry, test_basic fixes, and integration README). Review approved; merging once CI passes. Thanks for the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgood first issuetesting

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions