unrip/test/ops-sentinel-static.test.mjs
philipp af87a08a19
Some checks failed
deploy / deploy (push) Failing after 51s
Include sentinel snapshot summarizer
Proof: npm test passed 159/159; focused node --test for service-snapshot-summary and ops-sentinel static coverage passed; failed rollout showed ops-sentinel could not import src/core/service-snapshot-summary.mjs and this commit adds the module plus regression coverage.

Assumptions: Forgejo main push remains the deployment path; no manual kubectl reconciliation is needed because the failed rollout will be superseded by the repo workflow.

Still fake: no live funds movement; production rollout evidence still depends on the follow-up Forgejo deployment completing.
2026-05-12 21:41:38 +02:00

31 lines
1.5 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(new URL('../src/apps/ops-sentinel.mjs', import.meta.url), 'utf8');
test('ops sentinel imports executor containment guard used by runtime evaluation', () => {
assert.match(source, /shouldContainExecutorForAlerts\(alerts\)/);
assert.match(
source,
/import\s*\{[\s\S]*shouldContainExecutorForAlerts[\s\S]*\}\s*from\s*'\.\.\/core\/runtime-health\.mjs';/,
);
});
test('ops sentinel polls official NEAR status and publishes environment status without alerting', () => {
assert.match(source, /pollNearIntentsEnvironmentStatus/);
assert.match(source, /kafkaTopicOpsEnvironmentStatus/);
assert.match(source, /buildNearIntentsStatusEventPayload/);
assert.match(source, /normalized\.status_fingerprint === state\.last_environment_status_fingerprint/);
assert.match(source, /assertEnvironmentStatusEvent/);
});
test('ops sentinel exposes trimmed service snapshots and computed runtime alerts', () => {
assert.match(source, /summarizeServiceSnapshotForSentinel/);
assert.match(source, /serviceSnapshots\.map\(summarizeServiceSnapshotForSentinel\)/);
assert.match(source, /latest_runtime_alerts: state\.latest_runtime_alerts/);
assert.match(source, /active_alerts: state\.latest_runtime_alerts/);
assert.match(source, /activeAlerts: desiredRuntimeAlerts/);
assert.match(source, /state\.latest_runtime_alerts = desiredRuntimeAlerts/);
});