Test database schema stability (#7669)

This PR implements some heuristics to check for breaking database changes. The goal is to prevent accidental changes to the database schema occurring without a version bump.
This commit is contained in:
Michael Sproul
2025-06-30 20:55:47 +10:00
committed by GitHub
parent 25ea8a83b7
commit c1f94d9b7b
4 changed files with 157 additions and 1 deletions

View File

@@ -86,5 +86,9 @@ mod tests {
.unwrap();
let dht: PersistedDht = store.get_item(&DHT_DB_KEY).unwrap().unwrap();
assert_eq!(dht.enrs, enrs);
// This hardcoded length check is for database schema compatibility. If the on-disk format
// of `PersistedDht` changes, we need a DB schema change.
assert_eq!(dht.as_store_bytes().len(), 136);
}
}