Skip to content

Issue 82 cloud integration disables#111

Open
Aadarsh-Sankar wants to merge 2 commits into
opencost:mainfrom
Aadarsh-Sankar:issue-82-cloud-integration-disables
Open

Issue 82 cloud integration disables#111
Aadarsh-Sankar wants to merge 2 commits into
opencost:mainfrom
Aadarsh-Sankar:issue-82-cloud-integration-disables

Conversation

@Aadarsh-Sankar

Copy link
Copy Markdown

No description provided.

Aadarsh-Sankar and others added 2 commits June 22, 2026 10:42
Assert /cloudCost endpoints return HTTP 200 with empty data when billing
integration is not configured, and skip when integrations are present.

Fixes opencost#82

Signed-off-by: Aadarsh Sankar <aadarshsankar53@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Document test helpers and assertions, and restore the bats runner
for the config integration test.

Signed-off-by: Aadarsh Sankar <aadarshsankar53@gmail.com>
Copilot AI review requested due to automatic review settings June 22, 2026 15:46
@Aadarsh-Sankar
Aadarsh-Sankar requested a review from a team as a code owner June 22, 2026 15:46

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 integration test (issue #82) verifying that OpenCost's cloud-cost endpoints behave deterministically when no cloud billing integration is configured. It introduces a config test package and a corresponding bats runner. The test probes /cloudCost/status to confirm no integrations are configured (skipping gracefully on a 404/unconfigured instance), then asserts that /cloudCost, /cloudCost/autocomplete, and /cloudCost/status all return HTTP 200 with empty data and never a 500. This aligns with the acceptance criteria in issue #82 (deterministic, non-500 responses and a status endpoint that reports the integration as not configured).

Changes:

  • New Go test TestCloudCostWhenIntegrationDisabled covering the three cloud-cost endpoints when integration is disabled, reusing pkg/api helpers and skipping when the endpoints aren't deployed or integration is present.
  • New test.bats runner wiring the Go test into the bats suite.

Reviewed changes

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

File Description
test/integration/api/config/cloud_integration_disabled_test.go Adds the Go test asserting empty/deterministic responses from /cloudCost, /cloudCost/autocomplete, and /cloudCost/status with skip guards for undeployed/configured instances.
test/integration/api/config/test.bats Adds a bats test that runs the new Go test from the config directory.

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

Comment on lines +56 to +60
body := getCloudCostEndpoint(t, apiClient, "/cloudCost/autocomplete", api.AutocompleteRequest{ //get the cloud cost autocomplete endpoint
Window: defaultWindow,
Field: "service",
Limit: 1,
}) //get the cloud cost autocomplete endpoint
Comment on lines +118 to +122
t.Skipf(
"cloud billing integration is configured on %s (%d integration(s)); need instance without cloud integration", //if the cloud billing integration is configured, skip the test
env.GetDefaultURL(),
len(resp.Data),
) //if the cloud billing integration is configured, skip the test
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