Skip to content

Add some tests for MCP implementation and tools#2420

Merged
Hazel-Datastax merged 9 commits intomainfrom
hazel/mcp-tests
Mar 6, 2026
Merged

Add some tests for MCP implementation and tools#2420
Hazel-Datastax merged 9 commits intomainfrom
hazel/mcp-tests

Conversation

@Hazel-Datastax
Copy link
Contributor

@Hazel-Datastax Hazel-Datastax commented Mar 4, 2026

What this PR does:
Add some tests for MCP implementation and tools:

  • Unit tests for McpResource to verify CommandResult → ToolResponse mapping logic
  • Integration tests for GeneralCommandTools
  • General integration tests base - McpIntegrationTestBase

Which issue(s) this PR fixes:
Fixes #2408

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

📈 Unit Test Coverage Delta vs Main Branch

Metric Value
Main Branch 50.02%
This PR 50.04%
Delta 🟢 +0.02%
✅ Coverage improved!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Unit Test Coverage Report

Overall Project 50.04% -0.01% 🍏
Files changed 0%

File Coverage
DeleteOperationPage.java 80.53% 🍏
McpResource.java 0% -3.42%

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

📈 Integration Test Coverage Delta vs Main Branch (dse69-it)

Metric Value
Main Branch 70.35%
This PR 70.61%
Delta 🟢 +0.26%
✅ Coverage improved!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Integration Test Coverage Report (dse69-it)

Overall Project 70.61% -0.01% 🍏
Files changed 10%

File Coverage
DeleteOperationPage.java 66.32% 🍏
McpResource.java 43.39% -3.05%

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

📈 Integration Test Coverage Delta vs Main Branch (hcd-it)

Metric Value
Main Branch 72.09%
This PR 72.35%
Delta 🟢 +0.26%
✅ Coverage improved!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Integration Test Coverage Report (hcd-it)

Overall Project 72.35% -0.01% 🍏
Files changed 10%

File Coverage
DeleteOperationPage.java 66.32% 🍏
McpResource.java 43.39% -3.05%

(result.status() != null && !result.status().isEmpty())
? Map.of(MetaKey.of("status"), result.status())
: null;
: Map.of();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace null with empty list/map

Comment on lines +83 to +107
protected void createKeyspace(String keyspace) {
callToolAndAssert(
"createKeyspace", Map.of("name", keyspace), response -> assertFalse(response.isError()));
}

/** Drop a keyspace via the MCP dropKeyspace tool. */
protected void dropKeyspace(String keyspace) {
callToolAndAssert(
"dropKeyspace", Map.of("name", keyspace), response -> assertFalse(response.isError()));
}

/** Create a collection via the MCP createCollection tool. */
protected void createCollection(String keyspace, String collection) {
callToolAndAssert(
"createCollection",
Map.of("keyspace", keyspace, "collection", collection),
response -> assertFalse(response.isError()));
}

protected void dropCollection(String keyspace, String collection) {
callToolAndAssert(
"dropCollection",
Map.of("keyspace", keyspace, "collection", collection),
response -> assertFalse(response.isError()));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no usage for now, reserved for other tools IT

@Hazel-Datastax Hazel-Datastax changed the title Add MCP tests Add some tests for MCP implementation and tools Mar 6, 2026
@Hazel-Datastax Hazel-Datastax marked this pull request as ready for review March 6, 2026 20:15
@Hazel-Datastax Hazel-Datastax requested a review from a team as a code owner March 6, 2026 20:15
Copy link
Contributor

@tatu-at-datastax tatu-at-datastax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Hazel-Datastax Hazel-Datastax merged commit 73929bf into main Mar 6, 2026
3 checks passed
@Hazel-Datastax Hazel-Datastax deleted the hazel/mcp-tests branch March 6, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add MCP Support for Data API

2 participants