fix(domains): geloeschter AutoDNS-Auftrag haengt nicht mehr - Domain entscheidet
AutoDNS loescht abgeschlossene Auftraege; GET /job/{id} liefert dann 404
(EF300101). Gibt es die Domain, ist die Registrierung durch.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -938,6 +938,45 @@ describe('refreshOpenOrders', () => {
|
|||||||
expect(h.directory.invalidate).toHaveBeenCalledWith('t1');
|
expect(h.directory.invalidate).toHaveBeenCalledWith('t1');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('abgeschlossener Auftrag ist bei AutoDNS geloescht (404): Domain vorhanden -> SUCCESS', async () => {
|
||||||
|
const h = makeHarness();
|
||||||
|
h.addOrder({ status: 'SUBMITTED', jobId: '987', jobStatus: 'WAIT' });
|
||||||
|
h.respond((call) =>
|
||||||
|
call.url.endsWith('/job/987')
|
||||||
|
? reply(
|
||||||
|
404,
|
||||||
|
envelope([], {
|
||||||
|
type: 'ERROR',
|
||||||
|
messages: [{ code: 'EF300101', text: 'Auftrag konnte nicht gefunden werden.' }],
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
: reply(200, envelope([{ name: 'beispiel.de' }])),
|
||||||
|
);
|
||||||
|
await h.service.refreshOpenOrders('t1');
|
||||||
|
expect(h.calls.map((c) => c.url)).toEqual([
|
||||||
|
'https://api.demo.autodns.com/v1/job/987',
|
||||||
|
'https://api.demo.autodns.com/v1/domain/beispiel.de',
|
||||||
|
]);
|
||||||
|
expect(h.state.orders[0]).toMatchObject({ status: 'SUCCESS', jobStatus: 'SUCCESS' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Auftrag geloescht und Domain unbekannt: bleibt offen', async () => {
|
||||||
|
const h = makeHarness();
|
||||||
|
h.addOrder({ status: 'SUBMITTED', jobId: '987', jobStatus: 'WAIT' });
|
||||||
|
h.respond(() => reply(404, envelope([], { type: 'ERROR' })));
|
||||||
|
await h.service.refreshOpenOrders('t1');
|
||||||
|
expect(h.state.orders[0]).toMatchObject({ status: 'SUBMITTED', jobStatus: 'WAIT' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Auftrag nicht abrufbar wegen Serverfehler: keine Domainabfrage, bleibt offen', async () => {
|
||||||
|
const h = makeHarness();
|
||||||
|
h.addOrder({ status: 'SUBMITTED', jobId: '987', jobStatus: 'WAIT' });
|
||||||
|
h.respond(() => reply(502, 'Bad Gateway'));
|
||||||
|
await h.service.refreshOpenOrders('t1');
|
||||||
|
expect(h.calls).toHaveLength(1);
|
||||||
|
expect(h.state.orders[0]).toMatchObject({ status: 'SUBMITTED' });
|
||||||
|
});
|
||||||
|
|
||||||
it('FAILED -> FAILED mit Text, openKey leer', async () => {
|
it('FAILED -> FAILED mit Text, openKey leer', async () => {
|
||||||
const h = makeHarness();
|
const h = makeHarness();
|
||||||
h.addOrder({ status: 'SUBMITTED', jobId: '987' });
|
h.addOrder({ status: 'SUBMITTED', jobId: '987' });
|
||||||
|
|||||||
@@ -767,7 +767,26 @@ export class DomainsOrdersService {
|
|||||||
'GET',
|
'GET',
|
||||||
`/job/${encodeURIComponent(row.jobId as string)}`,
|
`/job/${encodeURIComponent(row.jobId as string)}`,
|
||||||
);
|
);
|
||||||
if (!result.ok) return; // nicht gepruefte Lage bleibt, wie sie ist
|
if (!result.ok) {
|
||||||
|
// Gegen das AutoDNS-Demo-System geprueft (08.10.2026): ein abgeschlossener
|
||||||
|
// Auftrag wird geloescht, GET /job/{id} antwortet dann 404 "Auftrag konnte
|
||||||
|
// nicht gefunden werden" (EF300101). Dann entscheidet die Domain selbst:
|
||||||
|
// gibt es sie, ist die Registrierung durch. Sonst bleibt alles, wie es ist.
|
||||||
|
if (result.kind !== 'business') return; // nicht gepruefte Lage bleibt, wie sie ist
|
||||||
|
const domain = await this.callRaw(
|
||||||
|
credentials,
|
||||||
|
'GET',
|
||||||
|
`/domain/${encodeURIComponent(row.domainName)}`,
|
||||||
|
);
|
||||||
|
if (domain.ok && domain.data.length > 0) {
|
||||||
|
await this.writeIf(tenantId, row, {
|
||||||
|
status: 'SUCCESS',
|
||||||
|
jobStatus: 'SUCCESS',
|
||||||
|
lastCheckedAt: new Date(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
const job = parseJob(result.data);
|
const job = parseJob(result.data);
|
||||||
const checkedAt = new Date();
|
const checkedAt = new Date();
|
||||||
if (!job?.status) {
|
if (!job?.status) {
|
||||||
|
|||||||
Reference in New Issue
Block a user