diff options
| author | tv <tv@krebsco.de> | 2026-11-17 03:47:18 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-17 04:56:43 +0100 |
| commit | 1293142cc6d1dd97e0aaf4c558254406e68d4219 (patch) | |
| tree | 8f54278fa826df75d007c0ae6b01758dff866283 /src | |
| parent | cbe4d4384e9e11db903a6c25f1b339f6de01c766 (diff) | |
holding: the tests' other nodes write under writers of their own
A writer's changes are its first change's author's, so a node writing in a
test after another under the same writer wrote as that one: a decision by
another than the coordinator was taken as the coordinator's. Another node
now writes under a fresh writer. The proposal written again differs, as one
written the same makes no change.
Diffstat (limited to 'src')
| -rw-r--r-- | src/access/holding.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/access/holding.rs b/src/access/holding.rs index 4bef52a..798ba46 100644 --- a/src/access/holding.rs +++ b/src/access/holding.rs @@ -265,6 +265,14 @@ mod tests { node: &str, f: impl FnOnce(&mut Transaction<'_>) -> Result<(), StoreError>, ) -> Result<(), String> { + // Another node writes under a writer of its own: a writer's changes are its + // first's author's. + if doc + .get_author() + .is_some_and(|author| author.as_bytes() != node.as_bytes()) + { + doc.set_actor(crate::document::ActorId::random()); + } let before = doc.get_heads(); transact(doc, UnixMillis(1), &Writer { node, user: None }, f).unwrap(); let after = doc.get_heads(); @@ -501,7 +509,16 @@ mod tests { propose(&mut doc, "node-a", "r", "compact", "node-a"), Ok(()) ); - assert!(propose(&mut doc, "node-a", "r", "compact", "node-a").is_err()); + assert!( + judged(&mut doc, "node-a", |doc| { + store::write_path( + doc, + &meta::path(&[meta::REMAKES, "r", "proposal"]), + &json!({"coordinator": "node-a", "kind": "compact", "quorum": 2}), + ) + }) + .is_err() + ); assert!(propose(&mut doc, "node-a", "s", "replace", "node-a").is_err()); assert!(propose(&mut doc, "node-a", "s", "compact", "node-b").is_err()); assert_eq!(decide(&mut doc, "node-a", "r"), Ok(())); |
