Add runtime version reporting and display
All checks were successful
Build and Deploy Gateway / build-and-push (push) Successful in 16s
Build and Deploy Gateway / deploy (push) Successful in 12s

This commit is contained in:
2026-07-11 21:24:18 +03:00
parent c9223aa3a9
commit 7a6f9a26ac
12 changed files with 351 additions and 2 deletions

View File

@@ -0,0 +1,33 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { buildVersionInfo } from '../../src/server/version.js';
import { HARBOR_VERSIONS, versionCompatibility } from '../../src/shared/versions.js';
test('component versions enforce one Harbor major and one Gateway major.minor', () => {
assert.deepEqual(versionCompatibility(HARBOR_VERSIONS), {
compatible: true,
major: true,
gateway: true,
});
assert.equal(versionCompatibility({
macClient: '1.9.4',
gatewayClient: '1.3.1',
gatewayBackend: '1.3.8',
}).compatible, true);
assert.equal(versionCompatibility({
macClient: '1.0.0',
gatewayClient: '1.3.0',
gatewayBackend: '1.4.0',
}).compatible, false);
});
test('runtime version info reports the installed sing-box binary', () => {
const run = () => ({ stdout: 'sing-box version 1.12.13\n', stderr: '' });
assert.deepEqual(buildVersionInfo('gateway', run), {
apiVersion: 1,
location: 'gateway',
components: { gatewayBackend: HARBOR_VERSIONS.gatewayBackend },
runtime: { singBox: '1.12.13' },
});
});