Skip to content

Add integration tests for new MCP efficiency tool step attribute - #109

Open
nikita-phantom-ops wants to merge 1 commit into
opencost:mainfrom
nikita-phantom-ops:add-mcp-efficiency-step-tests
Open

Add integration tests for new MCP efficiency tool step attribute#109
nikita-phantom-ops wants to merge 1 commit into
opencost:mainfrom
nikita-phantom-ops:add-mcp-efficiency-step-tests

Conversation

@nikita-phantom-ops

Copy link
Copy Markdown

Adding tests to address the new MCP efficiency_tool functionality with the step attribute added.
Tests include:

  • TestMCPEfficiencyStepConsistency: verifies costs and efficiency ratios match within tolerance for stepped and non-stepped results
  • TestMCPEfficiencyStepDoesNotOOM: running a real-world test case that we've encountered when a 7d window aggregation results in a OOM
  • TestMCPEfficiencyInvalidStep: validates that incorrect values for step are rejected

This PR is a follow up of opencost/opencost#3869

@nikita-phantom-ops
nikita-phantom-ops requested a review from a team as a code owner June 22, 2026 10:54
Copilot AI review requested due to automatic review settings June 22, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new Go integration-test file, test/integration/mcp/efficiency_step_test.go, covering the newly added step attribute on the MCP get_efficiency tool (follow-up to opencost/opencost#3869). It introduces a helper to call the tool over MCP/JSON-RPC and three test suites: step/no-step consistency, large-window OOM resilience, and rejection of invalid step values. It reuses the shared helpers (initializeMCPSession, getMCPURL, MCPResponse, abs) already present in helpers.go.

Changes:

  • Adds MCPEfficiencyRequest/MCPEfficiencyData types and callMCPEfficiencyTool to invoke the get_efficiency MCP tool.
  • Adds TestMCPEfficiencyStepConsistency, TestMCPEfficiencyStepDoesNotOOM, and TestMCPEfficiencyInvalidStep, plus a compareEfficiencyResults helper with cost/efficiency tolerance checks.
  • Note: the new file is not registered in test/integration/mcp/test.bats, so the CI harness (bats -r test/integration) will not execute these tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/integration/mcp/efficiency_step_test.go
Comment thread test/integration/mcp/efficiency_step_test.go Outdated
Comment thread test/integration/mcp/efficiency_step_test.go Outdated
@nikita-phantom-ops
nikita-phantom-ops force-pushed the add-mcp-efficiency-step-tests branch from 3ade8c4 to 4e4fa55 Compare June 22, 2026 14:21
Copilot AI review requested due to automatic review settings June 22, 2026 14:32
@nikita-phantom-ops
nikita-phantom-ops force-pushed the add-mcp-efficiency-step-tests branch from 4e4fa55 to 01f3bdb Compare June 22, 2026 14:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread test/integration/mcp/efficiency_step_test.go Outdated
Comment thread test/integration/mcp/test.bats Outdated
@nikita-phantom-ops
nikita-phantom-ops force-pushed the add-mcp-efficiency-step-tests branch from 01f3bdb to 40a8d42 Compare June 22, 2026 14:47
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.

2 participants