test(coding-agent): fixed storage tests for schema v6 and slow CI disks
- Compat tests assert the exported SCHEMA_VERSION instead of a stale hardcoded 5; the perf-sample change bumped agent.db to v6. - Backfill cap fixture inserts its 300 rows in one transaction; per-row implicit transactions fsynced 300 times and timed out on CI runners.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Database } from "bun:sqlite";
|
||||
import { afterEach, describe, expect, it } from "bun:test";
|
||||
import * as path from "node:path";
|
||||
import { AgentStorage } from "@oh-my-pi/pi-coding-agent/session/agent-storage";
|
||||
import { AgentStorage, SCHEMA_VERSION } from "@oh-my-pi/pi-coding-agent/session/agent-storage";
|
||||
import { TempDir } from "@oh-my-pi/pi-utils";
|
||||
import { readTableSql } from "./helpers/sqlite-inspect";
|
||||
|
||||
@@ -53,7 +53,7 @@ describe("AgentStorage SQLite compatibility", () => {
|
||||
storage.recordModelUsage("openai/gpt-5");
|
||||
|
||||
expect(storage.getModelUsageOrder()).toEqual(["openai/gpt-5"]);
|
||||
expect(readSchemaVersion(dbPath)).toBe(5);
|
||||
expect(readSchemaVersion(dbPath)).toBe(SCHEMA_VERSION);
|
||||
expect(readTableSql(dbPath, "settings")).not.toContain("unixepoch(");
|
||||
expect(readTableSql(dbPath, "settings")).toContain("strftime('%s','now')");
|
||||
expect(readTableSql(dbPath, "model_usage")).not.toContain("unixepoch(");
|
||||
@@ -87,7 +87,7 @@ describe("AgentStorage SQLite compatibility", () => {
|
||||
|
||||
const storage = await AgentStorage.open(dbPath);
|
||||
|
||||
expect(readSchemaVersion(dbPath)).toBe(5);
|
||||
expect(readSchemaVersion(dbPath)).toBe(SCHEMA_VERSION);
|
||||
expect(readTableSql(dbPath, "settings")).not.toContain("unixepoch(");
|
||||
expect(readTableSql(dbPath, "settings")).toContain("strftime('%s','now')");
|
||||
expect(readTableSql(dbPath, "model_usage")).not.toContain("unixepoch(");
|
||||
|
||||
Reference in New Issue
Block a user