test: align qdrant ollama verification fixtures
This commit is contained in:
@@ -269,15 +269,19 @@ test("runs the injected installation diagnostic for a migration-required v2 work
|
||||
}
|
||||
});
|
||||
|
||||
test("fails closed for /workspaces/:id/test on a schema v3 workspace before the internal runtime lands", async () => {
|
||||
test("runs diagnostics for a schema v3 workspace without external semantic bindings", async () => {
|
||||
const diagnose = vi.fn(async () => ({ activatable: true, diagnostics: [] }));
|
||||
const app = appFor(registryFake(), diagnose);
|
||||
|
||||
const testResult = await app.inject({ method: "POST", url: "/workspaces/psd-clinical/test", payload: {} });
|
||||
|
||||
expect(testResult.statusCode).toBe(400);
|
||||
expect(testResult.json()).toMatchObject({ code: "workspace_invalid" });
|
||||
expect(diagnose).not.toHaveBeenCalled();
|
||||
expect(testResult.statusCode).toBe(200);
|
||||
expect(testResult.json()).toMatchObject({ activatable: true, diagnostics: [] });
|
||||
expect(diagnose).toHaveBeenCalledWith(workspace, expect.objectContaining({
|
||||
vector: expect.objectContaining({ missing: [], values: {} }),
|
||||
vectorWriter: expect.objectContaining({ missing: [], values: {} }),
|
||||
embedding: expect.objectContaining({ missing: [], values: {} }),
|
||||
}), { writeProbe: false });
|
||||
});
|
||||
|
||||
test("returns a 409 field conflict instead of overwriting a changed workspace", async () => {
|
||||
|
||||
@@ -19,7 +19,7 @@ const thtBin = join(harnessDir, ".venv", "bin", "tht");
|
||||
const roots: string[] = [];
|
||||
|
||||
const canonicalWorkspace = `workspace:
|
||||
schema_version: 2
|
||||
schema_version: 3
|
||||
id: psd-clinical
|
||||
name: Runtime handoff
|
||||
language: en
|
||||
@@ -30,17 +30,14 @@ dwh:
|
||||
supported_transports: [postgres_direct]
|
||||
semantic_index:
|
||||
vector_store:
|
||||
engine: pgvector
|
||||
database: analytics
|
||||
schema: vectors
|
||||
collection: documents
|
||||
dimensions: 768
|
||||
engine: qdrant
|
||||
collection: psd-clinical
|
||||
dimensions: 1024
|
||||
distance: cosine
|
||||
supported_transports: [pgvector_direct]
|
||||
embedding:
|
||||
provider: ollama_compatible
|
||||
model: embed
|
||||
dimensions: 768
|
||||
provider: ollama_internal
|
||||
model: qwen3-embedding:0.6b
|
||||
dimensions: 1024
|
||||
llm_policy:
|
||||
allowed: [zai/glm-5.2]
|
||||
`;
|
||||
@@ -74,7 +71,7 @@ async function fixture() {
|
||||
await git(source, ["remote", "add", "origin", remote]);
|
||||
await git(source, ["push", "origin", "main"]);
|
||||
mkdirSync(secretRoot);
|
||||
for (const name of ["dwh-password", "vector-password"]) {
|
||||
for (const name of ["dwh-password"]) {
|
||||
const path = join(secretRoot, name);
|
||||
writeFileSync(path, `${name}-value`, { mode: 0o600 });
|
||||
chmodSync(path, 0o600);
|
||||
@@ -100,12 +97,6 @@ async function fixture() {
|
||||
THT_WS_PSD_CLINICAL_DWH_PORT: "5432",
|
||||
THT_WS_PSD_CLINICAL_DWH_USER: "reader",
|
||||
THT_WS_PSD_CLINICAL_DWH_PASSWORD_FILE: join(secretRoot, "dwh-password"),
|
||||
THT_WS_PSD_CLINICAL_VECTOR_TRANSPORT: "pgvector_direct",
|
||||
THT_WS_PSD_CLINICAL_VECTOR_HOST: "vector.invalid",
|
||||
THT_WS_PSD_CLINICAL_VECTOR_PORT: "5432",
|
||||
THT_WS_PSD_CLINICAL_VECTOR_USER: "vector-reader",
|
||||
THT_WS_PSD_CLINICAL_VECTOR_PASSWORD_FILE: join(secretRoot, "vector-password"),
|
||||
THT_WS_PSD_CLINICAL_EMBEDDING_BASE_URL: "http://embedding.invalid",
|
||||
};
|
||||
for (const [name, value] of Object.entries(environment)) vi.stubEnv(name, value);
|
||||
vi.stubEnv("THT_HOME", join(root, "home"));
|
||||
@@ -123,7 +114,7 @@ function runnerFor(f: Awaited<ReturnType<typeof fixture>>): ThtRunner {
|
||||
} as any);
|
||||
}
|
||||
|
||||
test("real schema-v2 registry revision loads through ThtRunner and the harness contract", async () => {
|
||||
test("real schema-v3 registry revision loads through ThtRunner and the harness contract", async () => {
|
||||
const f = await fixture();
|
||||
const runner = runnerFor(f);
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ llm_policy:
|
||||
})).vector_db).toMatchObject({ database: "vector_database", schema: "vectors" });
|
||||
});
|
||||
|
||||
test("documents the rendered writer secret-file binding for writer workspaces", () => {
|
||||
test("renders legacy writer secret-file bindings without reintroducing them to the active protocol", () => {
|
||||
const writerVariable = "THT_WS_PSD_CLINICAL_VECTOR_WRITER_API_KEY_FILE";
|
||||
const generated = renderWorkspaceDocs(parseWorkspaceYaml(`workspace:
|
||||
schema_version: 2
|
||||
@@ -245,7 +245,8 @@ llm_policy:
|
||||
expect(generated.envExample).toContain(`${writerVariable}=`);
|
||||
expect(existsSync(protocolPath)).toBe(true);
|
||||
if (existsSync(protocolPath)) {
|
||||
expect(readFileSync(protocolPath, "utf8")).toContain(writerVariable);
|
||||
expect(readFileSync(protocolPath, "utf8")).not.toContain(writerVariable);
|
||||
expect(readFileSync(protocolPath, "utf8")).toContain("There are no supported `THT_WS_<NAMESPACE>_VECTOR_*`");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ test("releases its queue after a malformed lock failure so a later attempt can a
|
||||
|
||||
const result = await Promise.race([
|
||||
lock.run(async () => "recovered"),
|
||||
new Promise<string>((resolve) => setTimeout(() => resolve("timed out"), 250)),
|
||||
new Promise<string>((resolve) => setTimeout(() => resolve("timed out"), 2_000)),
|
||||
]);
|
||||
expect(result).toBe("recovered");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user