Clarify and strengthen state invariant tests
All checks were successful
Build and Deploy Gateway / build-and-push (push) Successful in 13s
Build and Deploy Gateway / deploy (push) Successful in 6s

This commit is contained in:
2026-07-12 12:22:59 +03:00
parent 5e33360c92
commit 2a214fc28b
5 changed files with 76 additions and 5 deletions

View File

@@ -90,7 +90,7 @@ test('state v1 normalizes legacy storage and validates the canonical snapshot',
);
});
test('GET and domain mutations return one state shape with monotonic revisions', async (t) => {
test('data invariant: API mutations return one snapshot, increase revision and roll back subscription failures', async (t) => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'harbor-state-contract-'));
const binDir = path.join(dir, 'bin');
const config = {

View File

@@ -17,7 +17,7 @@ const fixture = (t) => {
return path.join(directory, 'state.json');
};
test('a failure before rename preserves the last successful file', (t) => {
test('data invariant: failure before rename preserves the last successful file', (t) => {
const filePath = fixture(t);
atomicWriteJson(filePath, { revision: 1 });
@@ -79,7 +79,7 @@ test('ambiguous legacy selectedTag explicitly requires a new choice', (t) => {
assert.equal(migrated.servers.length, 2);
});
test('corrupt JSON is preserved and replaced with an explicit recovery state', (t) => {
test('data invariant: corrupt JSON preserves original bytes and returns explicit recovery state', (t) => {
const filePath = fixture(t);
fs.writeFileSync(filePath, '{broken');