You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[cr-test] test: share one database across the demand-matching cases - #1497
observed_demand_release_matching_characterization (cluster-pool) cloned a fresh test database for each of its ten cases. On CI it took 2.7 to 4.7 s: over the 2 s limit on every recent Rust tests run, and once over the 4 s failure bound from #1408. A run over that bound fails the Rust tests job of whichever pull request is running, whether or not it touches cluster-pool.
The cases now share one database. The releases and the policy are seeded once. Each case first deletes the template's sandboxes and every pool config, so it starts from the state a fresh database gave it. The cases and their expectations are unchanged.
Validation
At this head, on a dev box with Docker Postgres:
cargo fmt and cluster-pool clippy with all features and -D warnings pass. nextest passes all 75 cluster-pool tests.
This test, 20 runs each: before (main 95e0e7348), min 1.528 s, median 1.533 s, max 1.540 s; after, min 0.229 s, median 0.232 s, max 0.234 s. With the whole crate running in parallel, it took 0.16 s in each of 3 runs.
Sensitivity:
Changing the sha256:99… case's expected release fails the test on that case.
Dropping the sandbox delete fails it: demand from earlier cases accumulates.
Dropping the config delete does not fail it, because each autoscale step already retires the previous case's configs. The delete stays, so each case starts as on a fresh database rather than relying on that.
The CI timing at this head is in this PR's Rust tests job.
Severity and risk
Severity: low to medium. The test does not fail on its own merits, but an over-bound run fails unrelated pull requests at random.
Risk: test-only. A case could now see state an earlier case left. The deletes cover the rows the step reads, and the sensitivity checks above show the sandbox delete is what keeps cases apart. Roll back by reverting.
AI assistance: Claude Code drafted the change and this description, and ran the timing and sensitivity checks.
No actionable comments were generated in the recent review.
Walkthrough
The characterization test now reuses one PostgreSQL fixture and resolver-release set, and upserts the policy once before the case loop. Before each case, it clears the fixture template’s sandboxes and all pool configs, then updates the template’s desired state. Demand insertion, autoscaling, and release assertions remain inside the loop.
Possibly related PRs
perplexityai/SPACE#1495: Both changes reuse one PostgreSQL fixture in observed_demand_release_matching_characterization.
This test-only fixture optimization preserves case isolation and does not introduce production risk.
Architecture risk: Low · up to 3c96f
The change affects 1 system.
Changed systems:crates
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — crates (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
observed — Modified behavior in crates/l30_storage/cluster/pool/src/tests.rs: The characterization test now creates the fixture and resolver releases once and upserts the policy before iterating. Each case clears that template’s sandboxes and all pool configs, then updates the template’s desired state; the former per-case fixture and release seeding, and per-case policy upsert, were removed.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title uses the bracketed lowercase area "cr-test" and a lowercase summary. It accurately describes sharing one database across the demand-matching test cases and has no trailing period, ticket ID,…
Description Follows The Pr Template
The description contains all required populated sections. "## Summary" explains the merge behavior, "## Validation" lists commands and results, "## Severity and risk" states severity and test-only ris…
Bug Fixes Name A Regression Test
PASS: The pull request changes only crates/l30_storage/cluster/pool/src/tests.rs. It reuses test fixtures and deletes test rows between cases. It does not fix application behavior, so the regression…
Weakened Safeguards Are Justified
PASS: The only changed file is the characterization test. The diff keeps all ten cases, demand insertion, autoscaling call, and expected-release assertion unchanged. It replaces per-case fixture creat…
Public-Safe Content
No public-safety violation is present. The diff changes only test setup in crates/l30_storage/cluster/pool/src/tests.rs; it contains no credentials, private URLs, workstation paths, resource identif…
Full details: Title check
Explanation
The title uses the bracketed lowercase area "cr-test" and a lowercase summary. It accurately describes sharing one database across the demand-matching test cases and has no trailing period, ticket ID, or internal link.
Full details: Description Follows The Pr Template
Explanation
The description contains all required populated sections. "## Summary" explains the merge behavior, "## Validation" lists commands and results, "## Severity and risk" states severity and test-only risk, and the line "AI assistance: Claude Code drafted the change and this description, and ran the timing and sensitivity checks." identifies the tool and its contributions.
Full details: Bug Fixes Name A Regression Test
Explanation
PASS: The pull request changes only crates/l30_storage/cluster/pool/src/tests.rs. It reuses test fixtures and deletes test rows between cases. It does not fix application behavior, so the regression-test requirement does not apply.
Full details: Weakened Safeguards Are Justified
Explanation
PASS: The only changed file is the characterization test. The diff keeps all ten cases, demand insertion, autoscaling call, and expected-release assertion unchanged. It replaces per-case fixture creation with explicit cleanup, and the PR description gives a specific performance reason for sharing the database; the adjacent comment documents the reset rationale. No test, assertion, lint, CI check, or repository guard is removed or weakened.
Full details: Public-Safe Content
Explanation
No public-safety violation is present. The diff changes only test setup in crates/l30_storage/cluster/pool/src/tests.rs; it contains no credentials, private URLs, workstation paths, resource identifiers, production data, or undisclosed security details. The title and description contain only generic test information and public-style issue references.
Recent review info
Automatic approval policy
Commit: 3c96fb9f8721.
Setting
Effective value
Source
Automatic approvals
Enabled
Global configuration
Merge risk
Low
Override 2
Security risk
Not set
Global configuration
Matching overrides (numbered as in the resolved configuration):
Any matching disabled override withholds approval, regardless of risk. Otherwise, the strictest explicitly set limit wins for each score. Limits omitted by all matching overrides inherit the global configuration.
Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.
Reviewing files that changed from the base of the PR and between 2f46733 and 3c96fb9.
Files selected for processing: 1
crates/l30_storage/cluster/pool/src/tests.rs
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 0 remain after this review.
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
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.
Summary
observed_demand_release_matching_characterization(cluster-pool) cloned a fresh test database for each of its ten cases. On CI it took 2.7 to 4.7 s: over the 2 s limit on every recent Rust tests run, and once over the 4 s failure bound from #1408. A run over that bound fails the Rust tests job of whichever pull request is running, whether or not it touches cluster-pool.The cases now share one database. The releases and the policy are seeded once. Each case first deletes the template's sandboxes and every pool config, so it starts from the state a fresh database gave it. The cases and their expectations are unchanged.
Validation
At this head, on a dev box with Docker Postgres:
cargo fmtand cluster-pool clippy with all features and-D warningspass. nextest passes all 75 cluster-pool tests.95e0e7348), min 1.528 s, median 1.533 s, max 1.540 s; after, min 0.229 s, median 0.232 s, max 0.234 s. With the whole crate running in parallel, it took 0.16 s in each of 3 runs.sha256:99…case's expected release fails the test on that case.The CI timing at this head is in this PR's Rust tests job.
Severity and risk
Severity: low to medium. The test does not fail on its own merits, but an over-bound run fails unrelated pull requests at random.
Risk: test-only. A case could now see state an earlier case left. The deletes cover the rows the step reads, and the sensitivity checks above show the sandbox delete is what keeps cases apart. Roll back by reverting.
AI assistance: Claude Code drafted the change and this description, and ran the timing and sensitivity checks.