Adopt: pass the church's address; Link: the short name is a name
crosscode adopt can only work out the church's address from an events.<address> domain, and the Hub never sent --address, so adopting a site like events-demo.crosscode.co.za failed on the server. The adopt form now asks for the address (required for such domains), the Hub refuses to plan the move without it, and it goes into the job's arguments. Link existing: the short name field and its error say it's a name like `hope`, not a folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -312,3 +312,35 @@ describe('banners reach a site the Hub installed (found in the VM test)', () =>
|
||||
expect((await db.deployment.findUnique({ where: { id: d.id } })).installId).toBe('inst-9');
|
||||
});
|
||||
});
|
||||
|
||||
describe('adopting an existing install', () => {
|
||||
async function linked(domain) {
|
||||
const { server } = await joinServer();
|
||||
await db.release.create({ data: { product: 'events', version: '2.3.0', releasedAt: NOW } });
|
||||
await db.install.create({ data: { id: `inst-${domain}`, customerId: 'cust-1', product: 'events', name: 'Demo', url: `https://${domain}`, secret: 'x', version: '2.1.1' } });
|
||||
return jobs.linkDeployment({ serverId: server.id, installId: `inst-${domain}`, shortName: 'cross-events-demo', webPort: 3100, apiPort: 5100 }, admin);
|
||||
}
|
||||
const at = new Date(NOW.getTime() + 5 * H);
|
||||
|
||||
test('a link takes a name, not a folder', async () => {
|
||||
const { server } = await joinServer();
|
||||
await db.install.create({ data: { id: 'inst-p', customerId: 'cust-1', product: 'events', name: 'P', url: 'https://events.p.test', secret: 'x', version: '2.1.1' } });
|
||||
await expect(jobs.linkDeployment({ serverId: server.id, installId: 'inst-p', shortName: '/var/www/cross-events-demo', webPort: 3100, apiPort: 5100 }, admin))
|
||||
.rejects.toMatchObject({ status: 400, message: expect.stringContaining('not a folder') });
|
||||
});
|
||||
|
||||
test('the old folder and the church address go to crosscode adopt', async () => {
|
||||
const d = await linked('events-demo.crosscode.co.za');
|
||||
const job = await jobs.scheduleAdopt({ deploymentId: d.id, eventsDir: '/var/www/cross-events-demo', address: 'crosscode.co.za', at }, admin, NOW);
|
||||
expect(job.args).toMatchObject({ church: 'cross-events-demo', eventsDir: '/var/www/cross-events-demo', address: 'crosscode.co.za' });
|
||||
expect(agent.jobArgsSchemas.adopt.safeParse(job.args).success).toBe(true);
|
||||
});
|
||||
|
||||
test('a domain without "events." needs the address; events.<address> works it out', async () => {
|
||||
const d = await linked('events-demo.crosscode.co.za');
|
||||
await expect(jobs.scheduleAdopt({ deploymentId: d.id, eventsDir: '/var/www/cross-events-demo', at }, admin, NOW)).rejects.toMatchObject({ status: 400, code: 'ADDRESS_NEEDED' });
|
||||
await db.deployment.update({ where: { id: d.id }, data: { domain: 'events.hope.co.za' } });
|
||||
const job = await jobs.scheduleAdopt({ deploymentId: d.id, eventsDir: '/var/www/hope-events', at }, admin, NOW);
|
||||
expect(job.args.address).toBe('hope.co.za');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user