feat: add scoped image sync endpoint
This commit is contained in:
@@ -124,3 +124,19 @@ test('same-branch force pushes and payload SHA mismatches are rejected', async (
|
||||
/Payload commit does not match remote branch tip/,
|
||||
);
|
||||
});
|
||||
|
||||
test('signed sync callers can only fast-forward the active branch and requests are idempotent', async (t) => {
|
||||
const f = await fixture();
|
||||
t.after(() => rm(f.root, { recursive: true, force: true }));
|
||||
await writeFile(join(f.seed, 'icons', 'sync.jpg'), 'sync');
|
||||
await git(f.seed, 'add', '.');
|
||||
await git(f.seed, 'commit', '-m', 'sync target');
|
||||
await git(f.seed, 'push', 'origin', 'master');
|
||||
const target = await git(f.seed, 'rev-parse', 'HEAD');
|
||||
|
||||
const result = await f.service.deploySync({ requestKey: 'core:sync-request-1', expectedCommit: target });
|
||||
assert.equal(result.changed, true);
|
||||
assert.equal(await git(f.deployed, 'rev-parse', 'HEAD'), target);
|
||||
assert.equal((await f.service.deploySync({ requestKey: 'core:sync-request-1' })).duplicate, true);
|
||||
assert.equal(f.service.publicStatus().activeBranch, 'master');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user