Test: a store holding a schema the cache does not register opens and carries it

The corrupt-store test pinned the old refusal of an unknown schema at open.
Under C2a F2 that record is foreign: the store opens, lists it, and opening
still rewrites nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 20:52:08 +02:00
commit 7dd19baac3

View file

@ -659,9 +659,11 @@ namespace GameCult.Caching.Tests
writer.FlushAllBackingStores();
}
// A record of a schema this cache does not register is not corruption: the store opens and carries it (ForeignRecordTests).
var bytes = File.ReadAllBytes(unknown);
using var narrow = new CultCache(CultDocumentRegistry.ForTypes(new[] { typeof(Counter) }));
Assert.That(() => narrow.AddBackingStore(new SingleFileMessagePackBackingStore(unknown)), Throws.Exception, "a store with an unknown schema opened");
narrow.AddBackingStore(new SingleFileMessagePackBackingStore(unknown));
Assert.That(narrow.BackingStores.Single().ForeignRecords, Has.Count.EqualTo(1));
Assert.That(File.ReadAllBytes(unknown), Is.EqualTo(bytes), "opening rewrote a store with an unknown schema");
}