Cover postgres_instance_create_read_replica#177
Open
sdairs wants to merge 1 commit into
Open
Conversation
Adds a Read Replica phase to the postgres CRUD lifecycle test that exercises postgres_instance_create_read_replica end-to-end and verifies the replica is discoverable via list and get with the expected primary reference (provider + region, isPrimary=false). The phase is inserted before the primary Delete phase and tears the replica down explicitly first, because the live API refuses to delete a primary while replicas still reference it. To handle mid-test failure between create and the in-body teardown, CleanupRegistry now tracks replica ids separately and the cleanup pass deletes them before primaries. Closes #162 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ad9159e to
4029c02
Compare
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.
Summary
integration_postgres_test.rswith a Read Replica phase that exercisespostgres_instance_create_read_replicaend-to-end (create, poll-to-running, list+get verification including primary reference, explicit delete) before the primary Delete phase.CleanupRegistry(register_postgres_replica/unregister_postgres_replica); the cleanup pass deletes registered replicas before registered primaries, since the live API refuses to delete a primary while a replica still references it.Cleanup ordering
Two complementary mechanisms keep replicas torn down before primaries:
CleanupRegistry— the cleanup pass iteratespostgres_replica_idsto deletion before iteratingpostgres_ids. Registration happens immediately after the create call returns the id.unregister_postgres_replicakeeps the registry tidy on the happy path.Both paths are documented in code comments (
CleanupRegistrydoc-comment and the Read Replica phase header in the test).Test plan
cargo build -p clickhouse-cloud-apicargo clippy -p clickhouse-cloud-api --tests -- -D warnings(only pre-existing errors inspec_coverage_test.rsandintegration_test.rsremain; nothing in files touched by this PR)cargo test -p clickhouse-cloud-api(86 unit + 6 spec-coverage tests pass; integration_postgres test is#[ignore]per existing suite policy)Closes #162
🤖 Generated with Claude Code