mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-05 23:06:17 +01:00
test: complete observation and connection stats fixtures
This commit is contained in:
1 parent
0a3c6037d2
commit
9a545f7b1d
2 files changed
+3
-2
No files matched your search
@@ -8,7 +8,7 @@ import { agents, companies, environmentLeases, environments, heartbeatRuns, secr
|
||||
applyPendingMigrations, createDb, dedicatedDbConnectionStats, withDedicatedDbConnection, type Db } from "@paperclipai/db";
|
||||
import { resolveExternalTestDatabaseUrl } from "../lib/dedicated-test-database-url.js";
|
||||
import { environmentService } from "../services/environments.js";
|
||||
import { environmentRuntimeService } from "../services/environment-runtime.js";
|
||||
import { classifyEnvironmentCapabilities, environmentRuntimeService } from "../services/environment-runtime.js";
|
||||
import { observeStoppedExecutionResource, readEnvironmentResourceObservationFailure } from "../services/environment-resource-observation.js";
|
||||
import { historicalProviderCredentials } from "../services/historical-provider-credentials.js";
|
||||
import { secretService } from "../services/secrets.js";
|
||||
@@ -78,6 +78,7 @@ suite("optional resource observation with an owned PostgreSQL scope", () => {
|
||||
const original = new Error("original command failed");
|
||||
const runtime = environmentRuntimeService(db, { drivers: [{ driver: "sandbox",
|
||||
acquireRunLease: async () => { throw new Error("unexpected acquire"); }, releaseRunLease: async () => null,
|
||||
resolveCapabilities: async () => classifyEnvironmentCapabilities({ supportedCapabilities: new Set() }),
|
||||
execute: async () => { throw original; }, inspectLeaseResource: inspect,
|
||||
}] });
|
||||
const main = db.transaction(async tx => {
|
||||
|
||||
@@ -31,7 +31,7 @@ function fakeProbes() {
|
||||
mainThreadCpuMs: () => state.mainMs,
|
||||
statementCount: () => state.statements,
|
||||
uptimeSec: () => state.uptime,
|
||||
dedicatedConnections: () => ({ limit: 24, inUse: 3, peakInUse: 9, waiting: 1, queued: 12, overLimit: 0, nestedOverLimit: 0 }),
|
||||
dedicatedConnections: () => ({ limit: 24, inUse: 3, peakInUse: 9, waiting: 1, queued: 12, overLimit: 0, nestedOverLimit: 0, closed: false }),
|
||||
};
|
||||
const advance = (ms: number, load: { busy: number; cpu?: number; statementsPerSecond?: number }) => {
|
||||
state.now += ms;
|
||||
|
||||
Reference in new issue
Block a user