Skip to content

Commit 7ad96fb

Browse files
pimpinclaude
andcommitted
Document tombstone_resurrection_test in README
Add comprehensive documentation for the new tombstone_resurrection_test example that validates the BC-994 soft_delete scenario. Documentation includes: - Runtime and features - What it tests (6 key validations) - Complete test scenario (9 steps) - Sync function logic being tested - Report location This test validates the complete flow from document resurrection after tombstone expiry to final purge via TTL, testing the logic from billeo-engine PR #7672 adapted for rapid testing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 70a76f5 commit 7ad96fb

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

examples/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,48 @@ $ cargo run --features=enterprise --example tombstone_purge_test
137137

138138
**Report location**: `test_results/test_run_<timestamp>_<commit_sha>/`
139139

140+
#### `tombstone_resurrection_test`
141+
Complete test for BC-994 scenario: validates soft_delete behavior when documents resurrect after central tombstone expiry.
142+
143+
**Runtime: ~75-80 minutes** (+ ~5 minutes for Docker rebuild)
144+
**Features**: Automatic Docker management, structured reporting, BC-994 logic validation
145+
146+
```shell
147+
$ cargo run --features=enterprise --example tombstone_resurrection_test
148+
```
149+
150+
**What it tests:**
151+
- ✅ Document deletion in central only (remains in cblite)
152+
- ✅ Central tombstone purge after 1 hour
153+
- ✅ Document resurrection via replication reset checkpoint
154+
- ✅ Sync function soft_delete routing (updatedAt > 1h → soft_deleted channel)
155+
- ✅ Auto-purge from cblite (document removed from accessible channels)
156+
- ✅ TTL-based purge from central (5 minutes for testing)
157+
158+
**Test scenario:**
159+
1. Create doc with updatedAt=NOW, replicate to central, STOP replication
160+
2. Delete doc from central only (cblite keeps it)
161+
3. Wait 65 minutes for tombstone purge + compact
162+
4. Verify central tombstone purged
163+
5. Restart replication with reset checkpoint → doc resurrects
164+
6. Verify sync function routes to "soft_deleted" channel
165+
7. Verify auto-purge removes doc from cblite
166+
8. Wait 6 minutes for TTL expiry + compact
167+
9. Verify doc purged from central
168+
169+
**Report location**: `test_results/test_run_<timestamp>_<commit_sha>/`
170+
171+
**Sync function logic tested** (from billeo-engine PR #7672):
172+
```javascript
173+
if (!oldDoc && doc.updatedAt) {
174+
if (updatedAt < now - 1hour) { // Adapted for testing
175+
channel("soft_deleted");
176+
expiry(5 * 60); // 5 minutes for testing
177+
return;
178+
}
179+
}
180+
```
181+
140182
### Utility functions
141183

142184
There are utility functions available in `examples/utils/` to interact with the Sync Gateway and Couchbase Server:

0 commit comments

Comments
 (0)