Bind typed SYSTEM service plans and qualify Domain contract on cloud Linux
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -25,3 +25,23 @@ it('renders hostile log content only as text, without executable nodes, approval
|
||||
vi.unstubAllGlobals();
|
||||
}
|
||||
});
|
||||
|
||||
it('shows fixed SYSTEM identity and service state from stored plan bytes without approving or issuing requests', async () => {
|
||||
const fetch = vi.fn(); vi.stubGlobal('fetch', fetch); vi.stubGlobal('document', { getElementById: () => ({}) });
|
||||
try {
|
||||
const { SystemPlanNotice } = await import('./main');
|
||||
const payload = { jobs: [{ payload: { execution_identity: 'system', asset_id: 'fixed-asset', action: { action: 'set_service_state', unit: 'RmmDiscoveryFixtureService', state: 'stopped' } } }] };
|
||||
const plan = { plan_payload_bytes: Array.from(new TextEncoder().encode(JSON.stringify(payload))), jobs: [{ payload: { execution_identity: 'root', action: { unit: 'untrusted-view' } } }] };
|
||||
const html = renderToStaticMarkup(<SystemPlanNotice plan={plan}/>);
|
||||
expect(html).toContain('SYSTEM'); expect(html).toContain('system:execute'); expect(html).toContain('Identität: system');
|
||||
for (const expected of ['fixed-asset', 'RmmDiscoveryFixtureService', 'Zielzustand: stopped', 'Keine SYSTEM-Shell']) expect(html).toContain(expected);
|
||||
expect(html).not.toContain('untrusted-view'); expect(html).not.toMatch(/<(button|input|form|pre)\b/);
|
||||
expect(renderToStaticMarkup(<SystemPlanNotice plan={{ plan_payload_bytes: Array.from(new TextEncoder().encode('{"jobs":[]}')) }}/>)).toBe('');
|
||||
for (const plan_payload_bytes of [[255], [123], 'invalid']) {
|
||||
const invalid = renderToStaticMarkup(<SystemPlanNotice plan={{ plan_payload_bytes }}/>);
|
||||
expect(invalid).toContain('role="alert"'); expect(invalid).toContain('nicht lesbar');
|
||||
expect(invalid).not.toMatch(/<(button|input|form)\b/);
|
||||
}
|
||||
expect(fetch).not.toHaveBeenCalled();
|
||||
} finally { vi.unstubAllGlobals(); }
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user