fix: honor Komodo health and prefer fresh telemetry across fleet status
This commit is contained in:
@@ -2,6 +2,21 @@ import { describe, expect, it } from 'vitest';
|
||||
import { extractUdpPort, extractContainerState } from '../../src/lib/server/integrations/komodo.js';
|
||||
|
||||
describe('container readiness', () => {
|
||||
it.each([
|
||||
['Up 35 seconds (health: starting)', 'starting'],
|
||||
['Up about a minute (healthy)', 'running'],
|
||||
['Up 5 minutes (unhealthy)', 'unhealthy'],
|
||||
['Up 2 hours', 'running'],
|
||||
['Exited (1) 5 seconds ago', 'exited']
|
||||
])('reads nested Komodo container status: %s', (status, expected) => {
|
||||
expect(extractContainerState({ state: 'Running', container: { state: 'running', status } })).toBe(expected);
|
||||
});
|
||||
it('reads lowercase inspect health and does not trust missing containers or configuration', () => {
|
||||
expect(extractContainerState({ state: { status: 'running', running: true, health: { status: 'starting' } } })).toBe('starting');
|
||||
expect(extractContainerState({ state: 'Running', container: null })).toBe('unknown');
|
||||
expect(extractContainerState({ config: { state: 'running' }, status: 'ok' })).toBeNull();
|
||||
expect(extractContainerState({ state: 'Exited', container: { status: 'Up 1 minute (healthy)' } })).toBe('exited');
|
||||
});
|
||||
it.each(['starting', 'unhealthy'])('does not accept a running container whose health is %s', (health) => {
|
||||
expect(extractContainerState({ State: { Status: 'running', Running: true, Health: { Status: health } } })).toBe(health);
|
||||
expect(extractContainerState({ state: 'running', health })).toBe(health);
|
||||
|
||||
Reference in New Issue
Block a user