Add aggregation cost conservation test#103
Open
Noah-Philip wants to merge 2 commits into
Open
Conversation
Signed-off-by: noah-philip <noahphilip06@outlook.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 a new integration test that validates cost conservation across different aggregation levels in the allocation API. It ensures that querying the same historical window with different aggregations (cluster, node, namespace, pod, container) yields consistent total costs within a defined tolerance.
Changes:
- Added a new Go test file that queries the allocation API at multiple aggregation levels and compares their total costs against the cluster-level baseline.
- Registered the new test in the bats test runner.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/integration/api/allocation/test.bats | Adds a new bats entry to run the aggregation cost conservation test. |
| test/integration/api/allocation/aggregation_cost_conservation_test.go | New test that fetches allocation totals for multiple aggregation levels and asserts they match the cluster total within tolerance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: noah-philip <noahphilip06@outlook.com>
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 an allocation aggregation cost conservation test.
The test queries the same completed historical window across multiple aggregation levels:
clusternodenamespacepodcontainerIt sums
totalCostfor each aggregation and verifies that each total matches the cluster total within a documented absolute-or-relative tolerance.Implementation
yesterdayto avoid live-window drift between sequential requestsincludeIdle=trueshareIdle=falseTesting
Using demo cluster:
go test -count=1 ./test/integration/api/allocation -run TestAllocationCostConservedAcrossAggregations -vbats test/integration/api/allocation/test.bats