Skip to content

test(mcp): fixed-plan cloud toolset has no tests for fixed databases or plans (24/27 tools untested) #997

Description

@joshrotenberg

Current state

crates/redisctl-mcp/src/tools/cloud/fixed.rs defines 27 tools.
Only 3 have tests in cloud_tools.rs:

  • create_fixed_subscription — request-shape test exists
  • update_fixed_subscription — request-shape test exists
  • delete_fixed_subscription — request-shape test exists

The following 24 tools have zero coverage:

Fixed plan (catalog) tools — read-only:

  • list_fixed_plans — GET /fixed/plans
  • get_fixed_plans_by_subscription — GET /subscriptions/{sub}/plans
  • get_fixed_plan — GET /fixed/plans/{id}
  • get_fixed_redis_versions — GET /fixed/redis-versions
  • list_fixed_subscriptions — GET /fixed/subscriptions
  • get_fixed_subscription — GET /fixed/subscriptions/{id}

Fixed database lifecycle:

  • list_fixed_databases — GET /fixed/subscriptions/{sub}/databases (read-only)
  • get_fixed_database — GET /fixed/subscriptions/{sub}/databases/{id} (read-only)
  • create_fixed_database — POST (write)
  • update_fixed_database — PUT (write)
  • delete_fixed_database — DELETE (destructive)

Fixed database operations:

  • get_fixed_database_backup_status — GET (read-only)
  • backup_fixed_database — POST (write)
  • get_fixed_database_import_status — GET (read-only)
  • import_fixed_database — POST (write)
  • get_fixed_database_slow_log — GET (read-only)
  • get_fixed_database_tags — GET (read-only)
  • create_fixed_database_tag — POST (write)
  • update_fixed_database_tag — PUT (write)
  • delete_fixed_database_tag — DELETE (destructive)
  • update_fixed_database_tags — PUT (write)
  • get_fixed_database_upgrade_versions — GET (read-only)
  • get_fixed_database_upgrade_status — GET (read-only)
  • upgrade_fixed_database_redis_version — POST (write)

Desired state

At minimum, one request-shape test per logical group:

  1. Fixed plan cataloglist_fixed_plans, get_fixed_plan, list_fixed_subscriptions, get_fixed_subscription
  2. Fixed database lifecyclelist_fixed_databases, get_fixed_database, create_fixed_database, delete_fixed_database
  3. Fixed database operationsbackup_fixed_database, get_fixed_database_backup_status
  4. Fixed database tags — follow the Pro subscription tag pattern (already covered)
  5. Fixed database upgradeget_fixed_database_upgrade_versions, upgrade_fixed_database_redis_version

create_fixed_database is the most important — it's the fixed-plan equivalent of
create_database and is a common path for fixed-plan deployments.

Code example

#[tokio::test]
async fn test_create_fixed_database_request_shape() {
    let server = MockCloudServer::start().await;

    // Verify POST to /fixed/subscriptions/{sub}/databases with required fields
    Mock::given(method("POST"))
        .and(path("/fixed/subscriptions/123/databases"))
        .and(body_partial_json(json!({
            "name": "demo-db"
        })))
        .respond_with(ResponseTemplate::new(202).set_body_json(json!({
            "taskId": "task-create-fixed-db",
            "status": "processing-in-progress"
        })))
        .mount(server.inner())
        .await;

    let client = server.client();
    let state = full_policy_state(client);
    let tool = cloud::create_fixed_database(state);

    let result = call_tool_text(&tool, json!({
        "subscription_id": 123,
        "name": "demo-db"
    })).await;

    assert!(result.contains("task-create-fixed-db") || result.contains("taskId"),
        "Expected task response for create_fixed_database, got: {result}");
}

#[tokio::test]
async fn test_list_fixed_plans_request_shape() {
    let server = MockCloudServer::start().await;

    Mock::given(method("GET"))
        .and(path("/fixed/plans"))
        .respond_with(ResponseTemplate::new(200).set_body_json(json!({
            "plans": []
        })))
        .mount(server.inner())
        .await;

    let client = server.client();
    let state = Arc::new(AppState::with_cloud_client(client));
    let tool = cloud::list_fixed_plans(state);

    let result = call_tool_text(&tool, json!({})).await;
    assert!(!result.contains("Failed"), "GET /fixed/plans should have matched, got: {result}");
}

Implementation notes

  • File: crates/redisctl-mcp/tests/cloud_tools.rs — add a new section for fixed tools
  • Check the actual URL paths in fixed.rs by grepping for the API client calls
    (e.g. handler.list_plans(), handler.create_database()) — the paths may use
    /fixed/ prefix or /subscriptions/{sub}/fixed/ depending on the redis-cloud client
  • The tag tools in fixed (create_fixed_database_tag, etc.) should mirror the Pro tag
    pattern already tested; just change the path prefix
  • Destructive tools (delete_fixed_database, delete_fixed_database_tag) need
    full_policy_state and safety-annotation assertions

Metadata

Metadata

Assignees

No one assigned

    Labels

    mcpRelated to the MCP servertestingRelated to tests and test coverage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions