Skip to content

Commit 85d964f

Browse files
authored
Disable fsync in Postgres test containers (#11294)
1 parent f4d1d82 commit 85d964f

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎packages/platform/node/test/fixtures/pg-utils.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ export class PgContainer extends Context.Service<PgContainer>()("test/PgContaine
107107
// @effect-diagnostics-next-line promiseInEffectSuccess:off the promise is awaited below, outside the acquisition
108108
const starting = yield* Effect.acquireRelease(
109109
// @effect-diagnostics-next-line lazyPromiseInEffectSync:off
110-
Effect.sync(() => new PostgreSqlContainer("postgres:alpine").start()),
110+
Effect.sync(() =>
111+
new PostgreSqlContainer("postgres:alpine").withCommand(["postgres", "-c", "fsync=off"]).start()
112+
),
111113
releaseContainer
112114
)
113115
return yield* Effect.tryPromise({

‎packages/sql/pg/test/utils.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,12 @@ export class PgContainer extends Context.Service<PgContainer>()("test/PgContaine
123123
lifecycle(
124124
"new",
125125
"container-start",
126-
() => new PostgreSqlContainer("postgres:14-alpine").withWaitStrategy(pgWaitStrategy()).start()
126+
() =>
127+
new PostgreSqlContainer("postgres:14-alpine")
128+
// Tests don't require crash durability; skip fsync waits during table setup.
129+
.withCommand(["postgres", "-c", "fsync=off"])
130+
.withWaitStrategy(pgWaitStrategy())
131+
.start()
127132
),
128133
catch: (cause) => new ContainerError({ cause })
129134
}).pipe(Effect.tap((container) => marker(container.getId(), "container-started"))),

0 commit comments

Comments
 (0)