Hub 2.7.1: one click is one update

Buttons are off from the click until the Hub answers (the Updates page and
every action on an install's page); the server refuses a second update for
an install with one planned or running (ALREADY_PLANNED). Test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 22:15:58 +02:00
co-authored by Claude Opus 5.5
parent 90fdde054a
commit dab6fbcff6
9 changed files with 81 additions and 21 deletions
+13
View File
@@ -730,3 +730,16 @@ describe('emergency updates as soon as possible, and events on now (2.7.0)', ()
expect((await urgent([stale.id, older.id], { asap: true })).jobs).toHaveLength(2);
});
});
describe('one update at a time per install (2.7.1)', () => {
test('a second update for an install with one planned is refused, and none is made', async () => {
const { server } = await joinServer();
await servers.setServerConfig(server.id, { TRUST_PROXY: 'loopback' });
await db.install.create({ data: { id: 'inst-twice', customerId: 'cust-1', product: 'events', name: 'Twice', url: 'https://events.twice.co.za', secret: 'x', version: '2.3.0' } });
const d = await db.deployment.create({ data: { id: 'dep-twice', serverId: server.id, customerId: 'cust-1', installId: 'inst-twice', product: 'events', shortName: 'twice', domain: 'events.twice.co.za', webPort: 24000, apiPort: 24001, status: 'live' } });
const at = new Date(NOW.getTime() + 5 * 3600e3);
await jobs.scheduleUpdate({ deploymentIds: [d.id], version: '2.4.0', at }, admin, NOW);
await expect(jobs.scheduleUpdate({ deploymentIds: [d.id], version: '2.4.0', at }, admin, NOW)).rejects.toMatchObject({ code: 'ALREADY_PLANNED' });
expect(await db.job.count({ where: { deploymentId: d.id, type: 'deploy' } })).toBe(1);
});
});