Color fleet monitor rows: green operational, yellow degraded, red down
Some checks are pending
offline / test (push) Waiting to run
Some checks are pending
offline / test (push) Waiting to run
Paused or unhealthy replicas mark the service degraded even if the tree-node floor is still met. Unmanaged NATS with no process is down.
This commit is contained in:
parent
dd99ce1c64
commit
6fbc808bb1
4 changed files with 79 additions and 5 deletions
36
packages/verae-fleet/test/classify.test.js
Normal file
36
packages/verae-fleet/test/classify.test.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { classifyService } from '../src/classify.js';
|
||||
|
||||
describe('classifyService', () => {
|
||||
it('operational when available meets min and none paused', () => {
|
||||
assert.equal(
|
||||
classifyService({ min: 3, available: 3, running: 3, paused: 0, instances: [{ pid: 1, healthy: true }] }),
|
||||
'operational',
|
||||
);
|
||||
});
|
||||
|
||||
it('degraded when a replica is paused even if floor is still met', () => {
|
||||
assert.equal(
|
||||
classifyService({
|
||||
min: 3,
|
||||
available: 3,
|
||||
running: 4,
|
||||
paused: 1,
|
||||
instances: [
|
||||
{ pid: 1, paused: true, healthy: false },
|
||||
{ pid: 2, paused: false, healthy: true },
|
||||
],
|
||||
}),
|
||||
'degraded',
|
||||
);
|
||||
});
|
||||
|
||||
it('not operational when min>0 and nothing available', () => {
|
||||
assert.equal(classifyService({ min: 1, available: 0, running: 0, paused: 0, instances: [] }), 'down');
|
||||
});
|
||||
|
||||
it('optional idle (min 0, not running) is operational', () => {
|
||||
assert.equal(classifyService({ min: 0, available: 0, running: 0, paused: 0 }), 'operational');
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue