Files
orca/src/main/ssh/orcad-runtime-target.test.ts
T
OrcaWinandm4air da325ea7e3 fix(orcad): deploy the glibc 2.17 runtime on old-glibc hosts, and fall back to the pinned relay (#25180)
* fix(orcad): deploy the glibc 2.17 runtime on old-glibc hosts, and fall back to the pinned relay

Managed orcad picked its runtime from the host's libc flavour alone, so a CentOS 7 host
(glibc 2.17) got the default linux-x64-glibc Node, whose self-test fails there. The deploy
now picks the runtime by glibc the same way the relay ladder picks rung A or B, and the
host-side slot checks accept the compat target it ships.

When orcad still can't run, the host is recorded as such and the relay connect that
follows now runs the pinned-runtime ladder instead of defaulting to the host-Node relay,
so a host with no Node lands on rung B rather than failing.

The hostile-host lane deploys managed orcad on a fresh CentOS 7 host and asserts it runs on
the compat runtime with no default runtime uploaded.

* test(ssh): CentOS 7 cell asserts the compat runtime pick, then the refusal and relay rung B fallback

The compat template still ships the base @parcel/watcher binary, which needs GLIBCXX_3.4.20; CentOS 7's
libstdc++ stops at 3.4.19, so the candidate's preflight refuses. The cell now pins that end-to-end
behaviour: compat runtime picked and uploaded alone, refusal classified native_preflight, and the relay
that follows settles on rung B with no runtime setting.

---------

Co-authored-by: m4air <m4air@Mac.localdomain>
2026-10-04 05:17:10 -07:00

54 lines
2.4 KiB
TypeScript

import { beforeEach, describe, expect, it, vi } from 'vitest'
import { resolveOrcadRuntimeTarget } from './orcad-runtime-target'
import { SshConnection } from './ssh-connection'
import { createCallbacks, createTarget } from './ssh-connection-test-fixtures'
import { execCommand } from './ssh-relay-deploy-helpers'
import { getRemoteHostPlatform } from './ssh-remote-platform'
vi.mock('./ssh-relay-deploy-helpers', () => ({ execCommand: vi.fn() }))
beforeEach(() => vi.mocked(execCommand).mockReset())
function resolveOn(platform: Parameters<typeof getRemoteHostPlatform>[0], ldd: string) {
vi.mocked(execCommand).mockResolvedValueOnce(ldd)
return resolveOrcadRuntimeTarget({
conn: new SshConnection(createTarget(), createCallbacks()),
host: getRemoteHostPlatform(platform)
})
}
describe('managed orcad runtime target', () => {
it.each([
['CentOS 7 (glibc 2.17)', 'ldd (GNU libc) 2.17', 'linux-x64-glibc217'],
['glibc 2.27, still below the default floor', 'ldd (GNU libc) 2.27', 'linux-x64-glibc217'],
['Debian 10 (glibc 2.28)', 'ldd (Debian GLIBC 2.28-10+deb10u2) 2.28', 'linux-x64-glibc'],
['Ubuntu 22.04 (glibc 2.35)', 'ldd (Ubuntu GLIBC 2.35-0ubuntu3.8) 2.35', 'linux-x64-glibc'],
['Alpine (musl)', 'musl libc (x86_64)\nVersion 1.2.5', 'linux-x64-musl']
])('deploys %s on the runtime the relay ladder would pick', async (_host, ldd, target) => {
await expect(resolveOn('linux-x64', ldd)).resolves.toBe(target)
})
it('keeps the host target when the glibc version is unreadable; the self-test decides', async () => {
await expect(resolveOn('linux-x64', 'ldd (GNU libc) unknown')).resolves.toBe('linux-x64-glibc')
})
it('refuses as unsupported where no runtime serves the glibc, so the connect keeps the relay', async () => {
await expect(resolveOn('linux-arm64', 'ldd (GNU libc) 2.17')).rejects.toMatchObject({
name: 'OrcadHostUnsupportedError',
message: expect.stringContaining('linux-arm64-glibc with glibc 2.17')
})
await expect(resolveOn('linux-x64', 'ldd (GNU libc) 2.12')).rejects.toMatchObject({
name: 'OrcadHostUnsupportedError'
})
})
it('needs no libc probe off Linux', async () => {
await expect(
resolveOrcadRuntimeTarget({
conn: new SshConnection(createTarget(), createCallbacks()),
host: getRemoteHostPlatform('darwin-arm64')
})
).resolves.toBe('darwin-arm64')
expect(execCommand).not.toHaveBeenCalled()
})
})