Add local routing rules to Harbor
This commit is contained in:
@@ -33,9 +33,10 @@ test('a failure before rename preserves the last successful file', (t) => {
|
||||
);
|
||||
});
|
||||
|
||||
test('legacy state migrates to schema v1 and keeps a backup', (t) => {
|
||||
test('schema v1 state migrates to the current schema and keeps a backup', (t) => {
|
||||
const filePath = fixture(t);
|
||||
const legacy = {
|
||||
schemaVersion: 1,
|
||||
revision: 7,
|
||||
selectedTag: 'nl',
|
||||
servers: [{ tag: 'nl' }],
|
||||
@@ -49,9 +50,9 @@ test('legacy state migrates to schema v1 and keeps a backup', (t) => {
|
||||
|
||||
assert.equal(migrated.schemaVersion, STATE_SCHEMA_VERSION);
|
||||
assert.equal(migrated.appliedTag, 'nl');
|
||||
assert.equal(store.migration.fromVersion, 0);
|
||||
assert.equal(store.migration.fromVersion, 1);
|
||||
assert.deepEqual(JSON.parse(fs.readFileSync(store.migration.backupPath, 'utf8')), legacy);
|
||||
assert.equal(JSON.parse(fs.readFileSync(filePath, 'utf8')).schemaVersion, 1);
|
||||
assert.equal(JSON.parse(fs.readFileSync(filePath, 'utf8')).schemaVersion, STATE_SCHEMA_VERSION);
|
||||
});
|
||||
|
||||
test('corrupt JSON is preserved and replaced with an explicit recovery state', (t) => {
|
||||
@@ -63,11 +64,11 @@ test('corrupt JSON is preserved and replaced with an explicit recovery state', (
|
||||
});
|
||||
const recovered = store.read();
|
||||
|
||||
assert.equal(recovered.schemaVersion, 1);
|
||||
assert.equal(recovered.schemaVersion, STATE_SCHEMA_VERSION);
|
||||
assert.equal(recovered.revision, 0);
|
||||
assert.equal(store.recovery.kind, 'corrupt-json');
|
||||
assert.equal(fs.readFileSync(store.recovery.backupPath, 'utf8'), '{broken');
|
||||
assert.equal(JSON.parse(fs.readFileSync(filePath, 'utf8')).schemaVersion, 1);
|
||||
assert.equal(JSON.parse(fs.readFileSync(filePath, 'utf8')).schemaVersion, STATE_SCHEMA_VERSION);
|
||||
});
|
||||
|
||||
test('concurrent updates are serialized without lost values', async (t) => {
|
||||
|
||||
Reference in New Issue
Block a user