test: require review fix assertions
- test: require review fix assertions - test: cover zone repair and imported dns records - test: wait for dns and tighten assertions - fix(api): drop the record id of a rolled back record creation - test(audit): run every api route through the real handlers in an audit matrix - test(api): run the authorization matrix through the real zone handlers - test: repair duplicate apex soa through ui
This commit is contained in:
1 parent
a884219512
commit
9251c85fd8
14 files changed
+1631
-123
No files matched your search
+15
-3
@@ -4,9 +4,11 @@
|
||||
import { test, expect } from '../harness/fixtures';
|
||||
import { up, zp } from '../harness/api';
|
||||
import { importApplyBody } from '../harness/decisions';
|
||||
import { waitForZone } from '../harness/dig';
|
||||
import { parseRR, waitForZone } from '../harness/dig';
|
||||
import { COREDNS_HOST } from '../harness/env';
|
||||
import { run } from '../harness/proc';
|
||||
import { address, addAddress, createZone, restartWithSessions, zoneInput } from '../harness/personas';
|
||||
import { begin, storedRow, threeWay } from '../harness/verify';
|
||||
import { begin, servedZone, threeWay } from '../harness/verify';
|
||||
|
||||
test.use({ group: 'power' });
|
||||
|
||||
@@ -75,7 +77,16 @@ test('a power user operates a large installation, with restart and edit conflict
|
||||
await waitForZone(world.g, imports, { recorder: world.recorder });
|
||||
await threeWay(world, first, imports, { ...address('load-0', ip), type: 'A' }, importChange, 'large import');
|
||||
expect(await world.db.records(imports)).toHaveLength(1202);
|
||||
await storedRow(world, imports, { ...address('load-1199', ip), type: 'A' });
|
||||
const imported = (await world.db.records(imports)).filter((row) => row.name.startsWith('load-'));
|
||||
expect(imported).toHaveLength(1200);
|
||||
const queries = imported.map((row) => `${row.name}.${imports} A`).join('\n') + '\n';
|
||||
const batch = await run('dig', [`@${COREDNS_HOST}`, '-p', String(world.g.dnsPort), '+norecurse', '+nocookie', '+time=3', '+tries=2', '+noall', '+answer', '-f', '-'], { input: queries, timeoutMs: 120_000 });
|
||||
expect(batch.code, batch.stderr).toBe(0);
|
||||
const answers = batch.stdout.split('\n').filter((line) => line.trim() && !line.startsWith(';')).map(parseRR);
|
||||
expect(answers.map((rr) => `${rr.name} ${rr.ttl} ${rr.type} ${rr.data}`).sort()).toEqual(
|
||||
imported.map((row) => `${row.name}.${imports} 300 A ${ip}`).sort(),
|
||||
);
|
||||
for (const row of imported) expect(row).toMatchObject({ zone: imports, ttl: 300, record_type: 'A', content: JSON.stringify({ ip }) });
|
||||
expect((await api.get(`${zp(imports)}/check`)).json.problems).toEqual([]);
|
||||
});
|
||||
|
||||
@@ -100,4 +111,5 @@ test('a power user imports the supported types in one transaction', async ({ wor
|
||||
expect((await ui.importPreview(zone, entries.map(([n, t, v]) => `${n} 300 IN ${t} ${v}\n`).join(''), 'merge')).status).toBe(200);
|
||||
expect((await ui.importApply()).status).toBe(200);
|
||||
expect((await world.db.records(zone)).map((row) => row.record_type).sort()).toEqual(['A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'NS', 'SOA', 'SRV', 'TXT']);
|
||||
await servedZone(world, zone);
|
||||
});
|
||||
Reference in new issue
Block a user