mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-04 21:21:27 +01:00
Revert "perf(ci): stop printing Postgres TRUNCATE notices in server test shards (#21903)"
This reverts commit c938bdfee4.
The change made CI slower, so it is being undone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eaf6461cee
commit
e8afeb4ae7
4 files changed
+1
-58
No files matched your search
@@ -412,31 +412,6 @@ describeWithPostgres("startEmbeddedPostgresTestDatabase template path", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ mode: "template", setting: undefined },
|
||||
{ mode: "fresh", setting: "0" },
|
||||
])("hides NOTICE messages from new clients on the $mode path", { timeout: EMBEDDED_POSTGRES_TEST_TIMEOUT_MS }, async ({ mode, setting }) => {
|
||||
if (setting === undefined) delete process.env.PAPERCLIP_TEST_POSTGRES_TEMPLATE;
|
||||
else process.env.PAPERCLIP_TEST_POSTGRES_TEMPLATE = setting;
|
||||
const database = await startEmbeddedPostgresTestDatabase("paperclip-quiet-notices-");
|
||||
try {
|
||||
expect(lastStartMode()).toBe(mode);
|
||||
const notices: unknown[] = [];
|
||||
const sql = postgres(database.connectionString, { max: 1, onnotice: (notice) => notices.push(notice) });
|
||||
try {
|
||||
expect((await sql`show client_min_messages`)[0]?.client_min_messages).toBe("warning");
|
||||
await sql`create table quiet_parent (id int primary key)`;
|
||||
await sql`create table quiet_child (parent_id int references quiet_parent (id))`;
|
||||
await sql`truncate quiet_parent cascade`;
|
||||
expect(notices).toEqual([]);
|
||||
} finally {
|
||||
await sql.end();
|
||||
}
|
||||
} finally {
|
||||
await database.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
describeOnPosix("cache root safety", () => {
|
||||
it("uses fresh clusters when the cache root is not a private directory of this user", { timeout: EMBEDDED_POSTGRES_TEST_TIMEOUT_MS }, async () => {
|
||||
delete process.env.PAPERCLIP_TEST_POSTGRES_TEMPLATE;
|
||||
|
||||
@@ -15,13 +15,7 @@ import {
|
||||
import { prepareEmbeddedPostgresNativeRuntime } from "./embedded-postgres-native.js";
|
||||
import { loadWithoutEmbeddedPostgresExitHooks } from "./embedded-postgres-lifecycle.js";
|
||||
import { ownTestPostgres, TestPostgresShutdownError, type TestPostgresInstance } from "./test-postgres-owner.js";
|
||||
import postgres from "postgres";
|
||||
import {
|
||||
checkTestPostgresAdmin,
|
||||
QUIET_TEST_DATABASE_SQL,
|
||||
startTestPostgresDatabase,
|
||||
testPostgresAdminUrl,
|
||||
} from "./test-postgres-admin.js";
|
||||
import { checkTestPostgresAdmin, startTestPostgresDatabase, testPostgresAdminUrl } from "./test-postgres-admin.js";
|
||||
|
||||
// Time budget (ms) for a vitest test in the embedded-Postgres cost class: a
|
||||
// test that starts an embedded Postgres cluster and runs migrations. Measured
|
||||
@@ -162,12 +156,6 @@ async function createEmbeddedPostgresTestInstanceAt(dataDir: string) {
|
||||
return { dataDir, port, instance, getRecentLogs: () => logBuffer.getRecentLogs() };
|
||||
}
|
||||
|
||||
async function quietTestDatabase(adminUrl: string, databaseName: string): Promise<void> {
|
||||
const sql = postgres(adminUrl, { max: 1, onnotice() {} });
|
||||
try { await sql.unsafe(QUIET_TEST_DATABASE_SQL(databaseName)); }
|
||||
finally { await sql.end({ timeout: 1 }); }
|
||||
}
|
||||
|
||||
function adminConnectionStringFor(port: number): string {
|
||||
return `postgres://${EMBEDDED_POSTGRES_USER}:${EMBEDDED_POSTGRES_PASSWORD}@127.0.0.1:${port}/postgres`;
|
||||
}
|
||||
@@ -679,7 +667,6 @@ export async function startEmbeddedPostgresTestDatabase(
|
||||
// Both calls are no-ops on a template copy and keep the returned database
|
||||
// identical to the fresh path even if the template were ever stale.
|
||||
await ensurePostgresDatabase(adminConnectionStringFor(port), "paperclip");
|
||||
await quietTestDatabase(adminConnectionStringFor(port), "paperclip");
|
||||
const connectionString = databaseConnectionStringFor(port);
|
||||
await applyPendingMigrations(connectionString);
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import postgres from "postgres";
|
||||
import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
|
||||
import { createDb } from "./client.js";
|
||||
import {
|
||||
@@ -84,18 +83,4 @@ describe.skipIf(!support.supported)("shared PostgreSQL fixtures", () => {
|
||||
}
|
||||
}, 90_000);
|
||||
|
||||
it("hides NOTICE messages from new clients of a disposable database", async () => {
|
||||
__setEmbeddedPostgresCtorProviderForTests(async () => { throw new Error("Must not start another PostgreSQL server"); });
|
||||
const database = await startEmbeddedPostgresTestDatabase("ignored-");
|
||||
databases.push(database);
|
||||
const notices: unknown[] = [];
|
||||
const sql = postgres(database.connectionString, { max: 1, onnotice: (notice) => notices.push(notice) });
|
||||
try {
|
||||
expect((await sql`SHOW client_min_messages`)[0]?.client_min_messages).toBe("warning");
|
||||
await sql`CREATE TABLE quiet_parent (id integer PRIMARY KEY)`;
|
||||
await sql`CREATE TABLE quiet_child (parent_id integer REFERENCES quiet_parent (id))`;
|
||||
await sql`TRUNCATE quiet_parent CASCADE`;
|
||||
expect(notices).toEqual([]);
|
||||
} finally { await sql.end(); }
|
||||
}, 90_000);
|
||||
});
|
||||
@@ -2,9 +2,6 @@ import { randomUUID } from "node:crypto";
|
||||
import postgres from "postgres";
|
||||
import { applyPendingMigrations, closeRegisteredClients } from "./client.js";
|
||||
|
||||
export const QUIET_TEST_DATABASE_SQL = (databaseName: string) =>
|
||||
`ALTER DATABASE "${databaseName}" SET client_min_messages = warning`;
|
||||
|
||||
export function testPostgresAdminUrl(): string | undefined {
|
||||
const value = process.env.PAPERCLIP_TEST_POSTGRES_ADMIN_URL?.trim();
|
||||
if (!value) return undefined;
|
||||
@@ -44,7 +41,6 @@ export async function startTestPostgresDatabase(adminUrl: string): Promise<{
|
||||
})();
|
||||
try {
|
||||
await admin.unsafe(`CREATE DATABASE "${name}"${template ? ` TEMPLATE "${template}"` : ""}`);
|
||||
await admin.unsafe(QUIET_TEST_DATABASE_SQL(name));
|
||||
await applyPendingMigrations(connectionString);
|
||||
return { connectionString, cleanup };
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user