fix: avoid systemd-supervised gateway retry loop in owned launcher (#700)
This commit is contained in:
committed by
GitHub
Unverified
parent
9b56d80d22
commit
514a6c4112
45
tests/unit/config-sync.test.ts
Normal file
45
tests/unit/config-sync.test.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { stripSystemdSupervisorEnv } from '@electron/gateway/config-sync-env';
|
||||
|
||||
describe('stripSystemdSupervisorEnv', () => {
|
||||
it('removes systemd supervisor marker env vars', () => {
|
||||
const env = {
|
||||
PATH: '/usr/bin:/bin',
|
||||
OPENCLAW_SYSTEMD_UNIT: 'openclaw-gateway.service',
|
||||
INVOCATION_ID: 'abc123',
|
||||
SYSTEMD_EXEC_PID: '777',
|
||||
JOURNAL_STREAM: '8:12345',
|
||||
OTHER: 'keep-me',
|
||||
};
|
||||
|
||||
const result = stripSystemdSupervisorEnv(env);
|
||||
|
||||
expect(result).toEqual({
|
||||
PATH: '/usr/bin:/bin',
|
||||
OTHER: 'keep-me',
|
||||
});
|
||||
});
|
||||
|
||||
it('keeps unrelated variables unchanged', () => {
|
||||
const env = {
|
||||
NODE_ENV: 'production',
|
||||
OPENCLAW_GATEWAY_TOKEN: 'token',
|
||||
CLAWDBOT_SKIP_CHANNELS: '0',
|
||||
};
|
||||
|
||||
expect(stripSystemdSupervisorEnv(env)).toEqual(env);
|
||||
});
|
||||
|
||||
it('does not mutate source env object', () => {
|
||||
const env = {
|
||||
OPENCLAW_SYSTEMD_UNIT: 'openclaw-gateway.service',
|
||||
VALUE: '1',
|
||||
};
|
||||
const before = { ...env };
|
||||
|
||||
const result = stripSystemdSupervisorEnv(env);
|
||||
|
||||
expect(env).toEqual(before);
|
||||
expect(result).toEqual({ VALUE: '1' });
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user