test(installer): preregister durable brain P7 integration
This commit is contained in:
@@ -0,0 +1,54 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
|
function installerSource(): string {
|
||||||
|
return readFileSync(join(process.cwd(), '..', '..', 'tools', 'install.sh'), 'utf8');
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('root installer P7 durable-brain integration', (): void => {
|
||||||
|
it('records the configured source repository in the committed manifest for doctor derivation', (): void => {
|
||||||
|
const installer = installerSource();
|
||||||
|
|
||||||
|
expect(installer).toContain('sourceRepo:');
|
||||||
|
expect(installer).toMatch(/sourceRepo:\s*process\.argv\[/);
|
||||||
|
expect(installer).toMatch(/MANIFEST_SOURCE_REPO/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('invokes the broker-only provision command in P7 with explicit owner and refusal controls', (): void => {
|
||||||
|
const installer = installerSource();
|
||||||
|
const provision = installer.indexOf('__brain-provision');
|
||||||
|
const p7 = installer.indexOf('state_phase_begin P7');
|
||||||
|
|
||||||
|
expect(provision).toBeGreaterThan(-1);
|
||||||
|
expect(p7).toBeGreaterThan(-1);
|
||||||
|
expect(provision).toBeGreaterThan(p7);
|
||||||
|
for (const flag of [
|
||||||
|
'--identity',
|
||||||
|
'--target-url',
|
||||||
|
'--owner',
|
||||||
|
'--refusal-identity',
|
||||||
|
'--lane',
|
||||||
|
'--owner-policy',
|
||||||
|
]) {
|
||||||
|
expect(installer).toContain(flag);
|
||||||
|
}
|
||||||
|
expect(installer).not.toMatch(/__brain-provision[^\n]*(?:token|password|authorization)/i);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('journals ~/.mosaic and the owner policy as P7 mutations and checks the resulting object', (): void => {
|
||||||
|
const installer = installerSource();
|
||||||
|
|
||||||
|
expect(installer).toContain('state_record_mutation P7 "$HOME/.mosaic"');
|
||||||
|
expect(installer).toContain('state_record_mutation P7 "$MOSAIC_HOME/brain/owners.json"');
|
||||||
|
expect(installer).toMatch(/P7\)[\s\S]*\.mosaic[\s\S]*(?:remote|get-url)[\s\S]*main/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('discovers every legacy lane directory rather than silently migrating only one lane', (): void => {
|
||||||
|
const installer = installerSource();
|
||||||
|
|
||||||
|
expect(installer).toMatch(/memory\/lanes/);
|
||||||
|
expect(installer).toMatch(/for\s+[^\n]*lane/);
|
||||||
|
expect(installer).toMatch(/__brain-provision[\s\S]*--lane/);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user