Merge Memory V2 runtime facade
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import path from 'node:path';
|
||||
import test from 'node:test';
|
||||
import { parseMemoryV2StackArgs, runMemoryV2StackCli } from './check-memory-v2-stack.mjs';
|
||||
|
||||
function writableBuffer() {
|
||||
let value = '';
|
||||
return {
|
||||
write(chunk) {
|
||||
value += String(chunk);
|
||||
},
|
||||
value() {
|
||||
return value;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
test('parseMemoryV2StackArgs maps aggregate options', () => {
|
||||
assert.deepEqual(
|
||||
parseMemoryV2StackArgs([
|
||||
'--base-url',
|
||||
'http://127.0.0.1:18081/',
|
||||
'--skip-session-flow',
|
||||
'--skip-backend-smokes',
|
||||
'--expect-backend',
|
||||
'pgvector',
|
||||
'--expect-selected-backend',
|
||||
'pgvector',
|
||||
'--timeout-ms',
|
||||
'5000',
|
||||
], {}),
|
||||
{
|
||||
baseUrl: 'http://127.0.0.1:18081',
|
||||
envFile: path.join(process.cwd(), '.env'),
|
||||
runAppCanary: true,
|
||||
runSessionFlow: false,
|
||||
runBackendSmokes: false,
|
||||
expectedBackend: 'pgvector',
|
||||
expectedSelectedBackend: 'pgvector',
|
||||
timeoutMs: 5000,
|
||||
help: false,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test('runMemoryV2StackCli aggregates configured and skipped backend checks', async () => {
|
||||
const stdout = writableBuffer();
|
||||
const code = await runMemoryV2StackCli({
|
||||
argv: ['--skip-app-canary', '--skip-session-flow'],
|
||||
env: {
|
||||
MEMORY_BACKEND: 'pgvector',
|
||||
MEMORY_VECTOR_ENABLED: '1',
|
||||
MEMORY_PGVECTOR_DATABASE_URL: 'postgresql://db',
|
||||
MEMORY_PGVECTOR_EMBEDDING_MODULE: './embed.mjs',
|
||||
MEMORY_QDRANT_ENABLED: '1',
|
||||
MEMORY_QDRANT_URL: 'http://qdrant.local',
|
||||
MEMORY_QDRANT_EMBEDDING_MODULE: './embed.mjs',
|
||||
},
|
||||
stdout,
|
||||
runners: {
|
||||
async runContractCli({ stdout: buffer }) {
|
||||
buffer.write(JSON.stringify({ ok: true, summary: { backendCount: 9 } }));
|
||||
return 0;
|
||||
},
|
||||
async runHealthCli({ stdout: buffer }) {
|
||||
buffer.write(JSON.stringify({ ok: true, summary: { backend: 'pgvector', selectedBackend: 'pgvector' } }));
|
||||
return 0;
|
||||
},
|
||||
async runPgvectorSmokeCli() {
|
||||
return { ok: true, source: 'pgvector-smoke' };
|
||||
},
|
||||
async runQdrantSmokeCli() {
|
||||
return { ok: true, source: 'qdrant-raw' };
|
||||
},
|
||||
async runExternalSmokeCli({ argv: cliArgv }) {
|
||||
return { ok: true, backend: cliArgv[1], source: 'runtime-smoke' };
|
||||
},
|
||||
},
|
||||
});
|
||||
const report = JSON.parse(stdout.value());
|
||||
|
||||
assert.equal(code, 0);
|
||||
assert.equal(report.ok, true);
|
||||
assert.deepEqual(report.summary.configuredBackends, ['pgvector', 'qdrant']);
|
||||
assert.ok(report.summary.skippedBackends.includes('weaviate'));
|
||||
assert.equal(report.checks.find((item) => item.name === 'contracts').ok, true);
|
||||
assert.equal(report.checks.find((item) => item.name === 'health').ok, true);
|
||||
assert.equal(report.checks.find((item) => item.name === 'backend_pgvector').ok, true);
|
||||
assert.equal(report.checks.find((item) => item.name === 'backend_qdrant').ok, true);
|
||||
});
|
||||
Reference in New Issue
Block a user