mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-03 22:12:01 +09:00
Merge pull request #4008 (rudycelekli) into batch
This commit is contained in:
commit
eaf460ade1
2 files changed
+17
-1
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { test } from 'vitest';
|
||||
import assert from 'node:assert/strict';
|
||||
import { MonitoringHooks } from '../v3/@claude-flow/cli/src/production/monitoring.ts';
|
||||
test('non-Error health failures are recorded without aborting later checks', async () => {
|
||||
const m = new MonitoringHooks();
|
||||
for (const [name, value] of [['null', null], ['undefined', undefined], ['string', 'offline']]) m.registerHealthCheck(name, async () => { throw value; });
|
||||
m.registerHealthCheck('healthy', async () => ({ healthy: true }));
|
||||
const result = await m.runHealthChecks();
|
||||
assert.equal(result.healthy, false);
|
||||
for (const [name, value] of [['null', null], ['undefined', undefined], ['string', 'offline']]) { assert.equal(result.checks[name].status, 'unhealthy'); assert.equal(result.checks[name].message, String(value)); }
|
||||
assert.equal(result.checks.healthy.status, 'healthy');
|
||||
});
|
||||
test('Error rejection retains the original message', async () => {
|
||||
const m = new MonitoringHooks(); m.registerHealthCheck('error', async () => { throw new Error('unavailable'); });
|
||||
assert.equal((await m.runHealthChecks()).checks.error.message, 'unavailable');
|
||||
});
|
||||
@@ -259,7 +259,7 @@ export class MonitoringHooks {
|
||||
} catch (error) {
|
||||
checks[name] = {
|
||||
status: 'unhealthy',
|
||||
message: (error as Error).message,
|
||||
message: error instanceof Error ? error.message : String(error),
|
||||
lastCheck: Date.now(),
|
||||
responseTimeMs: Date.now() - startTime,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user