Added empty window tests for Assets and Allocations api#102
Open
HardingEthan15 wants to merge 2 commits into
Open
Added empty window tests for Assets and Allocations api#102HardingEthan15 wants to merge 2 commits into
HardingEthan15 wants to merge 2 commits into
Conversation
Signed-off-by: HardingEthan15 <Ethan.Harding@ibm.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds integration tests that verify the assets and allocation APIs handle "empty window" queries gracefully—returning well-formed HTTP 200 responses with empty data rather than panicking or returning 5xx errors.
Changes:
- Added empty window integration tests for the assets API covering far-past, future, and beyond-retention windows across multiple asset types.
- Added empty window integration tests for the allocation API covering similar time windows across different aggregation levels.
- Updated bats test files to include the new test targets.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/integration/api/asset/test.bats | Registers the new asset empty window test |
| test/integration/api/asset/empty_window_test.go | New Go test validating assets API responses for data-less windows |
| test/integration/api/allocation/test.bats | Registers the new allocation empty window test |
| test/integration/api/allocation/empty_window_test.go | New Go test validating allocation API responses for data-less windows |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| name: "FarPastWindow", | ||
| window: "1970-01-01T00:00:00Z,1970-01-02T00:00:00Z", | ||
| aggregate: "namespace", |
Signed-off-by: HardingEthan15 <Ethan.Harding@ibm.com>
| { | ||
| name: "FarPastWindow", | ||
| window: "1970-01-01T00:00:00Z,1970-01-02T00:00:00Z", | ||
| aggregate: "namespace", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DESCRIPTION
Adds two empty windows tests for OpenCost api. These tests validate that the apis can handle windows where data does not exist.
CHANGES
Adds empty_window_test.go under test/integration/api/allocation
Adds to the test.bats file to run the empty window test
Adds empty_window_test.go under test/integration/api/asset
Adds to the test.bats file to run the empty window test
MOTIVATION
OpenCost should be able handle api calls for data that does not exist, and should return 2** responses with empty datasets instead of 5** responses or panics.
TESTING
These tests can be ran from the test.bats files in the allocation and asset folders.
Signed-off-by: [Ethan.Harding@ibm.com]