test: finalize managed runtime release smoke

This commit is contained in:
Andrey Avtomonov 2026-05-11 11:40:35 +02:00
parent ed00c9a0a3
commit b493f43412
4 changed files with 26 additions and 3 deletions

View file

@ -70,6 +70,19 @@ describe('managedPythonRuntimeLayout', () => {
expect(layout.assetManifestPath).toBe('/repo/packages/cli/assets/python/manifest.json');
});
it('honors KTX_RUNTIME_ROOT before platform defaults', () => {
const layout = managedPythonRuntimeLayout({
cliVersion: '0.2.0',
platform: 'darwin',
env: { KTX_RUNTIME_ROOT: '/tmp/ktx-runtime' },
homeDir: '/Users/alex',
assetDir: '/repo/packages/cli/assets/python',
});
expect(layout.runtimeRoot).toBe('/tmp/ktx-runtime');
expect(layout.versionDir).toBe('/tmp/ktx-runtime/0.2.0');
});
it('honors XDG_DATA_HOME on Linux', () => {
const layout = managedPythonRuntimeLayout({
cliVersion: '0.2.0',

View file

@ -119,6 +119,9 @@ function defaultAssetDir(): string {
}
function runtimeRootFor(input: Required<Pick<ManagedPythonRuntimeLayoutOptions, 'platform' | 'env' | 'homeDir'>>): string {
if (input.env.KTX_RUNTIME_ROOT) {
return input.env.KTX_RUNTIME_ROOT;
}
if (input.platform === 'darwin') {
return join(input.homeDir, 'Library', 'Application Support', 'kaelio', 'ktx', 'runtime');
}

View file

@ -569,6 +569,9 @@ export function npmSmokePackageJson(layout) {
dependencies: {
'@kaelio/ktx': `file:${layout.cliTarball}`,
},
devDependencies: {
'better-sqlite3': '^12.6.2',
},
pnpm: {
onlyBuiltDependencies: ['better-sqlite3'],
},
@ -927,7 +930,7 @@ try {
requireSuccessWithStderr(
'ktx sl query first managed runtime install',
slQuery,
/Installing KTX Python runtime \(core\) with uv[\\s\\S]*KTX Python runtime ready:/,
/Installing KTX Python runtime \\(core\\) with uv[\\s\\S]*KTX Python runtime ready:/,
);
requireOutput('ktx sl query first managed runtime install', slQuery, /"mode": "compile_only"/);
requireOutput('ktx sl query first managed runtime install', slQuery, /orders/);

View file

@ -513,9 +513,13 @@ describe('verification snippets', () => {
it('pins the smoke project to the public package artifact', () => {
const layout = packageArtifactLayout('/repo/ktx');
assert.deepEqual(npmSmokePackageJson(layout).dependencies, {
const packageJson = npmSmokePackageJson(layout);
assert.deepEqual(packageJson.dependencies, {
'@kaelio/ktx': `file:${layout.cliTarball}`,
});
assert.deepEqual(packageJson.devDependencies, {
'better-sqlite3': '^12.6.2',
});
});
it('exposes manifest verification as a package artifact command', async () => {
@ -568,7 +572,7 @@ describe('verification snippets', () => {
assert.match(source, /managed-runtime/);
assert.match(source, /ktx runtime status missing/);
assert.match(source, /runtimeStatusBefore\.kind, 'missing'/);
assert.match(source, /Installing KTX Python runtime \(core\) with uv/);
assert.ok(source.includes(String.raw`Installing KTX Python runtime \(core\) with uv`));
assert.match(source, /KTX Python runtime ready:/);
assert.match(source, /ktx runtime status ready/);
assert.match(source, /runtimeStatusAfter\.kind, 'ready'/);