forked from EduCraft/curriculum-project-hub
fix(hub): give integration tests skill-store root and portable DB URL
Admin routes always construct OrganizationAgentConfiguration via readSkillStoreRoot(); CI and local runs without HUB_SKILL_STORE_ROOT failed open. Seed a tmp root when unset. Also make preflight CLI tests honor DATABASE_URL and set the skill-store env in hub-check.
This commit is contained in:
@@ -154,6 +154,7 @@ jobs:
|
||||
--exclude test/integration/agent-sandbox-linux.test.ts
|
||||
env:
|
||||
DATABASE_URL: postgresql://paradigm:paradigm@postgres:5432/cph_hub_test
|
||||
HUB_SKILL_STORE_ROOT: /tmp/cph-hub-check-skills
|
||||
|
||||
# Real-model tests are opt-in: set RUN_REAL_MODEL_TESTS=true and provide
|
||||
# OPENROUTER_API_KEY when a branch should hit live OpenRouter.
|
||||
|
||||
@@ -16,7 +16,9 @@ import { ProviderConnectionService } from "../../src/connections/providerConnect
|
||||
import { FeishuApplicationConnectionService } from "../../src/connections/feishuApplicationConnections.js";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
const TEST_DATABASE_URL = "postgresql://paradigm:paradigm@127.0.0.1:5432/cph_hub_test";
|
||||
const TEST_DATABASE_URL =
|
||||
process.env.DATABASE_URL?.trim() ||
|
||||
"postgresql://paradigm:paradigm@127.0.0.1:5432/cph_hub_test";
|
||||
|
||||
describe("deployment preflight CLI", { timeout: 20_000 }, () => {
|
||||
let root: string;
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* FeishuRuntime (sendText/sendCard are no-ops that record calls), and a mock
|
||||
* AI SDK model factory (doGenerate() returns canned responses - no network).
|
||||
*/
|
||||
import { mkdirSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import type { FastifyBaseLogger } from "fastify";
|
||||
import type {
|
||||
@@ -19,6 +21,18 @@ import type { FeishuRuntime } from "../../src/feishu/client.js";
|
||||
import type { ModelFactory } from "../../src/agent/runner.js";
|
||||
import { LocalSecretEnvelope } from "../../src/security/secretEnvelope.js";
|
||||
|
||||
|
||||
// Admin routes and agent-config tests need a skill store root; seed once for
|
||||
// the whole vitest process when CI/dev didn't set one.
|
||||
if (
|
||||
(process.env.HUB_SKILL_STORE_ROOT === undefined || process.env.HUB_SKILL_STORE_ROOT.trim() === "") &&
|
||||
(process.env.XDG_STATE_HOME === undefined || process.env.XDG_STATE_HOME.trim() === "")
|
||||
) {
|
||||
process.env.HUB_SKILL_STORE_ROOT = `${tmpdir()}/cph-test-skills`;
|
||||
}
|
||||
if (process.env.HUB_SKILL_STORE_ROOT !== undefined && process.env.HUB_SKILL_STORE_ROOT.trim() !== "") {
|
||||
mkdirSync(process.env.HUB_SKILL_STORE_ROOT, { recursive: true });
|
||||
}
|
||||
export const TEST_DATABASE_URL =
|
||||
process.env.DATABASE_URL?.trim() ||
|
||||
"postgresql://paradigm:paradigm@127.0.0.1:5432/cph_hub_test";
|
||||
|
||||
Reference in New Issue
Block a user