Azure / Azure/azure-sdk-for-rust

Cosmos: Harden container recreation tests

Open
#5,292 0 comments 1 reaction 0 assignees View on GitHub
Cosmos test
Dominant language
Rust
Stars
884
Forks
365
Avg merge
2d 19h
Merged PRs (30d)
112

Description

### Feature Summary

Expand container recreation coverage to verify both safe recovery and deterministic rejection when a name-addressed container is deleted and recreated with a different definition.

### Feature Description

PR #5219 implemented one-shot recovery for name-addressed container operations after a verified stale-generation response. Existing end-to-end coverage recreates the container with the same `/pk` partition-key path, leaving important generation-boundary behavior unverified.

Add focused tests that recreate a container under the same name with a new RID, a different partition-key path, and changed throughput. Cover at least:

- compatible point operations recovering once using refreshed metadata, routing, and session state;
- operations built with the old partition-key shape failing deterministically rather than reaching the replacement container;
- queries and transactional batches across the generation boundary;
- continuation tokens, explicit session tokens, stale EPK ranges, and other state that must not cross generations;
- throughput reads and replacements after recreation;
- the standard Gateway and appropriate emulator/live-test legs.

Acceptance criteria:

- tests demonstrate that safe operations recover at most once;
- generation-bound state is never silently retargeted;
- changed partition-key and throughput scenarios have positive and negative coverage;
- failures assert stable status/substatus behavior where the contract is defined;
- Gateway 2.0-specific work remains out of scope and is tracked separately.

### Use Case

Container delete-and-recreate workflows are rare but correctness-critical: stale clients must never send an operation intended for the old physical container to the replacement container.

### Alternatives

Rely on same-schema recreation tests and unit coverage. This does not validate the highest-risk changed-schema and stale-state scenarios end to end.

### Additional Context

Sub-issue of #3526. Related implementation and tracking: #4427, #5197, and PR #5219.

Contributor guide

Open the contributing guide

Research direction

Start by reading PR #5219 and the existing end-to-end container recreation coverage, then compare the standard Gateway with the emulator/live-test legs. Add focused cases for changed RID, partition-key, throughput, query, batch, token, session, and stale-range behavior; done means safe recovery happens at most once and incompatible state fails with the defined status and substatus.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, rust
Domain
databases, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.