|
1 | 1 | // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. |
2 | | -// test-budget: 70 — spawns the real producer once per single-cause fixture: two served-shape boots that run the real Archiver, and six spawns of the source CLI (dry run, --apply, re-run over the archive fixture; --apply on a project with no archive; a dry run with a runtime archive row; --apply with a declared archive that cannot connect); 54.7 s, the slower of two local runs on a shared container, x 1.25, no CI reading yet |
| 2 | +// test-budget: 85 — spawns the real producer once per single-cause fixture: two served-shape boots that run the real Archiver, and six spawns of the source CLI (dry run, --apply, re-run over the archive fixture; --apply on a project with no archive; a dry run with a runtime archive row; --apply with a declared archive that cannot connect); 67.8 s, the slower of two local runs on a shared container, x 1.25, no CI reading yet |
3 | 3 |
|
4 | 4 | /** |
5 | 5 | * [#24899] `os migrate audit-mail-bodies` masks the mail-log bodies the |
@@ -281,12 +281,14 @@ beforeAll(async () => { |
281 | 281 | } |
282 | 282 | runtimeRowRun = await runCommand(runtimeRowDir, runtimeRowDb, ['--json']); |
283 | 283 |
|
284 | | - // A declared archive whose SQLite file cannot be opened: its directory is a |
285 | | - // regular file, so the connect fails on every attempt. |
| 284 | + // A declared archive the boot cannot reach: a Postgres server on a port |
| 285 | + // nothing listens on, so the connect is refused on every attempt. Not an |
| 286 | + // unopenable SQLite file: the source entry pins NODE_ENV=development, under |
| 287 | + // which the SQLite factory steps an unopenable file down to an in-memory |
| 288 | + // engine instead of failing. |
286 | 289 | unreachableDir = mkdtempSync(join(tmpdir(), 'os-24899-unreachable-')); |
287 | | - writeFileSync(join(unreachableDir, 'blocker'), 'not a directory'); |
288 | 290 | writeArtifact(unreachableDir, [ |
289 | | - { name: 'archive', driver: 'sqlite', config: { filename: join(unreachableDir, 'blocker', 'archive.db') }, autoConnect: true }, |
| 291 | + { name: 'archive', driver: 'postgres', config: { host: '127.0.0.1', port: 1, database: 'archive', user: 'os24899' }, autoConnect: true }, |
290 | 292 | ]); |
291 | 293 | unreachableRun = await runCommand(unreachableDir, join(unreachableDir, 'main.db'), ['--apply', '--yes', '--json']); |
292 | 294 | }, HOOK_TIMEOUT_MS); |
@@ -377,8 +379,7 @@ describe('[#24899] os migrate audit-mail-bodies over an archive datasource', () |
377 | 379 | expect(unreachableRun.code).toBe(1); |
378 | 380 | const entry = archiveOf(unreachableRun); |
379 | 381 | expect(entry).toMatchObject({ datasource: 'archive', objects: ['sys_audit_log'], status: 'not-connected' }); |
380 | | - expect(typeof entry.connection?.status).toBe('string'); |
381 | | - expect(entry.connection.status === 'connected' || entry.connection.status === 'already-registered').toBe(false); |
| 382 | + expect(entry.connection?.status).toBe('failed-degraded'); |
382 | 383 | expect(entry.report).toBeUndefined(); |
383 | 384 | }); |
384 | 385 | }); |
0 commit comments