feat(config): add configurable default shutdown delay for shutdown actions
This commit is contained in:
+21
-1
@@ -11,7 +11,11 @@ import { type IPauseState, loadPauseSnapshot } from '../ts/pause-state.ts';
|
||||
import { shortId } from '../ts/helpers/shortid.ts';
|
||||
import { HTTP_SERVER, SNMP, THRESHOLDS, TIMING, UI } from '../ts/constants.ts';
|
||||
import { Action, type IActionContext } from '../ts/actions/base-action.ts';
|
||||
import { buildUpsActionContext, decideUpsActionExecution } from '../ts/action-orchestration.ts';
|
||||
import {
|
||||
applyDefaultShutdownDelay,
|
||||
buildUpsActionContext,
|
||||
decideUpsActionExecution,
|
||||
} from '../ts/action-orchestration.ts';
|
||||
import {
|
||||
buildShutdownErrorRow,
|
||||
buildShutdownStatusRow,
|
||||
@@ -353,6 +357,22 @@ Deno.test('decideUpsActionExecution: returns executable action plan when actions
|
||||
});
|
||||
});
|
||||
|
||||
Deno.test('applyDefaultShutdownDelay: applies only to shutdown actions without explicit delay', () => {
|
||||
const actions = [
|
||||
{ type: 'shutdown' as const },
|
||||
{ type: 'shutdown' as const, shutdownDelay: 0 },
|
||||
{ type: 'shutdown' as const, shutdownDelay: 9 },
|
||||
{ type: 'webhook' as const },
|
||||
];
|
||||
|
||||
assertEquals(applyDefaultShutdownDelay(actions, 7), [
|
||||
{ type: 'shutdown', shutdownDelay: 7 },
|
||||
{ type: 'shutdown', shutdownDelay: 0 },
|
||||
{ type: 'shutdown', shutdownDelay: 9 },
|
||||
{ type: 'webhook' },
|
||||
]);
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Shutdown Monitoring Tests
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user