Files
memind/server/portal-runtime-role.test.mjs
john 286069449b
Memind CI / Test, build, and release guards (push) Failing after 2m14s
feat: add guarded portal canary release
2026-07-26 19:51:44 +08:00

31 lines
815 B
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import {
isPassiveCanaryRuntime,
resolvePortalRuntimeRole,
} from './portal-runtime-role.mjs';
test('runtime role defaults to stable and rejects unknown values', () => {
assert.equal(resolvePortalRuntimeRole({}), 'stable');
assert.equal(resolvePortalRuntimeRole({ MEMIND_RUNTIME_ROLE: 'unknown' }), 'stable');
});
test('candidate runtime is passive unless explicitly disabled', () => {
assert.equal(
isPassiveCanaryRuntime({ MEMIND_RUNTIME_ROLE: 'candidate' }),
true,
);
assert.equal(
isPassiveCanaryRuntime({
MEMIND_RUNTIME_ROLE: 'candidate',
MEMIND_CANARY_PASSIVE_RUNTIME: '0',
}),
false,
);
assert.equal(
isPassiveCanaryRuntime({ MEMIND_RUNTIME_ROLE: 'stable' }),
false,
);
});