From 3bfea696426f929d60dcbdf8ee136e45c0b7c20f Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Wed, 26 Apr 2023 17:01:34 +0100 Subject: [PATCH] node: validate production in debug mode Ensure that the production repository is validated after fetching and performing deletions. This is to highlight any inconsistencies that may show up between fetching and deleting references. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-node/src/worker/fetch.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/radicle-node/src/worker/fetch.rs b/radicle-node/src/worker/fetch.rs index e6ba0d46..de89d6fc 100644 --- a/radicle-node/src/worker/fetch.rs +++ b/radicle-node/src/worker/fetch.rs @@ -398,6 +398,16 @@ impl<'a> StagingPhaseFinal<'a> { let head = production.set_identity_head()?; log::debug!(target: "worker", "'refs/rad/id' for {} set to {head}", production.id); + #[cfg(test)] + // N.b. This is to prevent us from shooting ourselves in the + // foot with storage inconsistencies. + radicle::debug_assert_matches!( + production.validate(), + Ok(()), + "repository {} is not valid", + production.id, + ); + Ok((updates, remotes)) }